-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
58 lines (49 loc) · 1.38 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
function getControls(id,lang) {
$( '#box-' + id + ' .controls' ).load( 'modules/' + id + '/controls.php?lang=' + lang );
}
function getContent(id) {
$( '#content-' + id ).load( 'modules/' + id + '/content.php?lang=' + lang + '&dev=' + dev);
}
function refreshmodule(id,lang) {
getControls(id,lang);
}
// clock stuff
function setTime() {
var d = new Date();
$("#clock").html(d.toLocaleTimeString());
}
function closeAll() {
$(".box").removeClass("active");
$(".box").addClass("inactive");
$('html, body').animate({
scrollTop: 0
}, 1000);
$(".contentbox").html("");
}
function toggleContent(id) {
if ($(id).parent().hasClass("active")) {
closeAll();
} else {
contentid = $(id).parent().attr("id").replace("box-","");
$(".box").removeClass("active");
$(".box").addClass("inactive");
$('#content-' + contentid ).html("<span class=\"contentloading\">Content loading</span>");
$(id).parent().removeClass("inactive");
$(id).parent().addClass("active");
getContent(contentid);
$('html, body').animate({
scrollTop: $(id).offset().top
}, 1000);
}
}
function randomizer() {
$("body").removeClass();
$("body").addClass("random" + Math.floor((Math.random() * 10) + 1));
}
$( document ).ready(function() {
$( "h2" ).click(function() {
toggleContent(this);
});
randomizer();
window.setInterval("randomizer();",60000);
});