Browse Source

Merge branch 'dev_1.1.1' of https://git.yishihui.com/DeNet/de-net into dev_1.1.1

zhangwei 2 years ago
parent
commit
4fe5a4fa3b
3 changed files with 37 additions and 3 deletions
  1. 7 0
      src/logic/content/nft.js
  2. 28 2
      src/logic/content/twitter.js
  3. 2 1
      src/view/iframe/nft/group.vue

+ 7 - 0
src/logic/content/nft.js

@@ -2,6 +2,7 @@ import { getOffsetRect, nextTick } from '@/uilts/help'
 import { listJoinNftGroup } from '@/http/nft';
 import { getChromeStorage } from '@/uilts/chromeExtension.js'
 import { _setPublishContent, publishNFTTweetPost } from './twitter';
+import { jumpTwitterDetailByAlert } from '@/logic/content/help/twitter.js'
 
 var ifShowNftGroup = false;
 var tempNftGroupPost = null;
@@ -205,5 +206,11 @@ function _addTweetButtonListen() {
 function _postTweetContent() {
     if (tempNftGroupPost && tempNftGroupPost.groupId) {
         publishNFTTweetPost(tempNftGroupPost)
+        // 非首页处理
+        let jumpUrl = new URL(tempNftGroupPost['entryUrl'] || '');
+        let pathname = jumpUrl.pathname || '';
+        if (pathname !== '/home') {
+            jumpTwitterDetailByAlert()
+        }
     }
 }

+ 28 - 2
src/logic/content/twitter.js

@@ -845,9 +845,9 @@ export function init() {
     addJoinedGroupList();
     getSysTheme();
 
-    // getTweetAccountGroupInfo( () => {
     addGroupTab()
-    // })
+    fixProfileTabAutoSwitch();
+
 
     getChromeStorage("popupShowPublishDialog", (res) => {
         console.log("popupShowPublishDialog", res);
@@ -2095,6 +2095,32 @@ const getGroupTabContentNode = () => {
     return content;
 }
 
+const fixProfileTabAutoSwitch = () => {
+    setInterval(() => {
+        let groupTab = getGroupTabNode();
+        let tweetTab = document.querySelector('a[aria-selected="true"]');
+
+        if(groupTab) {
+            let line = groupTab.querySelector('#de-tab-line');
+            if(line) {
+                let {display} = line.style;
+                if(display != 'none' && tweetTab) {
+                    let groupContent = getGroupTabContentNode();
+                    if(groupContent) {
+                        let tweetTabContent = getTweetTabContent();
+                        let {visibility} = tweetTabContent.style;
+                        let {display} = groupContent.style;
+                        
+                        if(display == 'block' && visibility != 'hidden') {
+                            groupTab.click();
+                        }
+                    }
+                }
+            }
+        }
+    }, 1000)
+}
+
 /**
  * 
  * 设置Tab Group Iframe 样式

+ 2 - 1
src/view/iframe/nft/group.vue

@@ -12,9 +12,10 @@ const clickHandler = (item) => {
             groupId: item.nftGroupId
         }
     }).then(res => {
-        let { code, data } = res
+        let { code, data = {} } = res
         if (code === 0) {
             chrome.tabs.getCurrent((tab) => {
+                data['entryUrl'] = tab.url;
                 chrome.tabs.sendMessage(tab.id, { actionType: "IFRAME_NFT_GROUP_LIST_HIDE" });
                 chrome.tabs.sendMessage(tab.id, {
                     actionType: "IFRAME_NFT_GROUP_SET_CONTENT",