From 46329ceeaa546eecf88cc7608376dc53520e4838 Mon Sep 17 00:00:00 2001 From: cilame Date: Thu, 13 Oct 2022 00:38:13 +0800 Subject: [PATCH] add --- manifest.json | 2 +- new_tab_overwrite.html | 12 ++++++++++++ options.html | 3 ++- options.js | 14 ++++++++++++++ popup.html | 2 +- tools/astexplorer_babel.js | 6 +----- tools/btn_utils.js | 9 +++++++++ tools/redirect.js | 8 ++++++++ 8 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 new_tab_overwrite.html create mode 100644 tools/redirect.js diff --git a/manifest.json b/manifest.json index f9e2670..6677a0d 100644 --- a/manifest.json +++ b/manifest.json @@ -72,6 +72,6 @@ }, "manifest_version": 2, "chrome_url_overrides": { - "newtab": "astexplorer_babel.html" + "newtab": "new_tab_overwrite.html" } } diff --git a/new_tab_overwrite.html b/new_tab_overwrite.html new file mode 100644 index 0000000..d47f39f --- /dev/null +++ b/new_tab_overwrite.html @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/options.html b/options.html index 365599d..4a62dd9 100644 --- a/options.html +++ b/options.html @@ -159,6 +159,7 @@
+ @@ -188,7 +189,7 @@

- +
jsobfuscator混淆器
diff --git a/options.js b/options.js index 2bf7d09..d8b5c82 100644 --- a/options.js +++ b/options.js @@ -568,6 +568,20 @@ proxy_js.addEventListener("click", function(){ code_model.value = clear_mode(mk_proxy_code) }) +var code_model = document.getElementById('code_model') +code_model.ondragover = function(e) { + e.preventDefault(); +} +code_model.ondrop = function(e) { + e.preventDefault(); + var f = e.dataTransfer.files[0]; + var fr = new FileReader(); + fr.readAsDataURL(f); + fr.onload = function(e) { + code_model.value = this.result; + } +} + var add_script_in_all_document = document.getElementById('add_script_in_all_document'); add_script_in_all_document.addEventListener("click", function(){ debug_tab = true diff --git a/popup.html b/popup.html index 1a58db8..95188a6 100644 --- a/popup.html +++ b/popup.html @@ -124,7 +124,7 @@ -
启用覆盖newTab页
+
配置覆盖newTab页
diff --git a/tools/astexplorer_babel.js b/tools/astexplorer_babel.js index b3e87bb..138edb2 100644 --- a/tools/astexplorer_babel.js +++ b/tools/astexplorer_babel.js @@ -1,9 +1,5 @@ chrome.storage.local.get(["config-hook-new-tab"], function(e) { - if(!e['config-hook-new-tab']) { - chrome.tabs.update({ url: "chrome-search://local-ntp/local-ntp.html" }) - }else{ - runall() - } + runall() }) function runall(){ diff --git a/tools/btn_utils.js b/tools/btn_utils.js index 83d115b..15b7d70 100644 --- a/tools/btn_utils.js +++ b/tools/btn_utils.js @@ -1,4 +1,5 @@ +var open_ast_pagetn = document.getElementById('open_ast_page') var sojsontn = document.getElementById('sojson') var obtn = document.getElementById('ob') var jsfuckbtn = document.getElementById('jsfuck') @@ -9,6 +10,14 @@ var uglify_minibtn = document.getElementById('uglify_mini') var txt = document.getElementById('txt') var txt2 = document.getElementById('txt2') +open_ast_pagetn.addEventListener('click', function(e){ + var temp = chrome.runtime.getURL('astexplorer_babel.html') + console.log(temp) + chrome.tabs.create({ + url: temp + }); +}) + babel_aline.addEventListener('click', function(e){ try{ ;(txt2||txt).value = muti_process_aline(txt.value) diff --git a/tools/redirect.js b/tools/redirect.js new file mode 100644 index 0000000..5eb1ce7 --- /dev/null +++ b/tools/redirect.js @@ -0,0 +1,8 @@ +chrome.storage.local.get(["config-hook-new-tab"], function(e) { + if(!e['config-hook-new-tab']) { + chrome.tabs.update({ url: "chrome-search://local-ntp/local-ntp.html" }) + }else{ + var option_page = chrome.runtime.getURL('options.html') + chrome.tabs.update({ url: option_page }) + } +}) \ No newline at end of file