mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 04:26:35 +02:00
parent
9a3745b366
commit
c6cf48c489
7 changed files with 45 additions and 0 deletions
|
@ -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);
|
||||
}());
|
Loading…
Add table
Add a link
Reference in a new issue