global enable switch
This commit is contained in:
parent
2eb9e93d2e
commit
fcaa36c0fb
@ -35,11 +35,13 @@ function processMutations(mutationList, observer) {
|
||||
let clickThroughForms;
|
||||
let observer = new MutationObserver(processMutations);
|
||||
const addObserver = () => {
|
||||
browser.storage.sync.get('autocontinue').then(v => {
|
||||
browser.storage.sync.get(['autocontinue', 'enable']).then(v => {
|
||||
clickThroughForms = !!v.autocontinue;
|
||||
observer.observe(document.body, {
|
||||
childList: true, subtree: true
|
||||
})
|
||||
if (!!v.enable) {
|
||||
observer.observe(document.body, {
|
||||
childList: true, subtree: true
|
||||
})
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
|
@ -9,6 +9,10 @@
|
||||
|
||||
<body>
|
||||
<form>
|
||||
<label class="item">
|
||||
<span class="fh">Enable autofill</span>
|
||||
<input name="enable" id="enable" type="checkbox" />
|
||||
</label>
|
||||
<label class="item">
|
||||
<span class="fh">Your BahnCard 100 number</span><br />
|
||||
<span class="sh">The number on the front of your card starting with <span class="ms">7081</span>.</span><br>
|
||||
|
@ -47,6 +47,7 @@ async function saveOptions(ev) {
|
||||
return;
|
||||
}
|
||||
let autoContinue = this.querySelector('#autocontinue').checked;
|
||||
let enable = this.querySelector('#enable').checked;
|
||||
let options = {
|
||||
bcnum: bcNum,
|
||||
bday: bDay,
|
||||
@ -68,6 +69,7 @@ async function restoreOptions() {
|
||||
|
||||
let settings = await browser.storage.sync.get();
|
||||
console.log("restoring", settings);
|
||||
document.querySelector('#enable').checked = settings.enable || true;
|
||||
document.querySelector("#bcnum").value = settings.bcnum || "";
|
||||
document.querySelector("#birthday").value = settings.bday || "";
|
||||
document.querySelector("#autocontinue").checked = settings.autocontinue || false;
|
||||
|
Loading…
Reference in New Issue
Block a user