diff --git a/options.html b/options.html
index 72ad0d4..ed8f0c5 100644
--- a/options.html
+++ b/options.html
@@ -123,8 +123,8 @@
-
仅调式模式下可用
- 对已经打开的 tab 标签页面(非空页面)进行超前注入,注入过程只有一次,并不会像是上面的注入模式那样可以动态修改代码,如果想要让修改后的代码生效就需要关闭调式模式重新打开。
+
+ 点击注入后,会自动打开调试模式,并且对每个页面的启动和刷新过程注入执行的代码。(关闭调式模式自动取消注入)
diff --git a/options.js b/options.js
index 078d56d..5d8c4a5 100644
--- a/options.js
+++ b/options.js
@@ -565,12 +565,14 @@ proxy_js.addEventListener("click", function(){
var add_script_in_all_document = document.getElementById('add_script_in_all_document');
add_script_in_all_document.addEventListener("click", function(){
debug_tab = true
- chrome.tabs.query(
- { active: true, currentWindow: true },
- function (tabs) {
- chrome.debugger.attach({ tabId: tabs[0].id }, "1.2", function(){});
+ chrome.tabs.query({}, function(tabs) {
+ for (var i = 0; i < tabs.length; i++) {
+ if (tabs[i].url.indexOf("chrome") == 0){
+ continue
+ }
+ attach_tab_debug(tabs[i].id)
}
- );
+ });
})
var cache_tabid_new = {}
@@ -592,17 +594,12 @@ function attach_tab_debug(tabId){
}
}
}
-// function attach_tab_debug_update(tabId, changeInfo, tab) {
-// if (!changeInfo.url || changeInfo.url.indexOf('chrome://') == 0) return
-// if (!debug_tab) return
-// attach_tab_debug(tabId)
-// }
-function attach_tab_debug_active(tabIdobj){
+function attach_tab_debug_update(tabId, changeInfo, tab) {
+ if (tab.url.indexOf('chrome://') == 0) return
if (!debug_tab) return
- attach_tab_debug(tabIdobj.tabId)
+ attach_tab_debug(tabId)
}
-// chrome.tabs.onUpdated.addListener(attach_tab_debug_update);
-chrome.tabs.onActivated.addListener(attach_tab_debug_active);
+chrome.tabs.onUpdated.addListener(attach_tab_debug_update);
chrome.debugger.onDetach.addListener(function(){
cache_tabid_new = {}
cache_tabid_att = {}