From 356325d44341abb7790e68ddbb5d52d4f61cecfc Mon Sep 17 00:00:00 2001
From: didierfred <didierfred@gmail.com>
Date: Sat, 3 Feb 2018 16:52:08 +0100
Subject: [PATCH] create a menu

---
 manifest.json   |  2 +-
 popup/menu.html | 20 ++++++++++++++++++++
 popup/menu.js   | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 popup/menu.html
 create mode 100644 popup/menu.js

diff --git a/manifest.json b/manifest.json
index 7422ba4..c4ffae3 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 0000000..e89ad4a
--- /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 0000000..dcb4a17
--- /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);
+	}
-- 
GitLab