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