-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
82 lines (73 loc) · 1.98 KB
/
index.html
File metadata and controls
82 lines (73 loc) · 1.98 KB
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>foursquare hackathon voting</title>
<style>
html {
background-color: #fdfdfd;
}
body {
font: 62.5% Helvetica, Arial, sans-serif;
color: #222;
}
#container {
width: 100%;
margin: 0 auto;
margin-top: 5em;
}
#results {
width: 100%;
}
h1 {
font-size: 3.2em;
text-align: center;
margin-bottom: 0.5em;
}
p img {
margin-top: 0.5em;
font-size: 2.4em;
float: right;
}
strong {
font-weight: bold;
text-shadow: #bbb 0px 1px 3px;
}
td.bar {
width: 80%;
}
td.teamname { width: 10%; font-size: 1.5em; }
tr { height: 30px; }
</style>
</head>
<body>
<div id="container">
<h1>Vote! Text your favorite team's number to <strong>(917) 310-5220</strong>!</h1>
<table id="results">
</table>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
function updateTable(totals) {
totals.sort(function(a, b) { return b.total - a.total; });
var maxTotal = 1;
for (var i = 0; i < totals.length; ++i) {
maxTotal = Math.max(maxTotal, totals[i].total);
}
$('#results').empty();
for (var i = 0; i < totals.length; ++i) {
var oneteam = totals[i];
var str = ([
'<tr>',
'<td class="teamname">', oneteam.name, '</td>',
'<td><h1><strong>', oneteam.total, '</strong></h1></td>',
'<td class="bar">', '<div style="height: 30px; width: ', (oneteam.total*100.0) / maxTotal, '%; background-color: #ccc;"></div>', '</td>',
'</tr>'
]).join('');
$('#results').append(str);
}
window.setTimeout(function() { $.getJSON('/fetch', updateTable) }, 30*1000);
};
$.getJSON('/fetch', updateTable);
</script>
</body>
</html>