diff --git a/popup.html b/popup.html new file mode 100644 index 0000000..cbda210 --- /dev/null +++ b/popup.html @@ -0,0 +1,45 @@ + + + + ClearURLs Add-on + + + + +
Enable
+
Disable

+ + + \ No newline at end of file diff --git a/popup.js b/popup.js new file mode 100644 index 0000000..928f106 --- /dev/null +++ b/popup.js @@ -0,0 +1,46 @@ +chrome.management.onEnabled.addListener(function(e){ + var disableButton = document.getElementById("disable"); + var enableButton = document.getElementById("enable"); + chrome.browserAction.setIcon ({path: "icon_19.png"}); + enableButton.style.display = "none"; + disableButton.style.display = "block"; +}); +chrome.management.onDisabled.addListener(function(e){ + var disableButton = document.getElementById("disable"); + var enableButton = document.getElementById("enable"); + chrome.browserAction.setIcon ({path: "icon_19g.png"}); + disableButton.style.display = "none"; + enableButton.style.display = "block"; +}) + +function toggle() { + var disableButton = document.getElementById("disable"); + var enableButton = document.getElementById("enable"); + disableButton.addEventListener("click", disable, false); + enableButton.addEventListener("click", enable, false); + var id = "gmcgchmkljbejmhenadknkdjgjlcinld" + chrome.management.get(id, function(ex) { + if(ex.enabled) + { + chrome.browserAction.setIcon ({path: "icon_19.png"}); + enableButton.style.display = "none"; + disableButton.style.display = "block"; + } + if(!ex.enabled) + { + chrome.browserAction.setIcon ({path: "icon_19g.png"}); + disableButton.style.display = "none"; + enableButton.style.display = "block"; + } + }); +} + +function enable() { + chrome.management.setEnabled("gmcgchmkljbejmhenadknkdjgjlcinld", true); + window.close(); +} +function disable() { + chrome.management.setEnabled("gmcgchmkljbejmhenadknkdjgjlcinld", false); + window.close(); +} +document.addEventListener("DOMContentLoaded", toggle, false); \ No newline at end of file