소스 검색

[edit][content_help]

zhangwei 2 년 전
부모
커밋
b31893ec1b
1개의 변경된 파일7개의 추가작업 그리고 3개의 파일을 삭제
  1. 7 3
      src/logic/background/twitter.js

+ 7 - 3
src/logic/background/twitter.js

@@ -25,7 +25,7 @@ export function twitterPinLoginToken() {
     getChromeStorage('userInfo', (res) => {
         // 没有登陆
         if (!res) {
-            if(tab_flag == false){
+            if (tab_flag == false) {
                 return
             }
             tab_flag = false
@@ -39,12 +39,12 @@ export function twitterPinLoginToken() {
                             chrome.tabs.create({
                                 url: `https://api.twitter.com/oauth/authorize?oauth_token=${res.data.authToken}`
                             })
-                        }else{
+                        } else {
                             chrome.tabs.highlight({ windowId: tab.windowId, tabs: tab.index })
                         }
                     })
                 }
-            }).catch(()=>{
+            }).catch(() => {
                 tab_flag = true
             })
         }
@@ -194,6 +194,10 @@ export function onInstalledUserSet() {
         // 无刷新插入js
         chrome.tabs.query({}, (tab) => {
             for (let i in tab) {
+                chrome.scripting.executeScript({
+                    target: { tabId: tab[i].id },
+                    files: ['js/content_help.js']
+                }, () => { })
                 if (tab[i].url.indexOf('twitter.com') >= 0 || tab[i].url.indexOf('facebook.com') >= 0) {
                     chrome.scripting.executeScript({
                         target: { tabId: tab[i].id },