-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathtimer.php
147 lines (124 loc) · 2.71 KB
/
timer.php
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<!--
* @copyright (c) 2008 Nicolo John Davis
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-->
<script type="text/javascript">
<!--
<?php
echo 'var currentTime = new Date("'. date_format(date_create(), "F d, Y H:i:s") . '");';
echo 'var startTime = new Date("'. date_format($startTime, "F d, Y H:i:s") . '");';
echo 'var endTime = new Date("'. date_format($endTime, "F d, Y H:i:s") . '");';
?>
var getLeaderInterval = <?php echo $getLeaderInterval; ?>;
var getChatInterval = <?php echo $getChatInterval; ?>;
var diff1 = startTime - currentTime;
var diff2 = endTime - currentTime;
var diff = 0;
function getLeaders()
{
$.get("getleaders.php", function(data){
$("#leaders").html(data);
});
}
function getDetails()
{
$.get("getdetails.php", function(data){
$("#details").html(data);
});
}
function getScores()
{
$.get("getscores.php", function(data){
$("#scores").html(data);
});
}
function getSubmissions()
{
$.get("getsubmissions.php", function(data){
$("#submissions").html(data);
});
}
function getAnnouncements()
{
$.get("getannouncements.php", function(data){
$("#announcements").html(data);
});
}
function getProblemStats()
{
$.get("statistics/getproblemstats.php", function(data){
$("#problemstats").html(data);
});
}
function getLeader()
{
$.get("statistics/getleader.php", function(data){
$("#leader").html(data);
});
}
function dispTime()
{
if(diff1>0)
{
$("#timeheading").text('Contest starts in');
diff = diff1;
}
else if(diff2>0)
{
$("#timeheading").text('Contest ends in');
diff = diff2;
}
else
{
$("#timeheading").text('Contest over');
diff = 0;
}
diff = Math.floor(diff/1000);
var d = Math.floor(diff/(3600*24));
diff = diff - d * 3600 *24;
var h = Math.floor(diff/3600);
var m = Math.floor((diff/60)%60);
var s = Math.floor(diff%60);
var hh = h;
var mm = m;
var ss = s;
if(h<10) hh = '0' + h;
if(m<10) mm = '0' + m;
if(s<10) ss = '0' + s;
var str = "<strong>"+hh+":"+mm+":"+ss+"</strong>";
if(d > 1)
str = "<strong>" + d + " days</strong>";
else if(d == 1)
str = "<strong>" + d + " day</strong>";
$("#time").html(str);
if(diff1 > 0)
{
diff1 = diff1-1000;
if(diff1 <= 0)
{
alert('Contest has started');
window.location.reload();
}
}
if(diff2 > 0)
{
diff2 = diff2-1000;
if(diff2 <= 0)
{
alert('Contest has ended');
setTimeout("reloadPage()", 2000);
}
}
}
function reloadPage() {
window.location.reload();
}
function messagebox(text)
{
$(".messagebox").text(text);
$(".messagebox").hide();
$(".messagebox").slideDown("slow").oneTime("5s", function() { $(this).slideUp("fast") });
$(".messagebox").click( function() { $(this).slideUp("fast"); } );
}
-->
</script>