Skip to content

Commit

Permalink
Make this actually work
Browse files Browse the repository at this point in the history
  • Loading branch information
Farthen committed Nov 3, 2013
1 parent 1dc3a1c commit cc44fc1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
</head>
<body>

<h1>NYI</h1>
<p>HALP</p>
<h1 id="rain-caption">NYI</h1>
<p id="rain-text">HALP</p>

<script src="//code.jquery.com/jquery.js"></script>
<script src="/rain.js"></script>
</body>
</html>
</html>
22 changes: 19 additions & 3 deletions rain.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
$.ajax('http://api.wurstmineberg.de/server/level.json', {
dataType: 'json',
success:
success: function(data) {
var rainstatus = -1
if ('Data' in data) {
if ('raining' in data['Data']) {
rainstatus = data['Data']['raining']
}
}


});
if (rainstatus == -1) {
$('#rain-caption').text("???")
$('#rain-text').text("I have no idea. Seriously. Something is broken")
} else if (rainstatus == 0) {
$('#rain-caption').text("No!")
$('#rain-text').text("It's not raining.")
} else {
$('#rain-caption').text("Yes!")
$('#rain-text').text("It's raining!")
}
}
});

0 comments on commit cc44fc1

Please sign in to comment.