Initial commit (before Mozilla)
This commit is contained in:
@@ -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>
|
||||
@@ -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);
|
||||
Reference in New Issue
Block a user