diff --git a/background.js b/background.js index b42d576..963b709 100644 --- a/background.js +++ b/background.js @@ -313,4 +313,13 @@ function get_html(url){ head.append(insert_script) } return $.html() -} \ No newline at end of file +} + +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: ''}); + } +}) \ No newline at end of file diff --git a/options.js b/options.js index 5d8c4a5..2bf7d09 100644 --- a/options.js +++ b/options.js @@ -444,6 +444,12 @@ 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 }) diff --git a/popup.html b/popup.html index 1c82e10..1a58db8 100644 --- a/popup.html +++ b/popup.html @@ -124,7 +124,7 @@ -