Do not redirect to home page when logging out from another tab
This commit is contained in:
@@ -107,8 +107,18 @@ define([
|
||||
}
|
||||
eraseTempSessionValues();
|
||||
|
||||
logoutHandlers.forEach(function (h) {
|
||||
if (typeof (h) === "function") { h(); }
|
||||
});
|
||||
|
||||
if (cb) { cb(); }
|
||||
};
|
||||
var logoutHandlers= [];
|
||||
var onLogout = common.onLogout = function (h) {
|
||||
if (typeof (h) !== "function") { return; }
|
||||
if (logoutHandlers.indexOf(h) !== -1) { return; }
|
||||
logoutHandlers.push(h);
|
||||
};
|
||||
|
||||
var getUserHash = common.getUserHash = function () {
|
||||
var hash;
|
||||
@@ -760,6 +770,10 @@ define([
|
||||
|
||||
var LOADING = 'loading';
|
||||
common.addLoadingScreen = function () {
|
||||
if ($('#' + LOADING).length) {
|
||||
$('#' + LOADING).show();
|
||||
return;
|
||||
}
|
||||
var $loading = $('<div>', {id: LOADING});
|
||||
var $container = $('<div>', {'class': 'loadingContainer'});
|
||||
$container.append('<img class="cryptofist" src="/customize/cryptofist_small.png" />');
|
||||
@@ -773,9 +787,10 @@ define([
|
||||
common.removeLoadingScreen = function (cb) {
|
||||
$('#' + LOADING).fadeOut(750, cb);
|
||||
};
|
||||
common.errorLoadingScreen = function (error) {
|
||||
common.errorLoadingScreen = function (error, transparent) {
|
||||
$('.spinnerContainer').hide();
|
||||
$('#' + LOADING).find('p').text(error || Messages.error);
|
||||
if (transparent) { $('#' + LOADING).css('opacity', 0.8); }
|
||||
$('#' + LOADING).find('p').html(error || Messages.error);
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -49,6 +49,7 @@ define([
|
||||
|
||||
var $style;
|
||||
|
||||
var connected = false;
|
||||
var firstConnection = true;
|
||||
var lagErrors = 0;
|
||||
|
||||
@@ -453,6 +454,7 @@ define([
|
||||
left: true, // Open to the left of the button
|
||||
};
|
||||
var $userAdmin = Cryptpad.createDropdown(dropdownConfigUser);
|
||||
$userAdmin.attr('id', 'userDropdown');
|
||||
$userContainer.append($userAdmin);
|
||||
|
||||
$userAdmin.find('a.logout').click(function (e) {
|
||||
@@ -522,7 +524,7 @@ define([
|
||||
return true;
|
||||
});
|
||||
$input.on('keyup', function (e) {
|
||||
if (e.which === 13) {
|
||||
if (e.which === 13 && connected === true) {
|
||||
var name = $input.val().trim();
|
||||
if (name === "") {
|
||||
name = $input.attr('placeholder');
|
||||
@@ -544,6 +546,7 @@ define([
|
||||
});
|
||||
|
||||
var displayInput = function () {
|
||||
if (connected === false) { return; }
|
||||
$text.hide();
|
||||
//$pencilIcon.css('display', 'none');
|
||||
var inputVal = suggestName() || "";
|
||||
@@ -575,8 +578,6 @@ define([
|
||||
var loadElement;
|
||||
var $stateElement = toolbar.find('.' + STATE_CLS);
|
||||
|
||||
var connected = false;
|
||||
|
||||
if (config.ifrw) {
|
||||
var removeDropdowns = function (e) {
|
||||
$container.find('.cryptpad-dropdown').hide();
|
||||
@@ -701,12 +702,21 @@ define([
|
||||
checkLag(getLag, lagElement);
|
||||
}, 3000);
|
||||
|
||||
var failed = function () {
|
||||
connected = false;
|
||||
$stateElement.text(Messages.disconnected);
|
||||
checkLag(undefined, lagElement);
|
||||
};
|
||||
|
||||
// On log out, remove permanently the realtime elements of the toolbar
|
||||
Cryptpad.onLogout(function () {
|
||||
failed();
|
||||
$userAdminElement.find('#userDropdown').hide();
|
||||
$(userListElement).hide();
|
||||
});
|
||||
|
||||
return {
|
||||
failed: function () {
|
||||
connected = false;
|
||||
$stateElement.text(Messages.disconnected);
|
||||
checkLag(undefined, lagElement);
|
||||
},
|
||||
failed: failed,
|
||||
reconnecting: function (userId) {
|
||||
myUserName = userId;
|
||||
connected = false;
|
||||
|
||||
Reference in New Issue
Block a user