57 lines
1.6 KiB
JavaScript
57 lines
1.6 KiB
JavaScript
/* hackerspace.pl js
|
|
* by q3k@hackerspace.pl et al
|
|
*
|
|
* cc by-nc-sa */
|
|
|
|
$(function(){
|
|
var el = $("#rotimage");
|
|
el.mouseenter(function() {
|
|
el.stop().animate({
|
|
height: "200px",
|
|
}, 300, "swing");
|
|
});
|
|
el.mouseleave(function() {
|
|
el.stop().animate({
|
|
height: "100px",
|
|
}, 300, "swing");
|
|
});
|
|
|
|
var at = function() {
|
|
$.get("/at", function(data) {
|
|
var jdata = JSON.parse(data);
|
|
var users = jdata.users.length;
|
|
var tooltip = $('#status-tooltip');
|
|
var text = 'According to <a href="http://at.hackerspace.pl">our instruments</a> there ';
|
|
if (users == 1)
|
|
text += 'is one person';
|
|
else if(users == 0)
|
|
text += 'is no one';
|
|
else
|
|
text += 'are ' + users + ' people';
|
|
text += ' at the hackerspace right now.';
|
|
|
|
$("#status-tooltip p").html(text);
|
|
if(users > 0) {
|
|
$("#status img").attr("src", "/img/status-open.png");
|
|
tooltip.removeClass('status-tooltip-closed');
|
|
tooltip.addClass('status-tooltip-open');
|
|
}
|
|
else {
|
|
$("#status img").attr("src", "/img/status-closed.png");
|
|
tooltip.removeClass('status-tooltip-open');
|
|
tooltip.addClass('status-tooltip-closed');
|
|
}
|
|
|
|
$("#status").css('display', 'inline-block');
|
|
$("#status-tooltip").css('display', 'inline-block');
|
|
|
|
});
|
|
};
|
|
setInterval(at, 1e3 * 300);
|
|
at();
|
|
});
|
|
|
|
|
|
|
|
|