|
|
@ -43,7 +43,6 @@ define([
|
|
|
|
var LOCALSTORAGE_DISALLOW = Bar.constants.localstorageDisallow = 'cryptpad-disallow';
|
|
|
|
var LOCALSTORAGE_DISALLOW = Bar.constants.localstorageDisallow = 'cryptpad-disallow';
|
|
|
|
|
|
|
|
|
|
|
|
var SPINNER_DISAPPEAR_TIME = 3000;
|
|
|
|
var SPINNER_DISAPPEAR_TIME = 3000;
|
|
|
|
var SPINNER = [ '-', '\\', '|', '/' ];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var uid = function () {
|
|
|
|
var uid = function () {
|
|
|
|
return 'cryptpad-uid-' + String(Math.random()).substring(2);
|
|
|
|
return 'cryptpad-uid-' + String(Math.random()).substring(2);
|
|
|
@ -80,21 +79,19 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var createSpinner = function ($container) {
|
|
|
|
var createSpinner = function ($container) {
|
|
|
|
var $spinner = $('<div>', {
|
|
|
|
var $spinner = $('<span>', {
|
|
|
|
id: uid(),
|
|
|
|
id: uid(),
|
|
|
|
'class': SPINNER_CLS,
|
|
|
|
'class': SPINNER_CLS + ' fa fa fa-spinner fa-pulse',
|
|
|
|
});
|
|
|
|
}).hide();
|
|
|
|
$container.prepend($spinner);
|
|
|
|
$container.prepend($spinner);
|
|
|
|
return $spinner[0];
|
|
|
|
return $spinner[0];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var kickSpinner = function (spinnerElement, reversed) {
|
|
|
|
var kickSpinner = function (spinnerElement) {
|
|
|
|
var txt = spinnerElement.textContent || '-';
|
|
|
|
$(spinnerElement).show();
|
|
|
|
var inc = (reversed) ? -1 : 1;
|
|
|
|
|
|
|
|
spinnerElement.textContent = SPINNER[(SPINNER.indexOf(txt) + inc) % SPINNER.length];
|
|
|
|
|
|
|
|
if (spinnerElement.timeout) { clearTimeout(spinnerElement.timeout); }
|
|
|
|
if (spinnerElement.timeout) { clearTimeout(spinnerElement.timeout); }
|
|
|
|
spinnerElement.timeout = setTimeout(function () {
|
|
|
|
spinnerElement.timeout = setTimeout(function () {
|
|
|
|
spinnerElement.textContent = '';
|
|
|
|
$(spinnerElement).hide();
|
|
|
|
}, SPINNER_DISAPPEAR_TIME);
|
|
|
|
}, SPINNER_DISAPPEAR_TIME);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -616,7 +613,7 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var ks = function () {
|
|
|
|
var ks = function () {
|
|
|
|
if (connected) { kickSpinner(spinner, false); }
|
|
|
|
if (connected) { kickSpinner(spinner); }
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
realtime.onPatch(ks);
|
|
|
|
realtime.onPatch(ks);
|
|
|
|