summaryrefslogtreecommitdiffstats
path: root/bwlpMonitor_template.html
blob: 19a804b3c7d693468038934ad712ccf58652b1d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" type="text/css" href="style.css">
    <link rel="icon" type="image/x-icon" href="img/favicon.ico">
    <title>bwLp Status Monitor</title>
  </head>
  <body>
    <div id="header">
	  <div id="header_left">
	    <a href="">
	      <img id="header_image" src="img/logo_bwlehrpool.png" alt="bwLehrpool">
		</a>
	  </div>
      <div id="header_center">
	    <label id="header_label">Status Monitor</label>
	  </div>
	  <div id="header_right">
	    <div>
		  <a href="https://www.bwlehrpool.de/doku.php/start">
	        <img id="header_wiki" src="img/wiki_bwlehrpool.png" alt="bwLehrpool">
		  </a>
		</div>
	    <a id="header_wiki_label" href="https://www.bwlehrpool.de/doku.php/start">bwlp Wiki</a>
      </div>
	</div>
    <div id="body">
      <div id="content">
%CONTENT%
	  </div>
			<div id="log_wrapper">
      	<div id="log">
%LOG%
				</div>
			</div>
    </div>

  </body>

</html>

<script>
	const urlParams = new URLSearchParams(window.location.search)
	const noheader = urlParams.get('noheader')
	if (noheader != null) {
		document.getElementById('header').style.visibility = 'hidden'
		document.getElementById('body').style.marginTop = '0px'
	}
	const borderless = urlParams.get('borderless')
	if (borderless != null) {
		const body = document.getElementById('body')
		body.style.padding = '0px'
		body.style.width = '100%'
		body.style.height = '100%'

		const logWrapper = document.getElementById('log_wrapper')
		logWrapper.style.maxHeight = 'unset'
		logWrapper.style.maxWidth = 'unset'
		logWrapper.style.display = 'unset'
		logWrapper.style.height = '100%'
		logWrapper.style.boxShadow = 'unset'
		logWrapper.style.margin = 'unset'

		const log = document.getElementById('log')
		log.style.height = 'unset'
		log.style.setProperty('--wrap', 'normal')

		const content = document.getElementById('content')
		content.style.height = '100%'
		content.style.boxShadow = 'unset'
		content.style.maxWidth = 'unset'

		var media = window.matchMedia("(min-width: 1500px)")
		borderlessMedia(media, logWrapper, content)
		media.addListener(borderlessMedia)
	}

	function borderlessMedia(media) {
		const logWrapper = document.getElementById('log_wrapper')
		const content = document.getElementById('content')

		if (media.matches) {
			logWrapper.style.borderTop = 'unset'
			logWrapper.style.borderLeft = '3px solid #8a8a8a'
			content.style.flexWrap = 'nowrap'
		} else {
			logWrapper.style.borderLeft = 'unset'
			logWrapper.style.borderTop = '3px solid #8a8a8a'
			content.style.flexWrap = 'wrap'
		}
	}

	var autorefresh = urlParams.get('autorefresh')
	var autorefresh = parseInt(autorefresh)
	console.log(Number.isInteger(autorefresh))
	if (Number.isInteger(autorefresh)) {
		console.log(autorefresh)
		setTimeout(function() {
			location.reload();
		}, autorefresh * 1000);
	}
</script>