diff --git a/_locales/de/messages.json b/_locales/de/messages.json index 86eeb34..c533006 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -43,6 +43,10 @@ "message": "CanvasBlocker wurde aktualisiert. Wenn Sie diese Seite in Zukunft erreichen wollen und noch kein Lesezeichen erstellt haben, erstellen Sie bitte eines.", "description": "" }, + "dontShowOptionsOnUpdate":{ + "message": "Bei Aktualisierung nicht wieder anzeigen.", + "description": "" + }, "openInTab": { "message": "In separatem Tab öffnen", "description": "" diff --git a/_locales/en/messages.json b/_locales/en/messages.json index b188b5e..7786382 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -43,6 +43,10 @@ "message": "CanvasBlocker was updated. If you want to be able to access this page in the future and have not bookmarked it, please bookmark it.", "description": "" }, + "dontShowOptionsOnUpdate":{ + "message": "Don't show again on update.", + "description": "" + }, "openInTab": { "message": "Open in separate tab", "description": "" diff --git a/lib/main.js b/lib/main.js index a8abb88..efb3968 100644 --- a/lib/main.js +++ b/lib/main.js @@ -181,8 +181,12 @@ openOptions(details.reason); break; case "update": - message("CanvasBlocker updated"); - openOptions(details.reason); + settings.onloaded(function(){ + if (!settings.dontShowOptionsOnUpdate){ + message("CanvasBlocker updated"); + openOptions(details.reason); + } + }); } }); diff --git a/lib/settingDefinitions.js b/lib/settingDefinitions.js index 4b2c093..9266f11 100644 --- a/lib/settingDefinitions.js +++ b/lib/settingDefinitions.js @@ -222,6 +222,10 @@ name: "displayDescriptions", defaultValue: false }, + { + name: "dontShowOptionsOnUpdate", + defaultValue: false + }, { name: "isStillDefault", defaultValue: true diff --git a/options/options.css b/options/options.css index 9b13d3c..c778777 100644 --- a/options/options.css +++ b/options/options.css @@ -13,6 +13,12 @@ header .bookmarkNotice { color: #880000; } +header .bookmarkNotice .dontShowOptionsOnUpdate { + display: block; + margin-top: 0.5em; + font-size: 0.8em; +} + .settings { width: 100%; border-spacing: 0; diff --git a/options/options.js b/options/options.js index e130fce..5707d52 100644 --- a/options/options.js +++ b/options/options.js @@ -65,7 +65,30 @@ let bookmarkingNotice = document.createElement("div"); bookmarkingNotice.className = noticeName + " bookmarkNotice"; bookmarkingNotice.textContent = notice; + + const dontShowAgain = document.createElement("label"); + dontShowAgain.className = "dontShowOptionsOnUpdate"; + const dontShowAgainInput = document.createElement("input"); + dontShowAgainInput.type = "checkbox"; + settings.onloaded(function(){ + dontShowAgainInput.checked = settings.dontShowOptionsOnUpdate; + }); + dontShowAgainInput.addEventListener("change", function(){ + settings.dontShowOptionsOnUpdate = this.checked; + }); + dontShowAgain.appendChild(dontShowAgainInput); + dontShowAgain.appendChild( + document.createTextNode( + browser.i18n.getMessage("dontShowOptionsOnUpdate") + ) + ); + bookmarkingNotice.appendChild(dontShowAgain); + head.appendChild(bookmarkingNotice); + + const newUrl = new URL(window.location.href); + newUrl.search = ""; + window.history.pushState({}, "", newUrl.href); } } diff --git a/releaseNotes.txt b/releaseNotes.txt index 70ae030..14ca955 100644 --- a/releaseNotes.txt +++ b/releaseNotes.txt @@ -5,6 +5,7 @@ Version 0.5.3: new features: - display version in options page - added link to open options page in separate tab + - added option "Don't show again on update." for options page fixes: - CSP did not work properly for worker-src