|
@@ -1,6 +1,6 @@
|
|
|
import { getChromeStorage, setChromeStorage } from '@/uilts/chromeExtension.js'
|
|
|
import { throttle, getQueryString, getCookie, nextTick, getQueryStringByUrl } from '@/uilts/help'
|
|
|
-import { discordAuthRedirectUri } from '@/http/configAPI'
|
|
|
+import { discordAuthRedirectUri, iframeHost } from '@/http/configAPI'
|
|
|
import { reportSrcPublishEvent } from '@/http/publishApi'
|
|
|
import Report from "@/log-center/log"
|
|
|
import { fetchAddFinishEvent } from '@/logic/background/fetch/facebook';
|
|
@@ -9,6 +9,7 @@ import { jumpTwitterDetailByAlert, showEditTweet } from '@/logic/content/help/tw
|
|
|
import { clearPostContent, setGroupIconStatus } from '@/logic/content/nft.js'
|
|
|
import { toolBox } from '@/logic/content/ToolBox'
|
|
|
import axios from 'axios';
|
|
|
+import messageCenter from '@/uilts/messageCenter';
|
|
|
|
|
|
let dom = {};
|
|
|
|
|
@@ -276,47 +277,45 @@ function checkIsShowReSend(dom, params) {
|
|
|
* @private
|
|
|
*/
|
|
|
function _addDeNetEditBtn(params = {}) {
|
|
|
- setTimeout(() => {
|
|
|
- let toolElem = document.querySelector('div[data-testid="toolBar"]');
|
|
|
- if (toolElem) {
|
|
|
- Report.reportLog({
|
|
|
- pageSource: Report.pageSource.mainPage,
|
|
|
- businessType: Report.businessType.buttonView,
|
|
|
- objectType: Report.objectType.buttonSecond
|
|
|
- });
|
|
|
- let innerDeIcon = document.getElementById('de-btn1');
|
|
|
- if (!innerDeIcon) {
|
|
|
- toolElem.firstChild.appendChild(createTweetToolbarDenet());
|
|
|
- popupShowGiveawayDialog();
|
|
|
- }
|
|
|
+ let toolElem = document.querySelector('div[data-testid="toolBar"]');
|
|
|
+ if (toolElem) {
|
|
|
+ Report.reportLog({
|
|
|
+ pageSource: Report.pageSource.mainPage,
|
|
|
+ businessType: Report.businessType.buttonView,
|
|
|
+ objectType: Report.objectType.buttonSecond
|
|
|
+ });
|
|
|
+ let innerDeIcon = toolElem.querySelector('#de-btn1');
|
|
|
+ if (!innerDeIcon) {
|
|
|
+ toolElem.firstChild.appendChild(createTweetToolbarDenet());
|
|
|
+ popupShowGiveawayDialog();
|
|
|
+ }
|
|
|
|
|
|
- let innerToolBoxIcon = document.getElementById('de-tool-box-btn-01');
|
|
|
- if (!innerToolBoxIcon) {
|
|
|
- toolElem.firstChild.appendChild(createTweetToolbarToolBox())
|
|
|
- }
|
|
|
- } else {
|
|
|
- setTimeout(() => {
|
|
|
- let toolElem = document.querySelector('div[data-testid="toolBar"]');
|
|
|
- if (toolElem) {
|
|
|
- Report.reportLog({
|
|
|
- pageSource: Report.pageSource.mainPage,
|
|
|
- businessType: Report.businessType.buttonView,
|
|
|
- objectType: Report.objectType.buttonSecond
|
|
|
- });
|
|
|
- let innerDeIcon = document.getElementById('de-btn1');
|
|
|
- if (!innerDeIcon) {
|
|
|
- toolElem.firstChild.appendChild(createTweetToolbarDenet());
|
|
|
- popupShowGiveawayDialog();
|
|
|
- }
|
|
|
+ let innerToolBoxIcon = toolElem.querySelector('#de-tool-box-btn-01');
|
|
|
+ if (!innerToolBoxIcon) {
|
|
|
+ toolElem.firstChild.appendChild(createTweetToolbarToolBox())
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ setTimeout(() => {
|
|
|
+ let toolElem = document.querySelector('div[data-testid="toolBar"]');
|
|
|
+ if (toolElem) {
|
|
|
+ Report.reportLog({
|
|
|
+ pageSource: Report.pageSource.mainPage,
|
|
|
+ businessType: Report.businessType.buttonView,
|
|
|
+ objectType: Report.objectType.buttonSecond
|
|
|
+ });
|
|
|
+ let innerDeIcon = toolElem.querySelector('#de-btn1');
|
|
|
+ if (!innerDeIcon) {
|
|
|
+ toolElem.firstChild.appendChild(createTweetToolbarDenet());
|
|
|
+ popupShowGiveawayDialog();
|
|
|
+ }
|
|
|
|
|
|
- let innerToolBoxIcon = document.getElementById('de-tool-box-btn-01');
|
|
|
- if (!innerToolBoxIcon) {
|
|
|
- toolElem.firstChild.appendChild(createTweetToolbarToolBox())
|
|
|
- }
|
|
|
+ let innerToolBoxIcon = toolElem.querySelector('#de-tool-box-btn-01');
|
|
|
+ if (!innerToolBoxIcon) {
|
|
|
+ toolElem.firstChild.appendChild(createTweetToolbarToolBox())
|
|
|
}
|
|
|
- }, 1000)
|
|
|
- }
|
|
|
- })
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const popupShowGiveawayDialog = async () => {
|
|
@@ -689,8 +688,9 @@ function onWindowResize() {
|
|
|
function checkHasDeBtn() {
|
|
|
try {
|
|
|
let toolBar = document.querySelector('div[data-testid="toolBar"]');
|
|
|
- let innerDeIcon = document.getElementById('de-btn1');
|
|
|
- if (toolBar && !innerDeIcon) {
|
|
|
+ let append = toolBar && !toolBar.querySelector('#de-btn1');
|
|
|
+
|
|
|
+ if (append) {
|
|
|
_addDeNetEditBtn();
|
|
|
}
|
|
|
} catch (e) {
|
|
@@ -713,9 +713,9 @@ export function bindTwitterArtMethod() {
|
|
|
}
|
|
|
}).then((res) => {
|
|
|
if (res.code == 0) {
|
|
|
- Report.reportLog({
|
|
|
- objectType: Report.objectType.tweetPostBinded
|
|
|
- });
|
|
|
+ // Report.reportLog({
|
|
|
+ // objectType: Report.objectType.tweetPostBinded
|
|
|
+ // });
|
|
|
bindTwitterArt.needBind = false;
|
|
|
bindTwitterArt.postId = '';
|
|
|
bindTwitterArt.isBindIng = false;
|
|
@@ -874,6 +874,7 @@ function initParseCard() {
|
|
|
clearInterval(timer)
|
|
|
setInterval(() => {
|
|
|
onChangePageMain(inTwitterNode)
|
|
|
+ checkHasDeBtn()
|
|
|
twitterPinLogin()
|
|
|
showNFTGroupIcon()
|
|
|
if (queue_num <= 0) {
|
|
@@ -881,7 +882,6 @@ function initParseCard() {
|
|
|
}
|
|
|
initGroupTip()
|
|
|
setIframeRedPacket()
|
|
|
- checkHasDeBtn()
|
|
|
checkHasSliderDeBtn();
|
|
|
changeQueueNum(-1)
|
|
|
showNFTCard()
|
|
@@ -1976,7 +1976,7 @@ const hiddenMaskWeb3Tab = (count) => {
|
|
|
* 跳转到个人主页 检查是否需要选中 Group tab
|
|
|
*/
|
|
|
const checkNeedSelectGroupTab = () => {
|
|
|
- if (window.location.pathname != '/home') {
|
|
|
+ if (window.location.pathname != '/home' && !document.hidden) {
|
|
|
setTimeout(() => {
|
|
|
getChromeStorage('groupTabData', (res) => {
|
|
|
console.log('groupTabData', res);
|
|
@@ -2079,10 +2079,12 @@ const addPageScrollEvent = () => {
|
|
|
contentHeight: contentDom.offsetHeight
|
|
|
}
|
|
|
|
|
|
- chrome.runtime.sendMessage({
|
|
|
- actionType: "CONTENT_GROUP_LIST_SCROLL",
|
|
|
- data: data
|
|
|
- }, () => { });
|
|
|
+ messageCenter.send('de-tab-group-content', 'CONTENT_GROUP_LIST_SCROLL', data)
|
|
|
+
|
|
|
+ // chrome.runtime.sendMessage({
|
|
|
+ // actionType: "CONTENT_GROUP_LIST_SCROLL",
|
|
|
+ // data: data
|
|
|
+ // }, () => { });
|
|
|
};
|
|
|
|
|
|
const removeTweetTabEvent = (params) => {
|
|
@@ -2163,10 +2165,11 @@ const setGroupTabSelfStyle = (params = {}) => {
|
|
|
* 切换到 Group tab时 刷新列表
|
|
|
*/
|
|
|
export const refreshTabGroup = () => {
|
|
|
- chrome.runtime.sendMessage({
|
|
|
- actionType: "CONTENT_REFRESH_TAB_GROUP_LIST",
|
|
|
- data: {}
|
|
|
- }, () => { });
|
|
|
+ messageCenter.send('de-tab-group-content', 'CONTENT_REFRESH_TAB_GROUP_LIST', {})
|
|
|
+// chrome.runtime.sendMessage({
|
|
|
+// actionType: "CONTENT_REFRESH_TAB_GROUP_LIST",
|
|
|
+// data: {}
|
|
|
+// }, () => { });
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -2243,7 +2246,7 @@ const addTabGroupContent = (cb) => {
|
|
|
}
|
|
|
let iframe = document.createElement('iframe');
|
|
|
iframe.id = 'de-tab-group-content';
|
|
|
- iframe.src = chrome.runtime.getURL('/iframe/tab-group.html') + `?params=${JSON.stringify(params)}`;
|
|
|
+ iframe.src = `${iframeHost}/tab-group` + `?params=${JSON.stringify(params)}`;
|
|
|
iframe.style.cssText = `border: medium none; height: 500px;display: none`
|
|
|
|
|
|
let iframeContent = getGroupTabContentNode();
|
|
@@ -2344,12 +2347,19 @@ export const pageJumpHandler = (params) => {
|
|
|
export const getTweetProfileNavTop = (params) => {
|
|
|
let top = document.querySelector('div[role="tablist"]').closest('nav').getBoundingClientRect().top;
|
|
|
|
|
|
- chrome.runtime.sendMessage({
|
|
|
- actionType: "CONTENT_SEND_GROUP_NAV_TOP", data: {
|
|
|
+ messageCenter.send({
|
|
|
+ actionType: "CONTENT_SEND_GROUP_NAV_TOP",
|
|
|
+ data: {
|
|
|
top,
|
|
|
scrollTop: params.scrollTop
|
|
|
}
|
|
|
- }, () => { })
|
|
|
+ })
|
|
|
+ // chrome.runtime.sendMessage({
|
|
|
+ // actionType: "CONTENT_SEND_GROUP_NAV_TOP", data: {
|
|
|
+ // top,
|
|
|
+ // scrollTop: params.scrollTop
|
|
|
+ // }
|
|
|
+ // }, () => { })
|
|
|
}
|
|
|
|
|
|
|
|
@@ -2404,13 +2414,19 @@ const getSysTheme = () => {
|
|
|
const sysThemeChange = () => {
|
|
|
setTimeout(() => {
|
|
|
let bgColor = document.querySelector('body').style.backgroundColor;
|
|
|
-
|
|
|
- chrome.runtime.sendMessage({
|
|
|
- actionType: "CONTENT_SYS_THEME_CHANGE", data: {
|
|
|
+ messageCenter.send({
|
|
|
+ actionType: "CONTENT_SYS_THEME_CHANGE",
|
|
|
+ data: {
|
|
|
theme: systemInfo.theme,
|
|
|
twitterTheme: bgColor == 'rgb(0, 0, 0)' ? 'dark' : 'light'
|
|
|
}
|
|
|
- }, () => { })
|
|
|
+ })
|
|
|
+ // chrome.runtime.sendMessage({
|
|
|
+ // actionType: "CONTENT_SYS_THEME_CHANGE", data: {
|
|
|
+ // theme: systemInfo.theme,
|
|
|
+ // twitterTheme: bgColor == 'rgb(0, 0, 0)' ? 'dark' : 'light'
|
|
|
+ // }
|
|
|
+ // }, () => { })
|
|
|
}, 800)
|
|
|
}
|
|
|
|