mirror of
https://git.mirrors.martin98.com/https://github.com/cilame/v_jstools
synced 2025-08-14 01:45:57 +08:00
add
This commit is contained in:
parent
3b17e19251
commit
a5247c571d
@ -369,14 +369,23 @@ function getLocalFileUrl(url) {
|
||||
return ("data:" + (typeMap[type] || typeMap.txt) + ";charset=utf-8;base64," + base64);
|
||||
}
|
||||
|
||||
chrome.storage.local.get(['config-hook-global'], function(e){
|
||||
chrome.browserAction.setBadgeBackgroundColor({color: '#BC1717'});
|
||||
if (e['config-hook-global']){
|
||||
chrome.browserAction.setBadgeText({text: 'v'});
|
||||
}else{
|
||||
chrome.browserAction.setBadgeText({text: ''});
|
||||
}
|
||||
})
|
||||
function sub_logger(){
|
||||
chrome.storage.local.get([
|
||||
'config-hook-global',
|
||||
'config-myinject_toggle',
|
||||
], function(e){
|
||||
chrome.browserAction.setBadgeBackgroundColor({color: '#BC1717'});
|
||||
var info = ''
|
||||
if (e['config-hook-global']){
|
||||
info += 'v'
|
||||
}
|
||||
if (e['config-myinject_toggle']){
|
||||
info += 'i'
|
||||
}
|
||||
chrome.browserAction.setBadgeText({text: info});
|
||||
})
|
||||
}
|
||||
sub_logger()
|
||||
|
||||
chrome.webRequest.onBeforeRequest.addListener(function (details) {
|
||||
var url = details.url;
|
||||
|
23
options.js
23
options.js
@ -433,6 +433,23 @@ _mk_html(funcs_0, 'funcs_0', 0)
|
||||
_mk_html(getsets_1, 'getsets_1', 1)
|
||||
_mk_html(funcs_1, 'funcs_1', 1)
|
||||
|
||||
function sub_logger(){
|
||||
chrome.storage.local.get([
|
||||
'config-hook-global',
|
||||
'config-myinject_toggle',
|
||||
], function(e){
|
||||
chrome.browserAction.setBadgeBackgroundColor({color: '#BC1717'});
|
||||
var info = ''
|
||||
if (e['config-hook-global']){
|
||||
info += 'v'
|
||||
}
|
||||
if (e['config-myinject_toggle']){
|
||||
info += 'i'
|
||||
}
|
||||
chrome.browserAction.setBadgeText({text: info});
|
||||
})
|
||||
}
|
||||
|
||||
document.querySelectorAll("input").forEach(function(v){
|
||||
chrome.storage.local.get([v.dataset.key], function (result) {
|
||||
if (v.type == 'checkbox'){
|
||||
@ -445,14 +462,10 @@ document.querySelectorAll("input").forEach(function(v){
|
||||
v.addEventListener("change", function (e) {
|
||||
if (v.type == 'checkbox'){
|
||||
// console.log(e.target.dataset.key, e.target.checked)
|
||||
if (e.target.dataset.key == 'config-hook-global' && e.target.checked){
|
||||
chrome.browserAction.setBadgeText({text: 'v'});
|
||||
}else{
|
||||
chrome.browserAction.setBadgeText({text: ''});
|
||||
}
|
||||
chrome.storage.local.set({
|
||||
[e.target.dataset.key]: e.target.checked
|
||||
})
|
||||
sub_logger()
|
||||
}
|
||||
if (v.type == 'text' || v.type == 'password'){
|
||||
chrome.storage.local.set({
|
||||
|
25
popup.js
25
popup.js
@ -1,3 +1,20 @@
|
||||
function sub_logger(){
|
||||
chrome.storage.local.get([
|
||||
'config-hook-global',
|
||||
'config-myinject_toggle',
|
||||
], function(e){
|
||||
chrome.browserAction.setBadgeBackgroundColor({color: '#BC1717'});
|
||||
var info = ''
|
||||
if (e['config-hook-global']){
|
||||
info += 'v'
|
||||
}
|
||||
if (e['config-myinject_toggle']){
|
||||
info += 'i'
|
||||
}
|
||||
chrome.browserAction.setBadgeText({text: info});
|
||||
})
|
||||
}
|
||||
|
||||
document.querySelectorAll("input").forEach(function(v){
|
||||
chrome.storage.local.get([v.dataset.key], function (result) {
|
||||
if (v.type == 'checkbox'){
|
||||
@ -10,13 +27,6 @@ document.querySelectorAll("input").forEach(function(v){
|
||||
v.addEventListener("change", function (e) {
|
||||
if (v.type == 'checkbox'){
|
||||
// console.log(e.target.dataset.key, e.target.checked)
|
||||
if (e.target.dataset.key == 'config-hook-global'){
|
||||
if (e.target.checked){
|
||||
chrome.browserAction.setBadgeText({text: 'v'});
|
||||
}else{
|
||||
chrome.browserAction.setBadgeText({text: ''});
|
||||
}
|
||||
}
|
||||
if (e.target.dataset.key == 'config-hook-log-toggle'){
|
||||
chrome.tabs.query({active: true, currentWindow: true}, function(tabs){
|
||||
chrome.tabs.sendMessage(tabs[0].id, {action: {type:'logtoggle', info: 'logtoggle'}}, function(response) {});
|
||||
@ -25,6 +35,7 @@ document.querySelectorAll("input").forEach(function(v){
|
||||
chrome.storage.local.set({
|
||||
[e.target.dataset.key]: e.target.checked
|
||||
})
|
||||
sub_logger()
|
||||
}
|
||||
if (v.type == 'text'){
|
||||
chrome.storage.local.set({
|
||||
|
Loading…
x
Reference in New Issue
Block a user