|
@@ -4,9 +4,9 @@ import { discordAuthRedirectUri } from '@/http/configAPI'
|
|
|
import { reportSrcPublishEvent } from '@/http/publishApi'
|
|
|
import Report from "@/log-center/log"
|
|
|
import { fetchAddFinishEvent } from '@/logic/background/fetch/facebook';
|
|
|
-import { showNFTGroupIcon, hideNFTGroupList, checkUserJoinGroup, elemAddEventListener, addJoinedGroupList, setTabGroupIframeStyle, setGroupTabStatus, addGroupTab, groupBtnStyleChange, sendMessageToGroupBanner, setGroupTabSelfStyle } from '@/logic/content/nft';
|
|
|
+import { showNFTGroupIcon, hideNFTGroupList, checkUserJoinGroup, addJoinedGroupList, setTabGroupIframeStyle, setGroupTabStatus, addGroupTab, groupBtnStyleChange, sendMessageToGroupBanner, setGroupTabSelfStyle } from '@/logic/content/nft';
|
|
|
import { jumpTwitterDetailByAlert, showEditTweet } from '@/logic/content/help/twitter.js'
|
|
|
-import { clearPostContent, setGroupIconStatus } from '@/logic/content/nft.js'
|
|
|
+import { clearPostContent, setGroupIconStatus, showNFTCard, initBuyNFT, showBuyNFTAction, hideBuyNFTAction } from '@/logic/content/nft.js'
|
|
|
import ToolBox from '@/logic/content/ToolBox'
|
|
|
import axios from 'axios';
|
|
|
|
|
@@ -827,17 +827,6 @@ export function initExecuteScript(changes) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-const createNFTIframe = ({ url, id }, callback) => {
|
|
|
- let iframe = document.createElement('iframe')
|
|
|
- iframe.id = id
|
|
|
- iframe.src = url
|
|
|
- iframe.style.cssText = 'border:medium none; width:100%; height:100%; z-index:100; position: fixed; top:0;left:0; display:none;';
|
|
|
- iframe.onload = () => {
|
|
|
- callback && callback()
|
|
|
- }
|
|
|
- document.body.appendChild(iframe);
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
function initParseCard() {
|
|
|
let timer = setInterval(() => {
|
|
@@ -1559,53 +1548,9 @@ export const showGroupTip = () => {
|
|
|
groupBtnStyleChange();
|
|
|
}
|
|
|
|
|
|
-export const hideBuyNFT = () => {
|
|
|
- let iframe = document.querySelector('#nftProjectId')
|
|
|
- iframe.style.display = 'none'
|
|
|
- iframe.src = ''
|
|
|
-}
|
|
|
+export const hideBuyNFT = hideBuyNFTAction;
|
|
|
|
|
|
-export const showBuyNFT = ({ nft_project_Id }) => {
|
|
|
- if (!nft_project_Id) {
|
|
|
- return
|
|
|
- }
|
|
|
- let iframe = document.querySelector('#nftProjectId')
|
|
|
- iframe.style.display = 'block'
|
|
|
- iframe.src = chrome.runtime.getURL(`/iframe/buy-nft.html#/?nftProjectId=${nft_project_Id}`)
|
|
|
-}
|
|
|
-
|
|
|
-const initBuyNFT = () => {
|
|
|
- let url = ''
|
|
|
- let id = `nftProjectId`
|
|
|
- createNFTIframe({ url, id })
|
|
|
-}
|
|
|
-
|
|
|
-export const showNFTCard = () => {
|
|
|
- let urlInfo = new URL(window.location.href)
|
|
|
- let isTwitter = urlInfo.hostname === 'twitter.com'
|
|
|
- let userElem = document.querySelector('div[data-testid="UserName"]');
|
|
|
- let sideElem = document.querySelector('div[data-testid="sidebarColumn"]')
|
|
|
- let tabIndex = sideElem && sideElem.querySelector('div[tabindex="0"]');
|
|
|
- let isAppend = document.querySelector('div[id="de-nft-node"]');
|
|
|
- let where = isTwitter && userElem && tabIndex;
|
|
|
- if (where) {
|
|
|
- let iframe = document.createElement('iframe');
|
|
|
- iframe.src = chrome.runtime.getURL(`/iframe/nft-card.html`)
|
|
|
- iframe.style.cssText = 'border:medium none; width:100%; height:290px;';
|
|
|
- let nftElement = document.createElement('div');
|
|
|
- nftElement.id = 'de-nft-node';
|
|
|
- nftElement.innerHTML = `
|
|
|
- ${iframe.outerHTML}
|
|
|
- <style>
|
|
|
- #de-nft-node {height:290px; margin-bottom:17px; display:none;}
|
|
|
- </style>
|
|
|
- `;
|
|
|
-
|
|
|
- if (tabIndex && tabIndex.firstChild && tabIndex.firstChild.childNodes && !isAppend) {
|
|
|
- tabIndex.firstChild.insertBefore(nftElement, tabIndex.firstChild.childNodes[2]);
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+export const showBuyNFT = showBuyNFTAction;
|
|
|
|
|
|
export const showNFTSale = () => {
|
|
|
document.querySelector('div[id="de-nft-node"]').style.display = 'block';
|