|
@@ -4,6 +4,7 @@ import { discordAuthRedirectUri } from '@/http/configAPI'
|
|
|
import { reportSrcPublishEvent } from '@/http/publishApi'
|
|
|
import Report from "@/log-center/log"
|
|
|
import { fetchAddFinishEvent } from '@/logic/background/fetch/facebook';
|
|
|
+import { showNFTGroupIcon, hideNFTGroupList, checkUserJoinGroup } from '@/logic/content/nft';
|
|
|
|
|
|
let dom = {};
|
|
|
|
|
@@ -313,7 +314,7 @@ function _addDeNetBtn() {
|
|
|
let innerDeIcon = document.getElementById('de-btn1');
|
|
|
if (!innerDeIcon) {
|
|
|
let dialogScheduleBtn = _getScheduleDom(false);
|
|
|
- _addDeNetEditBtn(dialogScheduleBtn, dom.deBtn1);
|
|
|
+ dom && dom.deBtn1 && _addDeNetEditBtn(dialogScheduleBtn, dom.deBtn1);
|
|
|
}
|
|
|
}, 800)
|
|
|
}
|
|
@@ -416,7 +417,7 @@ function _deNetBtnClick() {
|
|
|
if (loadIcon) {
|
|
|
return;
|
|
|
}
|
|
|
- dom.deBtn.insertBefore(dom.loadingImg, dom.deBtn.querySelector('span'));
|
|
|
+ dom && dom.deBtn && dom.deBtn.insertBefore(dom.loadingImg, dom.deBtn.querySelector('span'));
|
|
|
setTimeout(() => {
|
|
|
dom.loadingImg.style.transform = 'rotate(1080deg)'
|
|
|
});
|
|
@@ -436,7 +437,7 @@ function _deNetBtnClick() {
|
|
|
* @private
|
|
|
*/
|
|
|
let isSetContent = false;
|
|
|
-const _setPublishContent = throttle(function (content, time = 1000) {
|
|
|
+export const _setPublishContent = throttle(function (content, time = 1000) {
|
|
|
if (!isSetContent) {
|
|
|
isSetContent = true;
|
|
|
let inputEle = document.querySelector('div[contenteditable="true"]');
|
|
@@ -541,7 +542,7 @@ function addSliderNavDeBtn(isSmall = false) {
|
|
|
let bigDom = document.querySelector('a[href="/compose/tweet"]').parentNode.parentNode;
|
|
|
let deBtn = document.getElementById('de-btn');
|
|
|
if (bigDom && !deBtn) {
|
|
|
- bigDom.appendChild(dom.deBtn);
|
|
|
+ dom && dom.deBtn && bigDom.appendChild(dom.deBtn);
|
|
|
Report.reportLog({
|
|
|
pageSource: Report.pageSource.mainPage,
|
|
|
businessType: Report.businessType.buttonView,
|
|
@@ -552,7 +553,7 @@ function addSliderNavDeBtn(isSmall = false) {
|
|
|
let smallDom = document.querySelector('a[href="/compose/tweet"]').parentNode.parentNode;
|
|
|
let deBtn3 = document.getElementById('de-btn3');
|
|
|
if (smallDom && !deBtn3) {
|
|
|
- smallDom.appendChild(dom.deBtn3);
|
|
|
+ dom && dom.deBtn3 && smallDom.appendChild(dom.deBtn3);
|
|
|
Report.reportLog({
|
|
|
pageSource: Report.pageSource.mainPage,
|
|
|
businessType: Report.businessType.buttonView,
|
|
@@ -604,7 +605,7 @@ function checkHasDeBtn() {
|
|
|
let innerDeIcon = document.getElementById('de-btn1');
|
|
|
if (toolBar && !innerDeIcon) {
|
|
|
let dialogScheduleBtn = _getScheduleDom(false);
|
|
|
- _addDeNetEditBtn(dialogScheduleBtn, dom.deBtn1);
|
|
|
+ dom && dom.deBtn1 && _addDeNetEditBtn(dialogScheduleBtn, dom.deBtn1);
|
|
|
}
|
|
|
} catch (e) {
|
|
|
console.log(e)
|
|
@@ -760,6 +761,7 @@ function initParseCard() {
|
|
|
if (queue_num <= 0) {
|
|
|
return
|
|
|
}
|
|
|
+ showNFTGroupIcon()
|
|
|
setIframeRedPacket()
|
|
|
checkHasDeBtn()
|
|
|
checkHasSliderDeBtn();
|
|
@@ -810,9 +812,11 @@ export function init() {
|
|
|
// 渲染dom
|
|
|
initParseCard()
|
|
|
showNFTCard()
|
|
|
+ showNFTGroupIcon()
|
|
|
+ addEventAction();
|
|
|
+ checkUserJoinGroup();
|
|
|
renderDom();
|
|
|
checkTwitterTaskState();
|
|
|
-
|
|
|
initBuyNFT();
|
|
|
addGroupTab();
|
|
|
|
|
@@ -1301,6 +1305,27 @@ export const showNFTSale = () => {
|
|
|
document.querySelector('div[id="de-nft-node"]').style.display = 'block';
|
|
|
}
|
|
|
|
|
|
+export const addEventAction = () => {
|
|
|
+ let urlInfo = new URL(window.location.href)
|
|
|
+ let isTwitter = urlInfo.hostname === 'twitter.com'
|
|
|
+ // 监听发推按钮
|
|
|
+ let btn = document.querySelector('a[data-testid="SideNav_NewTweet_Button"]');
|
|
|
+ btn && btn.addEventListener('click', () => {
|
|
|
+ // 重置监听次数
|
|
|
+ queue_num = 3;
|
|
|
+ })
|
|
|
+
|
|
|
+ // 页面滚动
|
|
|
+ if (isTwitter) {
|
|
|
+ // 首页
|
|
|
+ if (urlInfo.pathname === '/home') {
|
|
|
+ window.addEventListener('scroll', () => {
|
|
|
+ hideNFTGroupList()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
export const appendPopupPage = (params = {}) => {
|
|
|
let { path = '' } = params;
|
|
|
|
|
@@ -1468,6 +1493,11 @@ export const setPopupConfByPopupPage = () => {
|
|
|
}
|
|
|
|
|
|
|
|
|
+/**
|
|
|
+ *
|
|
|
+ * Group Tab List start
|
|
|
+ */
|
|
|
+
|
|
|
const addGroupTab = () => {
|
|
|
let tabListDom = document.querySelector('div[role="tablist"]');
|
|
|
let groupItemTab = document.querySelector('#de-nav-tab-group');
|
|
@@ -1712,4 +1742,18 @@ export const setTabGroupIframeStyle = (params) => {
|
|
|
// iframeContent.style.height = height + 'px';
|
|
|
iframeContent.style.height = document.querySelector('html').offsetHeight + 'px';
|
|
|
// }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ *
|
|
|
+ * Group Tab List end
|
|
|
+ *
|
|
|
+ */
|
|
|
+
|
|
|
+export const loginSuccessHandle = () => {
|
|
|
+ // 检查是否漏出group图标
|
|
|
+ checkUserJoinGroup(() => {
|
|
|
+ showNFTGroupIcon()
|
|
|
+ addEventAction()
|
|
|
+ })
|
|
|
}
|