From cc44fc1175f973f2d462718db9246715ff217ab8 Mon Sep 17 00:00:00 2001 From: Farthen Date: Sun, 3 Nov 2013 01:18:28 +0100 Subject: [PATCH] Make this actually work --- index.html | 6 +++--- rain.js | 22 +++++++++++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index fa4d74e..a284f10 100644 --- a/index.html +++ b/index.html @@ -9,10 +9,10 @@ -

NYI

-

HALP

+

NYI

+

HALP

- \ No newline at end of file + diff --git a/rain.js b/rain.js index e37155c..c37ecee 100644 --- a/rain.js +++ b/rain.js @@ -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'] + } + } - -}); \ No newline at end of file + 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!") + } + } +});