mirror of
https://git.mirrors.martin98.com/https://github.com/cilame/v_jstools
synced 2025-07-05 16:05:12 +08:00
add
This commit is contained in:
parent
229b91b703
commit
1e138bd1e4
@ -123,8 +123,8 @@
|
|||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
<button id='add_script_in_all_document'>超前注入</button>
|
<button id='add_script_in_all_document'>超前注入</button>
|
||||||
<div>仅调式模式下可用</div>
|
<HR>
|
||||||
<div>对已经打开的 tab 标签页面(非空页面)进行超前注入,注入过程只有一次,并不会像是上面的注入模式那样可以动态修改代码,如果想要让修改后的代码生效就需要关闭调式模式重新打开。</div>
|
<div>点击注入后,会自动打开调试模式,并且对每个页面的启动和刷新过程注入执行的代码。(关闭调式模式自动取消注入)</div>
|
||||||
<HR>
|
<HR>
|
||||||
<textarea id='myinject_2' data-key="config-myinject_2" style="width: 100%; height: 500px"></textarea>
|
<textarea id='myinject_2' data-key="config-myinject_2" style="width: 100%; height: 500px"></textarea>
|
||||||
<br/>
|
<br/>
|
||||||
|
25
options.js
25
options.js
@ -565,12 +565,14 @@ proxy_js.addEventListener("click", function(){
|
|||||||
var add_script_in_all_document = document.getElementById('add_script_in_all_document');
|
var add_script_in_all_document = document.getElementById('add_script_in_all_document');
|
||||||
add_script_in_all_document.addEventListener("click", function(){
|
add_script_in_all_document.addEventListener("click", function(){
|
||||||
debug_tab = true
|
debug_tab = true
|
||||||
chrome.tabs.query(
|
chrome.tabs.query({}, function(tabs) {
|
||||||
{ active: true, currentWindow: true },
|
for (var i = 0; i < tabs.length; i++) {
|
||||||
function (tabs) {
|
if (tabs[i].url.indexOf("chrome") == 0){
|
||||||
chrome.debugger.attach({ tabId: tabs[0].id }, "1.2", function(){});
|
continue
|
||||||
|
}
|
||||||
|
attach_tab_debug(tabs[i].id)
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
var cache_tabid_new = {}
|
var cache_tabid_new = {}
|
||||||
@ -592,17 +594,12 @@ function attach_tab_debug(tabId){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// function attach_tab_debug_update(tabId, changeInfo, tab) {
|
function attach_tab_debug_update(tabId, changeInfo, tab) {
|
||||||
// if (!changeInfo.url || changeInfo.url.indexOf('chrome://') == 0) return
|
if (tab.url.indexOf('chrome://') == 0) return
|
||||||
// if (!debug_tab) return
|
|
||||||
// attach_tab_debug(tabId)
|
|
||||||
// }
|
|
||||||
function attach_tab_debug_active(tabIdobj){
|
|
||||||
if (!debug_tab) return
|
if (!debug_tab) return
|
||||||
attach_tab_debug(tabIdobj.tabId)
|
attach_tab_debug(tabId)
|
||||||
}
|
}
|
||||||
// chrome.tabs.onUpdated.addListener(attach_tab_debug_update);
|
chrome.tabs.onUpdated.addListener(attach_tab_debug_update);
|
||||||
chrome.tabs.onActivated.addListener(attach_tab_debug_active);
|
|
||||||
chrome.debugger.onDetach.addListener(function(){
|
chrome.debugger.onDetach.addListener(function(){
|
||||||
cache_tabid_new = {}
|
cache_tabid_new = {}
|
||||||
cache_tabid_att = {}
|
cache_tabid_att = {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user