Light Modus hinzugefügt
parent
d0a14f0ee5
commit
ac139f6bca
@ -0,0 +1,23 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<form>
|
||||
<h2>Ressourcen</h2>
|
||||
<label>
|
||||
<input type="checkbox" id="light">
|
||||
<b>Light Modus</b><br>
|
||||
Verringert die Prozessorlast durch abschalten der interaktiven Elemente
|
||||
</label>
|
||||
<br>
|
||||
<br>
|
||||
<button type="submit">Speichen</button>
|
||||
</form>
|
||||
|
||||
<script src="settings.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
@ -0,0 +1,23 @@
|
||||
function saveOptions(e) {
|
||||
e.preventDefault();
|
||||
browser.storage.local.set({
|
||||
light: document.querySelector("#light").checked
|
||||
});
|
||||
}
|
||||
|
||||
function restoreOptions() {
|
||||
|
||||
function setCurrentChoice(result) {
|
||||
document.querySelector("#light").checked = result.light || false;
|
||||
}
|
||||
|
||||
function onError(error) {
|
||||
console.log(`Error: ${error}`);
|
||||
}
|
||||
|
||||
var getting = browser.storage.local.get("light");
|
||||
getting.then(setCurrentChoice, onError);
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", restoreOptions);
|
||||
document.querySelector("form").addEventListener("submit", saveOptions);
|
Loading…
Reference in New Issue