1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 04:40:20 +01:00

Display version

Fixes #687
This commit is contained in:
kkapsner 2024-03-28 14:43:53 +01:00
parent 9a3745b366
commit c6cf48c489
7 changed files with 45 additions and 0 deletions

View File

@ -12,6 +12,7 @@
<div id="reload" class="hidden"></div> <div id="reload" class="hidden"></div>
</div> </div>
<div id="actions" class="stackedInputs"></div> <div id="actions" class="stackedInputs"></div>
<div id="version" class="versionDisplay"></div>
<script src="../lib/require.js"></script> <script src="../lib/require.js"></script>
<script src="../lib/logging.js"></script> <script src="../lib/logging.js"></script>
<script src="../lib/extension.js"></script> <script src="../lib/extension.js"></script>

View File

@ -164,4 +164,8 @@
} }
}); });
}); });
window.addEventListener("load", async function(){
extension.displayVersion("version", 250);
});
}()); }());

View File

@ -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); Object.seal(scope);
}()); }());

View File

@ -11,6 +11,7 @@
<ul id="prints"> <ul id="prints">
<li>...</li> <li>...</li>
</ul> </ul>
<div id="version" class="versionDisplay"></div>
<script src="../lib/require.js"></script> <script src="../lib/require.js"></script>
<script src="../lib/logging.js"></script> <script src="../lib/logging.js"></script>
<script src="../lib/extension.js"></script> <script src="../lib/extension.js"></script>

View File

@ -9,6 +9,10 @@
const {parseErrorStack} = require("../lib/callingStack"); const {parseErrorStack} = require("../lib/callingStack");
const logging = require("../lib/logging"); const logging = require("../lib/logging");
logging.setPrefix("page action script"); logging.setPrefix("page action script");
window.addEventListener("load", async function(){
extension.displayVersion("version", 250);
});
const domainNotification = require("./domainNotification"); const domainNotification = require("./domainNotification");
const Notification = require("./Notification"); const Notification = require("./Notification");

View File

@ -4,6 +4,7 @@ Version 1.10:
new features: new features:
- added setting showPresetsOnInstallation to be able to not show the presets page upon installation - added setting showPresetsOnInstallation to be able to not show the presets page upon installation
- display version in page and browser action
fixes: fixes:
- always protect about:blank - always protect about:blank
@ -14,6 +15,7 @@ Version 1.10:
- settings reset confirmation dialog was not properly visible in Firefox for Android - 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 - 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 - data URL blocking was not affected by when changing the whitelist state in the browser action
- prevent unnecessary scroll bars in popups
known issues: known issues:
- if a data URL is blocked the page action button does not appear - if a data URL is blocked the page action button does not appear

View File

@ -106,4 +106,12 @@ input[type=checkbox]:checked::before {
box-sizing: border-box; box-sizing: border-box;
cursor: initial; cursor: initial;
background-color: var(--input-background-color); 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;
} }