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!") + } + } +});