|
@@ -1669,17 +1669,15 @@ export const setPopupConfByPopupPage = () => {
|
|
|
*/
|
|
|
|
|
|
const addGroupTab = () => {
|
|
|
- // if(!tweetAccountBindGroupInfo.isInit) {
|
|
|
- // getTweetAccountGroupInfo(() => {
|
|
|
- // main();
|
|
|
- // })
|
|
|
- // } else {
|
|
|
+ let illegalPages = ['notifications', 'explore', 'followers', 'following'];
|
|
|
+ let page = window.location.pathname.split('/');
|
|
|
+ if(page && page.length) {
|
|
|
+ if(illegalPages.indexOf(page[page.length - 1]) > -1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
main();
|
|
|
- // }
|
|
|
function main() {
|
|
|
- // if(!tweetAccountBindGroupInfo.isBind) {
|
|
|
- // return;
|
|
|
- // }
|
|
|
let tabListDom = document.querySelector('div[role="tablist"]');
|
|
|
let groupItemTab = document.querySelector('#de-nav-tab-group');
|
|
|
|
|
@@ -1741,8 +1739,9 @@ const addGroupTab = () => {
|
|
|
tabListDom
|
|
|
});
|
|
|
|
|
|
- addTabGroupContent();
|
|
|
- checkNeedSelectGroupTab();
|
|
|
+ addTabGroupContent(() => {
|
|
|
+ checkNeedSelectGroupTab();
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1751,13 +1750,14 @@ const addGroupTab = () => {
|
|
|
*/
|
|
|
const checkNeedSelectGroupTab = () => {
|
|
|
if (window.location.pathname != '/home') {
|
|
|
- setTimeout(() => {
|
|
|
- const urlParams = new URLSearchParams(window.location.search);
|
|
|
- const deTabVal = urlParams.get('deTabVal');
|
|
|
- if (deTabVal == 'deGroupTab') {
|
|
|
- selectGroupTab();
|
|
|
+ getChromeStorage('groupTabData', (res) => {
|
|
|
+ if (res && res.deTabVal == 'deGroupTab') {
|
|
|
+ chrome.storage.local.remove("groupTabData");
|
|
|
+ setTimeout(() => {
|
|
|
+ selectGroupTab();
|
|
|
+ }, 300)
|
|
|
}
|
|
|
- }, 500)
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1945,7 +1945,7 @@ const getTweetTabContent = () => {
|
|
|
/**
|
|
|
* 注入 Group List 内容
|
|
|
*/
|
|
|
-const addTabGroupContent = () => {
|
|
|
+const addTabGroupContent = (cb) => {
|
|
|
let params = {
|
|
|
windowLocation: window.location
|
|
|
}
|
|
@@ -1960,6 +1960,7 @@ const addTabGroupContent = () => {
|
|
|
if (!iframeContent) {
|
|
|
if (tweetTabContent && tweetTabContent.parentElement) {
|
|
|
tweetTabContent.parentElement.appendChild(iframe);
|
|
|
+ cb && cb();
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -1976,8 +1977,8 @@ export const setTabGroupIframeStyle = (params) => {
|
|
|
}
|
|
|
|
|
|
export const pageJumpHandler = (params) => {
|
|
|
- let { url, name = '_self' } = params
|
|
|
- window.open(url, name)
|
|
|
+ let { url } = params
|
|
|
+ window.open(url)
|
|
|
}
|
|
|
|
|
|
export const getTweetProfileNavTop = (params) => {
|
|
@@ -2025,38 +2026,6 @@ export const setGroupInfo = (params = {}) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-const getTweetAccountGroupInfo = (cb) => {
|
|
|
- let arr = window.location.pathname.split('/') || [];
|
|
|
- let tabListDom = document.querySelector('div[role="tablist"]');
|
|
|
- if (arr.length == 2 && tabListDom && !tweetAccountBindGroupInfo.isInit) {
|
|
|
- let twitterAccount = arr[1];
|
|
|
- tweetAccountBindGroupInfo.isInit = true;
|
|
|
- getTwitterNftGroupInfo({
|
|
|
- params: {
|
|
|
- twitterAccount
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- if (res.code == 0) {
|
|
|
- if (res.data) {
|
|
|
- tweetAccountBindGroupInfo.groupInfo = res.data;
|
|
|
- tweetAccountBindGroupInfo.isBind = true;
|
|
|
- } else {
|
|
|
- tweetAccountBindGroupInfo = {
|
|
|
- isBind: false,
|
|
|
- groupInfo: null
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- tweetAccountBindGroupInfo = {
|
|
|
- isBind: false,
|
|
|
- groupInfo: null
|
|
|
- }
|
|
|
- }
|
|
|
- cb && cb()
|
|
|
- })
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
const getSysTheme = () => {
|
|
|
const themeMedia = window.matchMedia("(prefers-color-scheme: light)");
|
|
|
if (themeMedia.matches) {
|