Initial commit (before Mozilla)

This commit is contained in:
flatgreen
2019-08-15 19:54:16 +02:00
commit 8b5936d465
9 changed files with 233 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<div class="browser-style">
<h2>Autostart</h2>
<input type="checkbox" id="autostart" checked name="autostart">
<label for="autostart">pass directly from JD2 Linkgrabbler to download list</label>
</div>
<script src="options.js"></script>
</body>
</html>
+29
View File
@@ -0,0 +1,29 @@
function onError(error) {
console.log('UrlToJD2_options_error: ' + error);
}
// autostart
var chck_autostart = document.getElementById("autostart");
chck_autostart.onchange = function () {
if (chck_autostart.checked) {
browser.storage.local.set({ autostart: true });
} else {
browser.storage.local.set({ autostart: false });
}
}
// Update the options UI or default setting
function updateUI(restoredSettings) {
if (restoredSettings.autostart == undefined) {
chck_autostart.checked = true; //default
} else {
chck_autostart.checked = restoredSettings.autostart;
}
}
// On opening the options page
const gettingStoredSettings = browser.storage.local.get();
gettingStoredSettings.then(updateUI, onError);