update bootstrap files to bootstrap3
This commit is contained in:
parent
4d4797b8c8
commit
c8dccf9582
23 changed files with 8323 additions and 6251 deletions
46
static/js/longpolling.js
Normal file
46
static/js/longpolling.js
Normal file
|
@ -0,0 +1,46 @@
|
|||
connfails=0;
|
||||
|
||||
longpollcallbacks = $.Callbacks();
|
||||
|
||||
// Updates a div with a specified id, by polling an url,
|
||||
// which should return a new div, with the same id.
|
||||
function longpoll_div(url, divid, cont, fail) {
|
||||
$.ajax({
|
||||
'url': url,
|
||||
'dataType': 'html',
|
||||
'success': function(data, status, jqxhr) {
|
||||
$('#' + divid).replaceWith(data);
|
||||
longpollcallbacks.fire();
|
||||
connfails=0;
|
||||
cont();
|
||||
},
|
||||
'error': function(jqxhr, msg, e) {
|
||||
connfails=connfails+1;
|
||||
// It's normal to get 1 failure per longpolling
|
||||
// element when navigating away from a page.
|
||||
// So 12 allows up to 4 longpolling elements per
|
||||
// page.
|
||||
if (connfails > 12) {
|
||||
fail();
|
||||
}
|
||||
else {
|
||||
cont();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function longpoll_data(url, cont) {
|
||||
$.ajax({
|
||||
'url': url,
|
||||
'dataType': 'text',
|
||||
'success': function(data, status, jqxhr) {
|
||||
connfails=0;
|
||||
cont(1, data);
|
||||
},
|
||||
'error': function(jqxhr, msg, e) {
|
||||
connfails=connfails+1;
|
||||
cont(0);
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue