further refactoring my js
This commit is contained in:
parent
9648acc7a4
commit
d3413ee5a9
3 changed files with 23 additions and 18 deletions
|
@ -3,17 +3,7 @@
|
|||
|
||||
connfails=0;
|
||||
|
||||
connfailed=
|
||||
'<div id="modal" class="modal fade">' +
|
||||
' <div class="modal-header">' +
|
||||
' <h3>git-annex has shut down</h3>' +
|
||||
' </div>' +
|
||||
' <div class="modal-body">' +
|
||||
' You can now close this browser window.' +
|
||||
' </div>' +
|
||||
'</div>' ;
|
||||
|
||||
function longpoll(url, divid, cont) {
|
||||
function longpoll(url, divid, cont, fail) {
|
||||
$.ajax({
|
||||
'url': url,
|
||||
'dataType': 'html',
|
||||
|
@ -25,10 +15,7 @@ function longpoll(url, divid, cont) {
|
|||
'error': function(jqxhr, msg, e) {
|
||||
connfails=connfails+1;
|
||||
if (connfails > 3) {
|
||||
// blocked by many browsers
|
||||
window.close();
|
||||
$('#modal').replaceWith(connfailed);
|
||||
$('#modal').modal('show');
|
||||
fail();
|
||||
}
|
||||
else {
|
||||
cont();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue