From b5c10718ddeaa8fcac368515ca150705b1a2c5ab Mon Sep 17 00:00:00 2001 From: Mark Powers Date: Thu, 29 Dec 2022 14:03:57 -0600 Subject: Refactor scripts, add table preview --- options/index.html | 39 +++++++++++++++++++++++++++++++++++++++ options/index.js | 23 +++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 options/index.html create mode 100644 options/index.js (limited to 'options') diff --git a/options/index.html b/options/index.html new file mode 100644 index 0000000..9817b71 --- /dev/null +++ b/options/index.html @@ -0,0 +1,39 @@ + + + + + + Options + + + +
+ + + + + + + + + + + + + + + + +
+ +
+ +
+
+ + + + diff --git a/options/index.js b/options/index.js new file mode 100644 index 0000000..3d85dbe --- /dev/null +++ b/options/index.js @@ -0,0 +1,23 @@ +function saveOptions(e) { + e.preventDefault(); + browser.storage.sync.set({ + rb: document.querySelector("#rb").value, + reader: document.querySelector("#reader").value, + instance: document.querySelector("#instance").value + }); +} +function restoreOptions() { + function setCurrentChoice(result) { + document.querySelector("#rb").value = result.rb || ""; + document.querySelector("#reader").value = result.reader|| ""; + document.querySelector("#instance").value = result.instance || ""; + } + function onError(error) { + console.log(`Error: ${error}`); + } + let getting = browser.storage.sync.get(["rb", "instance", "reader"]); + getting.then(setCurrentChoice, onError); +} +document.addEventListener("DOMContentLoaded", restoreOptions); +document.querySelector("form").addEventListener("submit", saveOptions); + -- cgit v1.2.3