blob: edb554eaff3641cc1086f9aef2a3c59b71091f05 (
plain)
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
|
importScripts('/static/jquery.hive.pollen.min.js');
var pid;
var timestamp = '0';
function getUpdates() {
$.ajax.get({
url: '/poll/',
dataType: 'json',
data: {pid: pid, timestamp: timestamp},
success: handleUpdates
});
}
function handleUpdates(data) {
var updates = [];
for (var i = 0; i < data.length; i++) {
updates.push({
'action': data[i].Action,
'yid': data[i].Song.Yid,
'title': data[i].Song.Title,
'user': data[i].Song.User
});
timestamp = data[i].Timestamp;
}
$.send({updates: updates});
getUpdates();
}
$(function (data) {
pid = data.pid;
getUpdates();
});
|