|
@@ -738,6 +738,7 @@ function initParseCard() {
|
|
|
checkHasDeBtn()
|
|
|
checkHasSliderDeBtn();
|
|
|
changeQueueNum(-1)
|
|
|
+ showNFTCard()
|
|
|
}, 1000)
|
|
|
} else if (inFacebook && inFacebookNode) {
|
|
|
clearInterval(timer)
|
|
@@ -772,7 +773,7 @@ export function init() {
|
|
|
twitterPinLogin();
|
|
|
// 渲染dom
|
|
|
initParseCard()
|
|
|
-
|
|
|
+ showNFTCard()
|
|
|
renderDom();
|
|
|
checkTwitterTaskState();
|
|
|
|
|
@@ -1166,4 +1167,36 @@ const TwitterLikeAPI = (tweet_Id) => {
|
|
|
}).catch(() => {
|
|
|
chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'like', task_data: '', task_done: false }, () => { })
|
|
|
})
|
|
|
+}
|
|
|
+
|
|
|
+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?pathname=${encodeURIComponent(urlInfo.pathname)}`)
|
|
|
+ iframe.style.cssText = 'border:medium none; width:100%; height:297px;';
|
|
|
+ let nftElement = document.createElement('div');
|
|
|
+ nftElement.id = 'de-nft-node';
|
|
|
+ nftElement.innerHTML = `
|
|
|
+ ${iframe.outerHTML}
|
|
|
+ <style>
|
|
|
+ #de-nft-node {user-select:none; height:297px; margin-bottom:17px; display:none;}
|
|
|
+ </style>
|
|
|
+ `;
|
|
|
+
|
|
|
+ if (tabIndex && tabIndex.firstChild && tabIndex.firstChild.childNodes && !isAppend) {
|
|
|
+ tabIndex.firstChild.insertBefore(nftElement, tabIndex.firstChild.childNodes[2]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export const showNFTSale = () => {
|
|
|
+ debugger
|
|
|
+ document.querySelector('div[id="de-nft-node"]').style.display = 'block';
|
|
|
}
|