diff --git a/manifest.json b/manifest.json index 7422ba46c9d656e7c7b07f73b359fe0ed6ba58ef..c4ffae3f72ac63aef4c0413e2ea4bbbdf36c1906 100644 --- a/manifest.json +++ b/manifest.json @@ -20,7 +20,7 @@ "browser_action": { "default_icon": "icons/modify-32.png", "default_title": "Simple Modify Headers", - "default_popup": "popup/config.html" + "default_popup": "popup/menu.html" } } diff --git a/popup/menu.html b/popup/menu.html new file mode 100644 index 0000000000000000000000000000000000000000..e89ad4ae9bbd8dd6523eb7feca09e72e2952bdcc --- /dev/null +++ b/popup/menu.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> + +<html> + <head> + <meta charset="utf-8"> + + </head> + +<body> + + +<input type="button" id="start_stop" value="Start" ></input> +<input type="button" id="config" value="Configure"></input> + +</center> + <script type="text/javascript" src="menu.js"> </script> + +</body> + +</html> diff --git a/popup/menu.js b/popup/menu.js new file mode 100644 index 0000000000000000000000000000000000000000..dcb4a1710a4016fe56222c38003725a8ff4e309e --- /dev/null +++ b/popup/menu.js @@ -0,0 +1,46 @@ + + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * @author didierfred@gmail.com + * @version 0.1 + */ + + +var started = "off"; + +window.onload = function() { + document.getElementById('config').addEventListener('click',function (e) {start_config();}); + document.getElementById('start_stop').addEventListener('click',function (e) {start_modify();}); + started = localStorage.getItem("started"); + if (started=="on") document.getElementById("start_stop").value = "Stop"; +} ; + + + +function start_modify() + { + if (started=="off") + { + localStorage.setItem("started","on"); + browser.runtime.sendMessage("on"); + started = "on"; + document.getElementById("start_stop").value = "Stop"; + } + else + { + localStorage.setItem("started","off"); + browser.runtime.sendMessage("off"); + started = "off"; + document.getElementById("start_stop").value = "Start"; + } + + } + +function start_config() + { + var strWindowFeatures = "menubar=no,location=no,resizable=yes,scrollbars=yes,status=no,width=800,height=600"; + window.open("config.html","Simple Modify Headers",strWindowFeatures); + }