mirror of
https://git.mirrors.martin98.com/https://github.com/cilame/v_jstools
synced 2025-07-06 01:55:14 +08:00
add
This commit is contained in:
parent
73b85cf3de
commit
29c464bfe0
@ -1,2 +1 @@
|
|||||||
// background.js
|
// background.js
|
||||||
|
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
"name": "v_jstools",
|
"name": "v_jstools",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"description": "v_jstools js hook工具",
|
"description": "v_jstools js hook工具",
|
||||||
"permissions": ["storage", "activeTab", "tabs", "debugger", "storage"],
|
"permissions": ["storage", "activeTab", "tabs", "debugger", "storage", "extension", "scripting"],
|
||||||
"browser_action": {
|
"browser_action": {
|
||||||
"default_popup": "popup.html"
|
"default_popup": "popup.html"
|
||||||
},
|
},
|
||||||
"background": {
|
"background": {
|
||||||
"scripts": ["background.js"],
|
"scripts": ["background.js"],
|
||||||
"persistent": false
|
"persistent": true
|
||||||
},
|
},
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
{
|
{
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
<body style="width: 600px;">
|
<body style="width: 600px;">
|
||||||
<label ><input type="checkbox" data-key="config-hook-test">test</label>
|
<label ><input type="checkbox" data-key="config-hook-test">test</label>
|
||||||
<br/>
|
<br/>
|
||||||
|
<label ><input type="checkbox" data-key="config-hook-console">hook-console</label>
|
||||||
|
<br/>
|
||||||
<label ><input type="checkbox" data-key="config-hook-Function">hook-Function</label>
|
<label ><input type="checkbox" data-key="config-hook-Function">hook-Function</label>
|
||||||
<br/>
|
<br/>
|
||||||
<label ><input type="checkbox" data-key="config-hook-eval">hook-eval</label>
|
<label ><input type="checkbox" data-key="config-hook-eval">hook-eval</label>
|
||||||
@ -37,8 +39,8 @@
|
|||||||
<br/>
|
<br/>
|
||||||
<label ><input type="checkbox" data-key="config-hook-unescape">hook-unescape</label>
|
<label ><input type="checkbox" data-key="config-hook-unescape">hook-unescape</label>
|
||||||
<br/>
|
<br/>
|
||||||
|
<label ><input type="checkbox" data-key="config-hook-domobj">hook-domobj</label>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
12
popup.js
12
popup.js
@ -1,8 +1,20 @@
|
|||||||
|
// var background = chrome.extension.getBackgroundPage();
|
||||||
|
// var gettabid = background.gettabid
|
||||||
|
|
||||||
|
function sendMessageToContentScript(message, callback){
|
||||||
|
chrome.tabs.query({active: true, currentWindow: true}, function(tabs){
|
||||||
|
chrome.tabs.sendMessage(tabs[0].id, message, function(response){
|
||||||
|
if(callback) callback(response);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
document.querySelectorAll("input").forEach(function(v){
|
document.querySelectorAll("input").forEach(function(v){
|
||||||
chrome.storage.sync.get([v.dataset.key], function (result) {
|
chrome.storage.sync.get([v.dataset.key], function (result) {
|
||||||
v.checked = result[v.dataset.key];
|
v.checked = result[v.dataset.key];
|
||||||
})
|
})
|
||||||
v.addEventListener("change", function (e) {
|
v.addEventListener("change", function (e) {
|
||||||
|
sendMessageToContentScript({[e.target.dataset.key]: e.target.checked})
|
||||||
chrome.storage.sync.set({
|
chrome.storage.sync.set({
|
||||||
[e.target.dataset.key]: e.target.checked
|
[e.target.dataset.key]: e.target.checked
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user