Browse Source

[fix] bug

wenliming 2 years ago
parent
commit
850d35d5d5
1 changed files with 7 additions and 4 deletions
  1. 7 4
      src/logic/content/twitter.js

+ 7 - 4
src/logic/content/twitter.js

@@ -176,7 +176,10 @@ function _addDeNetEditBtn(parent, dom, isClick = false) {
                         businessType: Report.businessType.buttonView,
                         businessType: Report.businessType.buttonView,
                         objectType: Report.objectType.buttonSecond
                         objectType: Report.objectType.buttonSecond
                     });
                     });
-                    parent.parentNode.insertBefore(dom, parent.nextElementSibling);
+                    let innerDeIcon = document.getElementById('de-btn1');
+                    if (!innerDeIcon) {
+                        parent.parentNode.insertBefore(dom, parent.nextElementSibling);
+                    }
                 }
                 }
             }, 1000)
             }, 1000)
         }
         }
@@ -286,7 +289,7 @@ function _deNetBtnClick() {
             setTimeout(() => {
             setTimeout(() => {
                 dom.loadingImg.style.transform = 'rotate(0deg)'
                 dom.loadingImg.style.transform = 'rotate(0deg)'
                 dom.deBtn.innerHTML = '<span>DeNet<span>';
                 dom.deBtn.innerHTML = '<span>DeNet<span>';
-            }, 3000)
+            }, 2000)
 
 
             chrome.runtime.sendMessage({ actionType: "CONTENT_TWITTER_LOGIN", data: '1' }, (res) => { console.log(res) })
             chrome.runtime.sendMessage({ actionType: "CONTENT_TWITTER_LOGIN", data: '1' }, (res) => { console.log(res) })
         }
         }
@@ -299,7 +302,7 @@ function _deNetBtnClick() {
  * @private
  * @private
  */
  */
 let isSetContent = false;
 let isSetContent = false;
-function _setPublishContent(content) {
+const _setPublishContent = throttle(function (content) {
     if (!isSetContent) {
     if (!isSetContent) {
         isSetContent = true;
         isSetContent = true;
         setTimeout(() => {
         setTimeout(() => {
@@ -309,7 +312,7 @@ function _setPublishContent(content) {
             }, 2000)
             }, 2000)
         }, 1000);
         }, 1000);
     }
     }
-}
+}, 800);
 
 
 /**
 /**
  * 创建deNet按钮 添加到页面
  * 创建deNet按钮 添加到页面