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>
<div id="actions" class="stackedInputs"></div>
<div id="version" class="versionDisplay"></div>
<script src="../lib/require.js"></script>
<script src="../lib/logging.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);
}());

View File

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

View File

@ -10,6 +10,10 @@
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");
const {createActionButtons, modalPrompt, modalChoice} = require("./gui");

View File

@ -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

View File

@ -107,3 +107,11 @@ input[type=checkbox]:checked::before {
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;
}