site-progress-bar/content/display.md

41 lines
1.3 KiB
Markdown
Raw Permalink Normal View History

2020-07-03 06:20:15 +00:00
---
title: Display Page
2020-07-22 21:44:54 +00:00
description: This is a page that displays a progress bar
2020-07-03 06:49:20 +00:00
---
<script>
2023-06-08 18:08:04 +00:00
function addJS(name, type) {
2020-07-03 07:24:20 +00:00
var node=document.createElement('script');
2023-06-08 18:08:04 +00:00
node.setAttribute('type', type || 'text/javascript');
2020-07-03 07:24:20 +00:00
node.setAttribute('src', name);
document.head.appendChild(node);
2020-07-03 06:49:20 +00:00
}
function addCSS(name) {
2020-07-03 07:24:20 +00:00
var node=document.createElement('link');
node.setAttribute('rel', 'stylesheet');
node.setAttribute('type', 'text/css');
node.setAttribute('href', name);
document.head.appendChild(node);
2020-07-03 06:49:20 +00:00
}
var stylesheet = Array.from(document.getElementsByTagName('link')).filter(x=>x.getAttribute('rel')=='stylesheet')[0];
stylesheet.parentElement.removeChild(stylesheet);
function eraseCanvas() {
for (var headNode of Array.from(document.head.getElementsByTagName('script')))
document.head.removeChild(headNode);
for (var childNode of Array.from(document.body.childNodes))
document.body.removeChild(childNode);
document.body.removeAttribute('class')
}
2020-07-05 10:40:39 +00:00
var nextStyle = document.createElement('style');
nextStyle.setAttribute('id', 'nextStyle');
document.head.appendChild(nextStyle);
2020-07-03 06:49:20 +00:00
setTimeout(()=>{
eraseCanvas();
2020-07-05 10:40:39 +00:00
addCSS('/css/display.css');
2020-07-22 21:37:39 +00:00
addJS('/js/sprintf.min.js');
2020-07-03 07:24:20 +00:00
addJS('/js/sharedWebSocket.js');
2023-06-08 18:08:04 +00:00
addJS('/js/countup.mjs', 'module');
2020-07-03 06:49:20 +00:00
addJS('/js/display.js');
}, 10);
2023-06-08 18:08:04 +00:00
</script>