door api stub
This commit is contained in:
parent
e6893f0569
commit
55d17815a1
1
door.html
Normal file
1
door.html
Normal file
@ -0,0 +1 @@
|
||||
<html><head><meta http-equiv='refresh' content='20'><title>Is FS WIAI Open?!</title></head><body style='background-color:#bbc0c7; color:black;'><img style='margin:0 auto; display: block;'src='./door/unknown.jpg' /><content style='text-align:center; display: block;'><h2 style='color:#0B75AF;'>Didn't change for about 39987 minutes.</h2></content><bottom style='display: block; margin:10em auto; background-color:#0B75AF; width:15em; padding:0.5em; border-style:solid; border-color:black; border-width:0.2em;'><h3>Server-Infos:</h3><p>API-Host: 141.13.163.254</p><p>API-Filename: index.html</p><p>Uptime: 39987 minutes</p><p>Build: Mar 26 2013</p></bottom></body></html>
|
||||
1123
door/effects.js
vendored
Normal file
1123
door/effects.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
112
door/index.html
Normal file
112
door/index.html
Normal file
@ -0,0 +1,112 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Is FsWIAI open?</title>
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: serif;
|
||||
font-size: 4em;
|
||||
text-align: center;
|
||||
background-color: #5555FF;
|
||||
padding-top: 20%;
|
||||
}
|
||||
|
||||
open {
|
||||
background-color: #55BB55;
|
||||
}
|
||||
|
||||
open,closed,unknown {
|
||||
border-radius: 0.5em;
|
||||
border-width: 0.2em;
|
||||
border-style: solid;
|
||||
border-color: #557755;
|
||||
padding: 0.4em 0.6em;
|
||||
width: 6em;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
closed {
|
||||
background-color: #BB5555;
|
||||
border-color: #775555;
|
||||
}
|
||||
|
||||
unknown {
|
||||
background-color: yellow;
|
||||
}
|
||||
|
||||
#time {
|
||||
display: inline;
|
||||
}
|
||||
</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 = Number(-2);
|
||||
|
||||
function update() {
|
||||
if(status==0){
|
||||
document.title = "FsWIAI is closed";
|
||||
|
||||
$('content').innerHTML = "Die Fachschaft ist <br/> <closed id='statusbox'>geschlossen</closed>";
|
||||
} else if(status==-1) {
|
||||
document.title = "Is FsWIAI open?";
|
||||
|
||||
$('content').innerHTML = "Die Fachschaft ist vielleicht offen.<br/> <unknown id='statusbox'>unbekannt</unknown>"
|
||||
}
|
||||
else {
|
||||
$('content').innerHTML = "Die Fachschaft ist <div id='time'></div><br/> <open id='statusbox' >offen</open>";
|
||||
}
|
||||
|
||||
$('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();
|
||||
}
|
||||
|
||||
if(status > 0)
|
||||
{
|
||||
if(data.uptime < 2)
|
||||
$('time').innerHTML = "seit Kurzem";
|
||||
else
|
||||
$('time').innerHTML = "seit " + data.uptime + " Minuten";
|
||||
|
||||
|
||||
document.title = "FsWIAI is open [" + data.uptime + "min]";
|
||||
}
|
||||
|
||||
setTimeout(request, 500);
|
||||
},
|
||||
onFailure: function(response) {
|
||||
if(-1 != status) {
|
||||
status = -1
|
||||
update();
|
||||
}
|
||||
|
||||
setTimeout(request, 500);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
request();
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="content">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
83
door/log.html
Normal file
83
door/log.html
Normal file
@ -0,0 +1,83 @@
|
||||
<html>
|
||||
<header>
|
||||
<title>Log - Is FsWIAI open?</title>
|
||||
</header>
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#content {
|
||||
margin: 0 auto;
|
||||
|
||||
display: block;
|
||||
|
||||
min-height: 20em;
|
||||
|
||||
width: 50em;
|
||||
background-color: gray;
|
||||
color: white;
|
||||
padding: 1em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript" src="/door/prototype.js">
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="/door/effects.js">
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function toTimeStamp(unix) {
|
||||
var date = new Date(1000 * unix);
|
||||
|
||||
var year = date.getFullYear();
|
||||
var month = 1+date.getMonth();
|
||||
var day = date.getDate();
|
||||
var hours = date.getHours();
|
||||
var minutes = date.getMinutes();
|
||||
|
||||
return day + "." + month + "." + year + " " + hours + ":" + minutes;
|
||||
}
|
||||
|
||||
new Ajax.Request('/doorapi/log', {
|
||||
onSuccess: function(response) {
|
||||
var data = eval('(' + response.responseText + ')');
|
||||
var html = "<h1>Logbuch</h1>";
|
||||
|
||||
if(data.length == 0)
|
||||
{
|
||||
html += "<p>No log data found!</p>";
|
||||
}
|
||||
else
|
||||
{
|
||||
html += "<ul>";
|
||||
|
||||
for(var i = 0; i < data.length; ++i)
|
||||
{
|
||||
html += "<li>";
|
||||
html += "Von " + toTimeStamp(data[i].start);
|
||||
html += " bis " + toTimeStamp(data[i].end);
|
||||
html += "</li>";
|
||||
}
|
||||
|
||||
html += "</ul>";
|
||||
}
|
||||
|
||||
$('content').innerHTML = html;
|
||||
},
|
||||
onFailure: function(response) {
|
||||
alert("Failed to get data!");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<body>
|
||||
<div id='content'>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
7037
door/prototype.js
vendored
Normal file
7037
door/prototype.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
103
door/small.html
Normal file
103
door/small.html
Normal file
@ -0,0 +1,103 @@
|
||||
<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>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user