hs-css/js/script.js

61 lines
1.4 KiB
JavaScript

/* hackerspace.pl js
* by q3k@hackerspace.pl et al
*
* cc by-nc-sa */
$(function(){
var rotimageMoving = false;
$("#rotimage").mouseover(function() {
if (!rotimageMoving)
{
rotimageMoving = true;
$("#rotimage").animate({
height: "200px",
}, 300, "swing", function() {
rotimageMoving = false;
});
}
});
$("#rotimage").mouseout(function() {
if (!rotimageMoving)
{
rotimageMoving = true;
$("#rotimage").animate({
height: "100px",
}, 300, "swing", function() {
rotimageMoving = false;
});
}
});
$.get("/at", function(data) {
var jdata = JSON.parse(data);
var users = jdata.users.length;
if (users > 0)
{
var text = 'According to <a href="http://at.hackerspace.pl">our instruments</a> 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");
}
});
});