|
@@ -1370,48 +1370,39 @@ export const setTwitterTextarea = (params) => {
|
|
|
|
|
|
|
|
|
const initGroupTip = () => {
|
|
|
- let arr = window.location.pathname.split('/') || []
|
|
|
- if (arr.length == 2) {
|
|
|
- let twitterAccount = arr[1]
|
|
|
- addGroupTip(twitterAccount)
|
|
|
- }
|
|
|
-}
|
|
|
-export const showGroupTip = () => {
|
|
|
- let dom_denet_group_tip = document.querySelector('#denet_group_tip')
|
|
|
- dom_denet_group_tip.style.display = 'block'
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-const addGroupTip = (twitterAccount) => {
|
|
|
let dom_denet_group_tip = document.querySelector('#denet_group_tip')
|
|
|
if (dom_denet_group_tip) {
|
|
|
return
|
|
|
}
|
|
|
- try {
|
|
|
- let nav_list = document.querySelectorAll('nav[role=navigation]') || []
|
|
|
- let dom
|
|
|
- for (let i in nav_list) {
|
|
|
- if (nav_list[i] && nav_list[i].querySelector('div[data-testid="ScrollSnap-SwipeableList"]')) {
|
|
|
- dom = nav_list[i]
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- let iframe = document.createElement('iframe')
|
|
|
- iframe.id = 'denet_group_tip'
|
|
|
- iframe.style.cssText = 'border: medium none; display:none; width:100%; height:100px;'
|
|
|
+ let arr = window.location.pathname.split('/') || []
|
|
|
+
|
|
|
+ if (arr.length >= 2) {
|
|
|
+ let twitterAccount = arr[1]
|
|
|
+ try {
|
|
|
+ let dom = document.querySelector('div[data-testid="ScrollSnap-SwipeableList"]').closest('nav')
|
|
|
+ let iframe = document.createElement('iframe')
|
|
|
+ iframe.id = 'denet_group_tip'
|
|
|
+ iframe.style.cssText = 'border: medium none; display:none; width:100%; height:100px;'
|
|
|
|
|
|
- iframe.src = chrome.runtime.getURL(`/iframe/group-card.html?twitterAccount=${twitterAccount}`)
|
|
|
+ iframe.src = chrome.runtime.getURL(`/iframe/group-card.html?twitterAccount=${twitterAccount}`)
|
|
|
|
|
|
- if (dom) {
|
|
|
- dom.parentNode.children[0].appendChild(iframe)
|
|
|
- }
|
|
|
+ if (dom && !dom.parentNode.children[0].querySelector('iframe')) {
|
|
|
+ dom.parentNode.children[0].appendChild(iframe)
|
|
|
+ }
|
|
|
|
|
|
- } catch (error) {
|
|
|
+ } catch (error) {
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+export const showGroupTip = () => {
|
|
|
+ let dom_denet_group_tip = document.querySelector('#denet_group_tip')
|
|
|
+ dom_denet_group_tip.style.display = 'block'
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
export const hideBuyNFT = () => {
|
|
|
let iframe = document.querySelector('#nftProjectId')
|
|
|
iframe.style.display = 'none'
|
|
@@ -1973,7 +1964,7 @@ const addTabGroupContent = (cb) => {
|
|
|
*/
|
|
|
export const setTabGroupIframeStyle = (params) => {
|
|
|
let iframeContent = document.getElementById('de-tab-group-content');
|
|
|
- if(iframeContent) {
|
|
|
+ if (iframeContent) {
|
|
|
iframeContent.style.height = document.querySelector('html').offsetHeight + 'px';
|
|
|
}
|
|
|
}
|
|
@@ -2022,7 +2013,7 @@ export const loginSuccessHandle = () => {
|
|
|
export const setGroupInfo = (params = {}) => {
|
|
|
console.log('params', params)
|
|
|
tweetAccountBindGroupInfo.groupInfo = params;
|
|
|
- if(!params.nftGroupId) {
|
|
|
+ if (!params.nftGroupId) {
|
|
|
let groupTab = document.querySelector('#de-nav-tab-group');
|
|
|
if (groupTab) {
|
|
|
groupTab.style.display = 'none';
|