diff --git a/changelog.htm b/changelog.htm index c34aad7..565f610 100644 --- a/changelog.htm +++ b/changelog.htm @@ -5,10 +5,19 @@ BC100 Autofill :: Changelog + + + - -

BC100 Autofill has been updated

+
+

BC100 Autofill has been updated

+ +

New feature since v0.2.1:

+

Go to settings to configure the new features

+

\ No newline at end of file diff --git a/changelog.js b/changelog.js new file mode 100644 index 0000000..2029762 --- /dev/null +++ b/changelog.js @@ -0,0 +1,10 @@ +document.addEventListener("DOMContentLoaded", + ev => { + document.querySelector("#stop-it").addEventListener("click", + () => browser.storage.sync.set({"showChangelog": false}) + ); + document.querySelector("#opensettings").addEventListener("click", + () => browser.runtime.openOptionsPage() + ); + } +); diff --git a/options/index.html b/options/index.html index cf0bb7d..ff905b4 100644 --- a/options/index.html +++ b/options/index.html @@ -365,6 +365,13 @@ +
+ Miscellaneous + +

diff --git a/options/script.js b/options/script.js index cd67747..cba5303 100644 --- a/options/script.js +++ b/options/script.js @@ -87,6 +87,7 @@ async function saveOptions(ev) { let placeName = this.querySelector('#placename').value; let iban = this.querySelector('#iban').value.replaceAll(" ", ""); let country = this.querySelector("#country").value; + let allowChangelogMessages = this.querySelector("#showChangelog").checked; if (iban != "" && !ibanValidate(iban)) { putError("Please check your IBAN for typing errors."); return; @@ -107,7 +108,8 @@ async function saveOptions(ev) { addr__placename: placeName, addr__country: country, pymt__iban: iban, - pymt__bic: bic + pymt__bic: bic, + showChangelog: allowChangelogMessages, }; options = Object.fromEntries(Object.entries(options).filter(([k, v]) => v !== "")) console.info("saving", options); @@ -121,6 +123,13 @@ async function saveOptions(ev) { } +function boolDefaultTrue(dict, key){ + if (key in dict){ + return dict[key]; + } + return true; +} + async function restoreOptions() { // We do not save user data in managed storage. // let res = await browser.storage.managed.get('colour'); @@ -128,7 +137,8 @@ async function restoreOptions() { let settings = await browser.storage.sync.get(); console.info("restoring", settings); - document.querySelector('#enable').checked = settings.enable || true; + + document.querySelector('#enable').checked = boolDefaultTrue(settings, "enable"); document.querySelector("#bcnum").value = settings.bcnum || ""; document.querySelector("#birthday").value = settings.bday || ""; document.querySelector("#default_action").value = settings.defaultAction || ""; @@ -143,6 +153,7 @@ async function restoreOptions() { document.querySelector('#country').value = settings.addr__country || ""; document.querySelector('#iban').value = settings.pymt__iban || ""; document.querySelector('#bic').value = settings.pymt__bic || ""; + document.querySelector('#showChangelog').checked = boolDefaultTrue(settings, "showChangelog"); } let bahncardWindow;