104 lines
1.8 KiB
HTML
104 lines
1.8 KiB
HTML
<html>
|
|
<head>
|
|
<title>Is FsWIAI open?</title>
|
|
|
|
<style type="text/css">
|
|
body {
|
|
font-family: serif;
|
|
font-size: 2em;
|
|
text-align: center;
|
|
background-color: rgba(0,0,0,0);
|
|
padding: 0;
|
|
margin: 0;
|
|
}
|
|
|
|
open {
|
|
width: 6em;
|
|
border-color: #557755;
|
|
background-color: #55BB55;
|
|
}
|
|
|
|
open,closed,unknown {
|
|
border-radius: 0.25em;
|
|
border-width: 0.1em;
|
|
border-style: solid;
|
|
padding: 0.4em 0.6em;
|
|
color: white;
|
|
display: inline-block;
|
|
}
|
|
|
|
unknown {
|
|
background-color: #55BBBB;
|
|
border-color: #557777;
|
|
}
|
|
|
|
closed {
|
|
background-color: #BB5555;
|
|
border-color: #775555;
|
|
}
|
|
|
|
closed small, open small {
|
|
color: #444444;
|
|
font-size: 0.5em;
|
|
}
|
|
</style>
|
|
|
|
<script type="text/javascript" src="/door/prototype.js">
|
|
</script>
|
|
|
|
<script type="text/javascript" src="/door/effects.js">
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
var status = -2;
|
|
|
|
function update() {
|
|
if(status == 1)
|
|
$('content').innerHTML = "<open id='statusbox' ><small>Die Fachschaft ist</small><br/>geöffnet</open>";
|
|
else if(status == -1)
|
|
$('content').innerHTML = "<unknown id='statusbox'><small>Die Fachschaft ist</small><br/>vielleicht offen</unknown>";
|
|
else
|
|
$('content').innerHTML = "<closed id='statusbox'><small>Die Fachschaft ist</small><br/>geschlossen</closed>";
|
|
|
|
$('statusbox').fade({ duration: 0.5, from: 0, to: 1 });
|
|
}
|
|
|
|
function request() {
|
|
|
|
new Ajax.Request('/doorapi/status?current=' + status, {
|
|
onSuccess: function(response) {
|
|
var data = eval('(' + response.responseText + ')');
|
|
var newVal = (data.status === "open");
|
|
|
|
if(newVal != status) {
|
|
status = Number(newVal);
|
|
update();
|
|
}
|
|
|
|
setTimeout(request, 500);
|
|
},
|
|
onFailure: function(response) {
|
|
if(status != -1)
|
|
{
|
|
status = -1;
|
|
update();
|
|
}
|
|
|
|
setTimeout(request, 500);
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
request();
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<a href="/door/" target="_parent">
|
|
<div id="content">
|
|
</div>
|
|
</a>
|
|
</body>
|
|
</html>
|
|
|