diff --git a/browserAction/browserAction.html b/browserAction/browserAction.html index 1b42a33..f49ae9f 100644 --- a/browserAction/browserAction.html +++ b/browserAction/browserAction.html @@ -12,6 +12,7 @@
+
diff --git a/browserAction/browserAction.js b/browserAction/browserAction.js index 5a9e101..9df6c43 100644 --- a/browserAction/browserAction.js +++ b/browserAction/browserAction.js @@ -164,4 +164,8 @@ } }); }); + + window.addEventListener("load", async function(){ + extension.displayVersion("version", 250); + }); }()); \ No newline at end of file diff --git a/lib/extension.js b/lib/extension.js index 671726b..ac41b13 100644 --- a/lib/extension.js +++ b/lib/extension.js @@ -235,5 +235,30 @@ } }; + scope.displayVersion = async function displayVersion(node, displayRefresh = false){ + if ("string" === typeof node){ + node = document.getElementById(node); + } + if (!node){ + throw "display node not found"; + } + fetch(scope.getURL("manifest.json")).then(function(response){ + return response.json(); + }).then(function(manifest){ + node.textContent = "Version " + manifest.version; + return manifest.version; + }).catch(function(error){ + node.textContent = "Unable to get version: " + error; + }); + + if (displayRefresh){ + // Workaround to hide the scroll bars + window.setTimeout(function(){ + node.style.display = "none"; + node.style.display = ""; + }, displayRefresh); + } + }; + Object.seal(scope); }()); \ No newline at end of file diff --git a/pageAction/pageAction.html b/pageAction/pageAction.html index f96918b..1ae56f8 100644 --- a/pageAction/pageAction.html +++ b/pageAction/pageAction.html @@ -11,6 +11,7 @@ +
diff --git a/pageAction/pageAction.js b/pageAction/pageAction.js index 9be32db..fd56d83 100644 --- a/pageAction/pageAction.js +++ b/pageAction/pageAction.js @@ -9,6 +9,10 @@ const {parseErrorStack} = require("../lib/callingStack"); const logging = require("../lib/logging"); logging.setPrefix("page action script"); + + window.addEventListener("load", async function(){ + extension.displayVersion("version", 250); + }); const domainNotification = require("./domainNotification"); const Notification = require("./Notification"); diff --git a/releaseNotes.txt b/releaseNotes.txt index be70e8d..5452dae 100644 --- a/releaseNotes.txt +++ b/releaseNotes.txt @@ -4,6 +4,7 @@ Version 1.10: new features: - added setting showPresetsOnInstallation to be able to not show the presets page upon installation + - display version in page and browser action fixes: - always protect about:blank @@ -14,6 +15,7 @@ Version 1.10: - settings reset confirmation dialog was not properly visible in Firefox for Android - reload after changing the whitelist state in the browser action has to be done without cache - data URL blocking was not affected by when changing the whitelist state in the browser action + - prevent unnecessary scroll bars in popups known issues: - if a data URL is blocked the page action button does not appear diff --git a/themes/base/layout.css b/themes/base/layout.css index 54f01d2..01d3542 100644 --- a/themes/base/layout.css +++ b/themes/base/layout.css @@ -106,4 +106,12 @@ input[type=checkbox]:checked::before { box-sizing: border-box; cursor: initial; background-color: var(--input-background-color); +} + +.versionDisplay { + text-align: right; + font-size: 0.6em; + opacity: 0.5; + margin: 0.3em 0.5em 0.2em; + clear: both; } \ No newline at end of file