|
@@ -284,6 +284,13 @@ class ParseCard {
|
|
|
_iframe.style.cssText = 'border:medium none; width:505px; min-height:180px;'
|
|
|
return _iframe
|
|
|
}
|
|
|
+ createTreasureIframe(params = { page_type, tweet_Id, post_Id, invite_code }) {
|
|
|
+ let _iframe = document.createElement('iframe')
|
|
|
+ _iframe.id = post_Id
|
|
|
+ _iframe.src = chrome.runtime.getURL('/iframe/treasure-hunt.html') + `?params=${JSON.stringify(params)}`;
|
|
|
+ _iframe.style.cssText = 'border:medium none; width:375px; min-height500pxpx;'
|
|
|
+ return _iframe
|
|
|
+ }
|
|
|
isHasIframeByArticle(dom_card) {
|
|
|
if (!dom_card || !dom_card.parentElement) {
|
|
|
return
|
|
@@ -472,6 +479,29 @@ class ParseCard {
|
|
|
dom.appendChild(this.createIframe({ post_Id, tweet_Id, page_type }))
|
|
|
}
|
|
|
}
|
|
|
+ replaceDOMRreasureCard({ invite_code, dom_card, tweet_Id, post_Id, time, short_url, page_type = '' }) {
|
|
|
+ if (!dom_card || !dom_card.parentElement) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let type
|
|
|
+ let dom = dom_card.querySelector('div[aria-labelledby]')
|
|
|
+ if (dom) {
|
|
|
+ type = 'card'
|
|
|
+ for (let i = 0; i < dom.childNodes.length; i++) {
|
|
|
+ if (dom.childNodes[i].dataset && dom.childNodes[i].dataset.testid && dom.childNodes[i].dataset.testid == 'card.wrapper') {
|
|
|
+ dom.children[i].style.display = 'none'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ type = 'txt'
|
|
|
+ dom = dom_card.querySelector('div[lang][dir=auto]').parentElement
|
|
|
+ }
|
|
|
+
|
|
|
+ dom.style = 'min-height:500px'
|
|
|
+ if (dom) {
|
|
|
+ dom.appendChild(this.createTreasureIframe({ post_Id, tweet_Id, page_type, invite_code }))
|
|
|
+ }
|
|
|
+ }
|
|
|
replaceNftDomRedPacket({ dom_card, tweet_Id, post_Id, time, short_url }) {
|
|
|
if (!dom_card || !dom_card.parentElement) {
|
|
|
return
|