|
@@ -1,5 +1,5 @@
|
|
|
import { getChromeStorage, setChromeStorage } from '@/uilts/chromeExtension.js'
|
|
|
-import { throttle, getQueryString, getCookie, nextTick, getQueryStringByUrl } from '@/uilts/help'
|
|
|
+import { throttle, getQueryString, getCookie, nextTick, getQueryStringByUrl, getStorage, setStorage } from '@/uilts/help'
|
|
|
import { discordAuthRedirectUri, iframeHost } from '@/http/configAPI'
|
|
|
import { reportSrcPublishEvent } from '@/http/publishApi'
|
|
|
import Report from "@/log-center/log"
|
|
@@ -398,7 +398,7 @@ function _addIframe() {
|
|
|
// let span = document.createElement('span');
|
|
|
// const shadowRoot = span.attachShadow({mode: 'closed'})
|
|
|
let iframe = document.createElement('iframe');
|
|
|
- iframe.src = chrome.runtime.getURL('/iframe/publish.html')
|
|
|
+ iframe.src = 'chrome-extension://omadcdhfdfhbklafpaddghnjimpfemgh' + ('/iframe/publish.html')
|
|
|
iframe.id = 'iframe-content'
|
|
|
iframe.style.cssText = 'position:fixed;top:0px;right:0;display:block; width:100%;height:100%;z-index:10000; border: medium none;display:none;background: rgba(255,255,255,0);';
|
|
|
// shadowRoot.appendChild(iframe);
|
|
@@ -421,9 +421,9 @@ function addPublishTipsIframe(params = {}) {
|
|
|
let iframe = document.createElement('iframe');
|
|
|
iframe.id = 'de-publish-tips'
|
|
|
if (params.type == 'nft') {
|
|
|
- iframe.src = chrome.runtime.getURL('/iframe/publish-tips.html?type="nft"');
|
|
|
+ iframe.src = 'chrome-extension://omadcdhfdfhbklafpaddghnjimpfemgh' + ('/iframe/publish-tips.html?type="nft"');
|
|
|
} else {
|
|
|
- iframe.src = chrome.runtime.getURL('/iframe/publish-tips.html');
|
|
|
+ iframe.src = 'chrome-extension://omadcdhfdfhbklafpaddghnjimpfemgh' + ('/iframe/publish-tips.html');
|
|
|
}
|
|
|
|
|
|
iframe.style.cssText = `border: medium none; width:270px;height:500px;position: fixed; right: ${right}px; top: 5%;z-index: -1`
|
|
@@ -440,7 +440,7 @@ export function noticeBindTweet(params) {
|
|
|
hidePopupPage();
|
|
|
let iframe = document.createElement('iframe');
|
|
|
iframe.id = 'de-notice-bind-tweet';
|
|
|
- iframe.src = chrome.runtime.getURL('/iframe/bind-tweet.html') + `?params=${JSON.stringify(params)}`;
|
|
|
+ iframe.src = 'chrome-extension://omadcdhfdfhbklafpaddghnjimpfemgh' + ('/iframe/bind-tweet.html') + `?params=${JSON.stringify(params)}`;
|
|
|
iframe.style.cssText = `border: medium none; width:400px;min-height:313px;position: fixed; right: 16px; top: 16px;border-radius: 20px;`
|
|
|
let iframeContent = document.getElementById('de-notice-bind-tweet');
|
|
|
if (!iframeContent) {
|
|
@@ -460,6 +460,7 @@ export function hideNoticeBindTweet() {
|
|
|
* @private
|
|
|
*/
|
|
|
function _deNetBtnClick(params = {}) {
|
|
|
+ debugger
|
|
|
getUserInfo((res) => {
|
|
|
if (res) {
|
|
|
if (window.location.pathname != '/home') {
|
|
@@ -765,6 +766,7 @@ export function bindTwitterArtMethod() {
|
|
|
|
|
|
|
|
|
import parseCard from './ParseCard'
|
|
|
+import { useFavicon } from '_@vueuse_core@8.9.4@@vueuse/core'
|
|
|
|
|
|
// 检测dom改变
|
|
|
// 获取短链接
|
|
@@ -808,73 +810,66 @@ function onChangePageMain(targetNode) {
|
|
|
// 2.监听卡片是否可见
|
|
|
// 3.如果可见了 去找
|
|
|
|
|
|
-function setIframeRedPacket(type = 'twitter') {
|
|
|
+function setIframeCard(type = 'twitter') {
|
|
|
// 获取所有卡片参数
|
|
|
let card_json_data
|
|
|
- switch (type) {
|
|
|
- case 'facebook':
|
|
|
- card_json_data = parseCard.parseFacebookCardParmas()
|
|
|
- for (let i in card_json_data) {
|
|
|
- parseCard.replaceFacebookPacket(card_json_data[i])
|
|
|
- }
|
|
|
- break;
|
|
|
- default:
|
|
|
- card_json_data = parseCard.parseAllDeNetCardParmas()
|
|
|
- // 过滤出可以请求的短链接
|
|
|
- parseCard.getCardParmas(card_json_data).then((res) => {
|
|
|
- for (let i in res.has_post_Id_card_data) {
|
|
|
- let item = res.has_post_Id_card_data[i];
|
|
|
- if (item && item.post_Id && item.post_Id.indexOf('nft/') >= 0) {
|
|
|
- parseCard.replaceNftDomRedPacket(item)
|
|
|
- } else if (item && item.post_Id && item.post_Id.indexOf('nft_group/') >= 0) {
|
|
|
- parseCard.replaceNftGroupDomRedPacket(item)
|
|
|
- } else if (item && item.post_Id && item.post_Id.indexOf('luckdraw/') >= 0) {
|
|
|
- item.post_Id = item.post_Id.split('luckdraw/')[1] || ''
|
|
|
- item.page_type = '抽奖'
|
|
|
- parseCard.replaceDOMRedPacket(item)
|
|
|
- } else if (item && item.post_Id && item.post_Id.indexOf('toolbox/') >= 0) {
|
|
|
- item.page_type = 'toolbox'
|
|
|
- item.post_Id = item.post_Id.split('toolbox/')[1] || ''
|
|
|
- if (item.post_Id) {
|
|
|
- parseCard.replaceIframeToolBox(item)
|
|
|
+ if (type == 'facebook') {
|
|
|
+ card_json_data = parseCard.parseFacebookCardParmas()
|
|
|
+ for (let i in card_json_data) {
|
|
|
+ parseCard.replaceFacebookPacket(card_json_data[i])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (type == 'twitter') {
|
|
|
+ card_json_data = parseCard.parseAllDeNetCardParmas()
|
|
|
+ // 过滤出可以请求的短链接
|
|
|
+ parseCard.getCardParmas(card_json_data).then((res) => {
|
|
|
+ for (let i in res.has_post_Id_card_data) {
|
|
|
+ let item = res.has_post_Id_card_data[i];
|
|
|
+ if (item && item.post_Id && item.post_Id.indexOf('nft/') >= 0) {
|
|
|
+ parseCard.replaceNftDomRedPacket(item)
|
|
|
+ } else if (item && item.post_Id && item.post_Id.indexOf('nft_group/') >= 0) {
|
|
|
+ parseCard.replaceNftGroupDomRedPacket(item)
|
|
|
+ } else if (item && item.post_Id && item.post_Id.indexOf('luckdraw/') >= 0) {
|
|
|
+ item.post_Id = item.post_Id.split('luckdraw/')[1] || ''
|
|
|
+ item.page_type = '抽奖'
|
|
|
+ parseCard.replaceDOMRedPacket(item)
|
|
|
+ } else if (item && item.post_Id && item.post_Id.indexOf('toolbox/') >= 0) {
|
|
|
+ item.page_type = 'toolbox'
|
|
|
+ item.post_Id = item.post_Id.split('toolbox/')[1] || ''
|
|
|
+ if (item.post_Id) {
|
|
|
+ parseCard.replaceIframeToolBox(item)
|
|
|
+ }
|
|
|
+ } else if (item && item.post_Id && !item.post_Id.includes('/')) {
|
|
|
+ item.page_type = '红包'
|
|
|
+ parseCard.replaceDOMRedPacket(item)
|
|
|
+ // 夺宝链接
|
|
|
+ } else if (item && item.post_Id && item.post_Id.includes('treasure/')) {
|
|
|
+ // https://testh5.denetme.net/treasure/{postid}
|
|
|
+ // https://testh5.denetme.net/treasure/invite/{inviteCode}
|
|
|
+ // 邀请链接
|
|
|
+ if (item.post_Id.includes('invite/')) {
|
|
|
+ item.invite_code = item.post_Id.split('invite/')[1] || ''
|
|
|
+ item.page_type = '邀请链接'
|
|
|
+ if (item.invite_code) {
|
|
|
+ item.post_Id = ''
|
|
|
+ parseCard.replaceDOMTreasureCard(item)
|
|
|
}
|
|
|
- } else if (item && item.post_Id && !item.post_Id.includes('/')) {
|
|
|
- item.page_type = '红包'
|
|
|
- parseCard.replaceDOMRedPacket(item)
|
|
|
- // 夺宝链接
|
|
|
- } else if (item && item.post_Id && item.post_Id.includes('treasure/')) {
|
|
|
- // https://testh5.denetme.net/treasure/{postid}
|
|
|
- // https://testh5.denetme.net/treasure/invite/{inviteCode}
|
|
|
- // 邀请链接
|
|
|
- if (item.post_Id.includes('invite/')) {
|
|
|
- item.invite_code = item.post_Id.split('invite/')[1] || ''
|
|
|
- item.page_type = '邀请链接'
|
|
|
- if (item.invite_code) {
|
|
|
- item.post_Id = ''
|
|
|
- parseCard.replaceDOMTreasureCard(item)
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 原始链接
|
|
|
- item.page_type = '原始链接'
|
|
|
- item.post_Id = item.post_Id.split('treasure/')[1] || ''
|
|
|
- if (item.post_Id) {
|
|
|
- parseCard.replaceDOMTreasureCard(item)
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ // 原始链接
|
|
|
+ item.page_type = '原始链接'
|
|
|
+ item.post_Id = item.post_Id.split('treasure/')[1] || ''
|
|
|
+ if (item.post_Id) {
|
|
|
+ parseCard.replaceDOMTreasureCard(item)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (res.need_net_short_url.length > 0) {
|
|
|
- // 请求短链接
|
|
|
- chrome.runtime.sendMessage({ actionType: "CONTENT_TWITTER_SHORT_LINK", data: "", arr_url: res.need_net_short_url }, (res) => {
|
|
|
- if (!res) {
|
|
|
- Report.reportLog({
|
|
|
- objectType: Report.objectType.parse_card_error
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- break;
|
|
|
+ }
|
|
|
+ if (res.need_net_short_urls.length > 0) {
|
|
|
+ parseCard.netShortUrl(res.need_net_short_urls, () => {
|
|
|
+ changeQueueNum(5)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -940,7 +935,7 @@ function initParseCard() {
|
|
|
return
|
|
|
}
|
|
|
initGroupTip()
|
|
|
- setIframeRedPacket()
|
|
|
+ setIframeCard()
|
|
|
checkHasSliderDeBtn();
|
|
|
changeQueueNum(-1)
|
|
|
showNFTCard()
|
|
@@ -954,7 +949,7 @@ function initParseCard() {
|
|
|
if (queue_num <= 0) {
|
|
|
return
|
|
|
}
|
|
|
- setIframeRedPacket('facebook')
|
|
|
+ setIframeCard('facebook')
|
|
|
changeQueueNum(-1)
|
|
|
}, 1000)
|
|
|
}
|
|
@@ -1416,7 +1411,7 @@ export function showJoinDialog(data) {
|
|
|
let iframe = document.querySelector('#nftProjectId')
|
|
|
iframe.style.display = 'block'
|
|
|
iframe.contentWindow.postMessage({ actionType: 'SHOW_JOIN_DATA', data }, '*');
|
|
|
- iframe.src = chrome.runtime.getURL(`/iframe/buy-nft.html#/group?params=${JSON.stringify(data)}&time=${new Date().getTime()}`)
|
|
|
+ iframe.src = 'chrome-extension://omadcdhfdfhbklafpaddghnjimpfemgh' + (`/iframe/buy-nft.html#/group?params=${JSON.stringify(data)}&time=${new Date().getTime()}`)
|
|
|
}
|
|
|
|
|
|
const TwitterFollowAPI = (item, tweet_Id) => {
|
|
@@ -1593,7 +1588,7 @@ export const TwitterApiUserByScreenName = (params, cb) => {
|
|
|
TwitterApiUserByScreenNameReq({screen_name}).then(function (response) {
|
|
|
chrome.runtime.sendMessage({ actionType: "CONTENT_API_GET_TWEET_USER_INFO_RES", data: response.data.data || {}, tweetId, objectType }, () => { })
|
|
|
}).catch(function (err) {
|
|
|
- chrome.runtime.sendMessage({ actionType: "CONTENT_API_GET_TWEET_USER_INFO_RES", data: {}, tweetId, objectType }, () => { })
|
|
|
+ chrome.runtime.sendMessage({ actionType: "CONTENT_API_GET_TWEET_USER_INFO_RES", data: {}, tweetId, objectType }, () => { })
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -1750,7 +1745,7 @@ const initGroupTip = () => {
|
|
|
if (iframe_banner) {
|
|
|
if (twitterAccount != getQueryStringByUrl(iframe_banner.src, 'twitterAccount')) {
|
|
|
iframe_banner.style.display = 'none'
|
|
|
- // iframe_banner.src = chrome.runtime.getURL(`/iframe/group-card.html?twitterAccount=${twitterAccount}`)
|
|
|
+ // iframe_banner.src = 'chrome-extension://omadcdhfdfhbklafpaddghnjimpfemgh' + (`/iframe/group-card.html?twitterAccount=${twitterAccount}`)
|
|
|
iframe_banner.contentWindow.postMessage({ actionType: 'SHOW_BANNER', twitterAccount }, '*');
|
|
|
}
|
|
|
return
|
|
@@ -1760,7 +1755,7 @@ const initGroupTip = () => {
|
|
|
let iframe = document.createElement('iframe')
|
|
|
iframe.id = 'denet_group_banner'
|
|
|
iframe.style.cssText = 'border: medium none; display:none; width:100%; height:100px;'
|
|
|
- iframe.src = chrome.runtime.getURL(`/iframe/group-card.html?twitterAccount=${twitterAccount}`)
|
|
|
+ iframe.src = 'chrome-extension://omadcdhfdfhbklafpaddghnjimpfemgh' + (`/iframe/group-card.html?twitterAccount=${twitterAccount}`)
|
|
|
// iframe.contentWindow.postMessage({ actionType: 'SHOW_BANNER', twitterAccount }, '*');
|
|
|
if (dom && !dom.parentNode.children[0].querySelector('iframe')) {
|
|
|
// dom.parentNode.insertBefore(iframe, dom)
|
|
@@ -1791,7 +1786,7 @@ export const showBuyNFT = ({ nft_project_Id, post_Id = '' }) => {
|
|
|
}
|
|
|
let iframe = document.querySelector('#nftProjectId')
|
|
|
iframe.style.display = 'block'
|
|
|
- iframe.src = chrome.runtime.getURL(`/iframe/buy-nft.html#/?nftProjectId=${nft_project_Id}&postId=${post_Id}`)
|
|
|
+ iframe.src = 'chrome-extension://omadcdhfdfhbklafpaddghnjimpfemgh' + (`/iframe/buy-nft.html#/?nftProjectId=${nft_project_Id}&postId=${post_Id}`)
|
|
|
}
|
|
|
|
|
|
const initBuyNFT = () => {
|
|
@@ -1810,7 +1805,7 @@ export const showNFTCard = () => {
|
|
|
let where = isTwitter && userElem && tabIndex;
|
|
|
if (where) {
|
|
|
let iframe = document.createElement('iframe');
|
|
|
- iframe.src = chrome.runtime.getURL(`/iframe/nft-card.html`)
|
|
|
+ iframe.src = 'chrome-extension://omadcdhfdfhbklafpaddghnjimpfemgh' + (`/iframe/nft-card.html`)
|
|
|
iframe.style.cssText = 'border:medium none; width:100%; height:290px;';
|
|
|
let nftElement = document.createElement('div');
|
|
|
nftElement.id = 'de-nft-node';
|
|
@@ -1851,7 +1846,7 @@ export const appendPopupPage = (params = {}) => {
|
|
|
|
|
|
let iframe = document.createElement('iframe');
|
|
|
iframe.id = 'de-popup-page';
|
|
|
- iframe.src = chrome.runtime.getURL('/iframe/popup-page.html') + `#${path}`;
|
|
|
+ iframe.src = 'chrome-extension://omadcdhfdfhbklafpaddghnjimpfemgh' + ('/iframe/popup-page.html') + `#${path}`;
|
|
|
iframe.style.cssText = `border: medium none; width: 375px !important;
|
|
|
height: 650px;position: fixed; right: 16px; top: 16px;background: #FFFFFF;border: 0.5px solid #919191;box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.2);box-sizing: border-box;z-index: 90000;
|
|
|
animation-duration: 0.5s !important;
|
|
@@ -1898,7 +1893,7 @@ export const showPopupPage = (params = {}) => {
|
|
|
}
|
|
|
if (iframe) {
|
|
|
if (path) {
|
|
|
- iframe.src = chrome.runtime.getURL('/iframe/popup-page.html') + `#${path}`;
|
|
|
+ iframe.src = 'chrome-extension://omadcdhfdfhbklafpaddghnjimpfemgh' + ('/iframe/popup-page.html') + `#${path}`;
|
|
|
}
|
|
|
iframe.style.transform = 'translateX(-' + 395 + 'px)';
|
|
|
|