site-manual-notifier/content/display.md

41 lines
1.5 KiB
Markdown
Raw Normal View History

2020-07-03 06:20:15 +00:00
---
title: Display Page
2020-07-24 00:07:07 +00:00
description: This is a page that displays the manual notification
2020-07-03 06:49:20 +00:00
---
<script>
function addJS(name) {
2020-07-03 07:24:20 +00:00
var node=document.createElement('script');
node.setAttribute('type','text/javascript');
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
}
2020-07-24 00:07:07 +00:00
var searchArgsGetter = () => Object.fromEntries(window.location.search.substr(1).split('&').map(x=>[...x.split('='), ''].slice(0, 2).map(y=>decodeURIComponent(y))));
var searchArgs = searchArgsGetter();
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-24 00:07:07 +00:00
test_display = !!searchArgs.test;
2020-07-03 06:49:20 +00:00
setTimeout(()=>{
eraseCanvas();
2020-07-05 10:40:39 +00:00
addCSS('/css/display.css');
2020-07-03 07:24:20 +00:00
addJS('/js/sharedWebSocket.js');
2020-07-03 06:49:20 +00:00
addJS('/js/display.js');
}, 10);
</script>