From 05fd6c15639cc1ee68cb637fc7a01e471c39f06f Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 8 Dec 2016 16:01:46 +0100 Subject: [PATCH] Fix the infinite spinner problem --- www/code/main.js | 5 +++++ www/common/cryptpad-common.js | 2 ++ www/common/toolbar.js | 5 ++--- www/pad/main.js | 5 +++++ www/slide/main.js | 5 +++++ 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/www/code/main.js b/www/code/main.js index c5e605ef4..df068beef 100644 --- a/www/code/main.js +++ b/www/code/main.js @@ -687,6 +687,11 @@ define([ } }; + var onError = config.onError = function (info) { + module.spinner.hide(); + Cryptpad.alert(Messages.websocketError); + }; + var realtime = module.realtime = Realtime.start(config); editor.on('change', onLocal); diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 1866fb34a..3385f4e3e 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -550,6 +550,7 @@ define([ $(function() { // Race condition : if document.body is undefined when alertify.js is loaded, Alertify // won't work. We have to reset it now to make sure it uses a correct "body" + Alertify.reset(); if($('#pad-iframe').length) { var $iframe = $('#pad-iframe'); @@ -839,6 +840,7 @@ define([ var styleAlerts = common.styleAlerts = function (href) { var $link = $('link[href="/customize/alertify.css"]'); if ($link.length) { + return; $link.attr('href', ''); $link.attr('href', '/customize/alertify.css'); return; diff --git a/www/common/toolbar.js b/www/common/toolbar.js index 2fc0c112d..9bc466a78 100644 --- a/www/common/toolbar.js +++ b/www/common/toolbar.js @@ -313,12 +313,11 @@ define([ } } else if (!firstConnection) { - lagErrors++; // Display the red light at the 2nd failed attemp to get the lag - if (lagErrors > 1) { + //if (lagErrors > 1) { lagLight.addClass('lag-red'); title = Messages.redLight; - } + //} } if (title) { lagLight.attr('title', title); diff --git a/www/pad/main.js b/www/pad/main.js index 457913cb5..bed565952 100644 --- a/www/pad/main.js +++ b/www/pad/main.js @@ -691,6 +691,11 @@ define([ } }; + var onError = realtimeOptions.onError = function (info) { + module.spinner.hide(); + Cryptpad.alert(Messages.websocketError); + }; + var onLocal = realtimeOptions.onLocal = function () { if (initializing) { return; } if (readOnly) { return; } diff --git a/www/slide/main.js b/www/slide/main.js index a291ae02c..b43da457a 100644 --- a/www/slide/main.js +++ b/www/slide/main.js @@ -786,6 +786,11 @@ define([ } }; + var onError = config.onError = function (info) { + module.spinner.hide(); + Cryptpad.alert(Messages.websocketError); + }; + var realtime = module.realtime = Realtime.start(config); editor.on('change', onLocal);