Revert "reduce polling load by condensing the json poll api into one method instead of several"
This reverts commit 4ae3407fb0
.
This commit is contained in:
14
static/js/balance-poll.js
Normal file
14
static/js/balance-poll.js
Normal file
@@ -0,0 +1,14 @@
|
||||
function updateBalance() {
|
||||
$.get("/api/balance", function(data) {
|
||||
$("#balance-display").html(data['balance']);
|
||||
});
|
||||
}
|
||||
|
||||
function pollBalance() {
|
||||
updateBalance();
|
||||
window.setTimeout(pollBalance, 3000);
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
pollBalance();
|
||||
});
|
@@ -1,14 +0,0 @@
|
||||
function pollMessages() {
|
||||
$.get('/api/poll/0', function(data) {
|
||||
$('#balance-display').html(data['user-info']['balance']);
|
||||
});
|
||||
}
|
||||
|
||||
function poll() {
|
||||
pollMessages();
|
||||
window.setTimeout(pollMessages, 3000);
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
poll();
|
||||
});
|
20
static/js/server-poll.js
Normal file
20
static/js/server-poll.js
Normal file
@@ -0,0 +1,20 @@
|
||||
function updateServer() {
|
||||
$.get("/api/server/info/s.camin.us", function(data) {
|
||||
hours = parseInt((data['time']/1000)+8)%24;
|
||||
minutes = parseInt(((data['time']/1000)%1)*60);
|
||||
var day = hours < 12;
|
||||
minutes = ""+minutes;
|
||||
while(minutes.length<2)
|
||||
minutes = "0"+minutes;
|
||||
$("#time-display").html(hours+":"+minutes+" "+(day ? "am":"pm"));
|
||||
});
|
||||
}
|
||||
|
||||
function pollServer() {
|
||||
updateServer();
|
||||
window.setTimeout(pollServer, 1000);
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
pollServer();
|
||||
});
|
Reference in New Issue
Block a user