+

Czym jest Hackerspace?

diff --git a/js/script.js b/js/script.js index 385bc43..88530e7 100644 --- a/js/script.js +++ b/js/script.js @@ -28,6 +28,31 @@ $(function(){ }); } }); + + $.get("/at", function(data) { + var jdata = JSON.parse(data); + var users = jdata.users.length; + + if (users > 0) + { + var text = 'According to our instruments there '; + if (users == 1) + text += 'is one person'; + else + text += 'are ' + users + ' people'; + text += ' at the hackerspace right now.'; + + $("#status-tooltip p").html(text); + $("#status img").attr("src", "/img/status-open.png"); + $("#status-tooltip").css("display", "block"); + $("#status").css("display", "block"); + } + else + { + $("#status img").attr("src", "/img/status-closed.png"); + $("#status").css("display", "block"); + } + }); }); diff --git a/test/static.py b/test/static.py index 670e328..110290c 100644 --- a/test/static.py +++ b/test/static.py @@ -1,6 +1,13 @@ from flask import Flask, render_template +import urllib + app = Flask(__name__, static_folder='../', static_url_path='', template_folder='../') @app.route('/') def index(): return render_template('index.html') + +@app.route('/at') +def at(): + return urllib.urlopen("http://at.hackerspace.pl/api").read() + app.run()