Selaa lähdekoodia

[edit] bug fix

wenliming 2 vuotta sitten
vanhempi
commit
79f2aad031

+ 2 - 1
src/entry/content.js

@@ -107,7 +107,8 @@ chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
             twitterPublishHandler(req.publishRes);
             break;
         case 'IFRAME_TWITTER_SHOW_POPUP_PAGE':
-            showPopupPage({path: '/NFT'}); 
+            let {from = ''} = req.data || {};
+            showPopupPage({path: '/NFT', from}); 
             break
         case "IFRAME_TWITTER_SHOW_BUY_NFT":
             showBuyNFT(req.data)

+ 1 - 1
src/logic/background/twitter.js

@@ -380,7 +380,7 @@ export const setPopupConfig = (activeInfo) => {
     }, (tabs) => {
         if(tabs.length) {
             let {pendingUrl = '', url = ''} = tabs[0];
-            if(pendingUrl.startsWith('chrome://') || url.startsWith('chrome://')) {
+            if(pendingUrl.startsWith('chrome://') || url.startsWith('chrome://') || pendingUrl.startsWith('https://chrome.google.com') || url.startsWith('https://chrome.google.com')) {
                 chrome.action.setPopup({
                     popup: 'popup.html',
                 },function() {

+ 17 - 24
src/logic/content/twitter.js

@@ -1300,7 +1300,7 @@ export const appendPopupPage = (params = {}) => {
         iframe.id = 'de-popup-page';
         iframe.src = chrome.runtime.getURL('/iframe/popup-page.html') + `#${path}`;
         iframe.style.cssText = `border: medium none; width: 375px;
-        height: 600px;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;
+        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;
         animation-timing-function: ease-in-out !important;
         animation-fill-mode: forwards !important;
@@ -1331,46 +1331,32 @@ export const appendPopupPage = (params = {}) => {
     }
 }
 
+let showPopupPageFrom = '';
 export const showPopupPage = (params = {}) => {
-    let { path = '' } = params;
+    let { path = '', from } = params;
+    showPopupPageFrom = from;
     hidePinTips();
     hideNoticeBindTweet();
 
     let iframe = document.getElementById('de-popup-page');
-    if (iframe) {
-        if(path) {
-            iframe.src = chrome.runtime.getURL('/iframe/popup-page.html') + `#${path}`;
-        }
-        iframe.style.transform = 'translateX(-' + 395 + 'px)';
-
-        chrome.runtime.sendMessage({ 
-            actionType: "CONTENT_POPUP_PAGE_SHOW", 
-            data: { } 
-        }, () => { });
-
-        let overlay = document.getElementById('de-popup-overlay');
-        overlay.style.display = 'block';
-
-        let htmlDom = document.querySelector('html');
-        if(htmlDom) {
-            htmlDom.style.overflowY = 'hidden';
-        }
-    } else {
+    if (!iframe) {
         appendPopupPage();
         iframe = document.getElementById('de-popup-page');
+    }
+    if(iframe) {
         if(path) {
             iframe.src = chrome.runtime.getURL('/iframe/popup-page.html') + `#${path}`;
         }
         iframe.style.transform = 'translateX(-' + 395 + 'px)';
-
+    
         chrome.runtime.sendMessage({ 
             actionType: "CONTENT_POPUP_PAGE_SHOW", 
             data: { } 
         }, () => { });
-
+    
         let overlay = document.getElementById('de-popup-overlay');
         overlay.style.display = 'block';
-
+    
         let htmlDom = document.querySelector('html');
         if(htmlDom) {
             htmlDom.style.overflowY = 'hidden';
@@ -1390,6 +1376,13 @@ export const hidePopupPage = () => {
         if(htmlDom) {
             htmlDom.style.overflowY = 'auto';
         }
+        if(showPopupPageFrom == 'BUY_NFT_FINISH') {
+            chrome.runtime.sendMessage({ 
+                actionType: "CONTENT_GET_PINED", 
+                data: {} 
+            }, () => { });
+            showPopupPageFrom = '';
+        }
     }
 }
 

+ 3 - 0
src/view/iframe/buy-nft/buy/open-box.vue

@@ -50,6 +50,9 @@ const showNFTs = () => {
                 }, (res) => { });
                 chrome.tabs.sendMessage(tab.id, {
                     actionType: "IFRAME_TWITTER_SHOW_POPUP_PAGE",
+                    data: {
+                        from: 'BUY_NFT_FINISH'
+                    }
                 }, (res) => { });
                 router.replace('/')
             })

+ 5 - 0
src/view/iframe/popup/index.vue

@@ -18,8 +18,13 @@ onMounted(() => {
 #app {
     height: 100%;
 }
+
 .popup_page_main {
     height: 100%;
     overflow: hidden;
 }
+
+.popup_content{
+    height: 650px !important;
+}
 </style>