mirror of
https://git.mirrors.martin98.com/https://github.com/cilame/v_jstools
synced 2025-08-14 19:56:01 +08:00
add
This commit is contained in:
parent
a194f7df65
commit
6ee357aadd
28
inject.js
28
inject.js
@ -1155,13 +1155,6 @@ function injectfunc(e, window) {
|
|||||||
if (e["config-hook-domobj"]){
|
if (e["config-hook-domobj"]){
|
||||||
$domobj_placeholder
|
$domobj_placeholder
|
||||||
}
|
}
|
||||||
!function(){
|
|
||||||
try{
|
|
||||||
$myinject
|
|
||||||
}catch(e){
|
|
||||||
v_log('inject error.')
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1320,18 +1313,25 @@ function check_format(str){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function inject_code(){
|
||||||
|
try{
|
||||||
|
$myinject
|
||||||
|
}catch(e){
|
||||||
|
v_log('inject error.')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
chrome.storage.local.get(hookers, function (result) {
|
chrome.storage.local.get(hookers, function (result) {
|
||||||
if (result["config-hook-global"]){
|
if (result["config-hook-global"]){
|
||||||
var myinject = result["config-myinject"]
|
|
||||||
if (result["config-myinject_toggle"]){
|
|
||||||
var myinject = check_format(myinject) ? myinject : 'v_log("format error.")'
|
|
||||||
}else{
|
|
||||||
var myinject = 'undefined'
|
|
||||||
}
|
|
||||||
var replacer_injectfunc = (injectfunc + '').replace('$domobj_placeholder', make_domhooker_funcs())
|
var replacer_injectfunc = (injectfunc + '').replace('$domobj_placeholder', make_domhooker_funcs())
|
||||||
var replacer_injectfunc = replacer_injectfunc.replace('$make_v_func', make_v+';')
|
var replacer_injectfunc = replacer_injectfunc.replace('$make_v_func', make_v+';')
|
||||||
var replacer_injectfunc = replacer_injectfunc.replace('$myinject', myinject+';')
|
|
||||||
inject_script(`(${replacer_injectfunc})(${JSON.stringify(result)},window)`);
|
inject_script(`(${replacer_injectfunc})(${JSON.stringify(result)},window)`);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (result["config-myinject_toggle"]){
|
||||||
|
var myinject = result["config-myinject"]
|
||||||
|
var myinject = check_format(myinject) ? myinject : 'console.log("format error.")'
|
||||||
|
inject_script(`(${(inject_code+'').replace('$myinject', myinject)})()`);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user