diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index c0fe4498f..8231aeb02 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -80,7 +80,7 @@ define([ var logout = common.logout = function (cb) { [ - fileHashKey, +// fileHashKey, userHashKey, ].forEach(function (k) { sessionStorage.removeItem(k); @@ -88,6 +88,11 @@ define([ delete localStorage[k]; delete sessionStorage[k]; }); + // Make sure we have an FS_hash in localStorage before reloading all the tabs + // so that we don't end up with tabs using different anon hashes + if (!localStorage[fileHashKey]) { + localStorage[fileHashKey] = common.createRandomHash(); + } if (cb) { cb(); } }; diff --git a/www/common/toolbar.js b/www/common/toolbar.js index c2a74e44c..a118dcf62 100644 --- a/www/common/toolbar.js +++ b/www/common/toolbar.js @@ -374,7 +374,7 @@ define([ if (config.displayed.indexOf('useradmin') !== -1) { if (!config.userName || !config.userName.setName || !config.userName.lastName) { throw new Error("You must provide a `userName` object containing `setName` (function) " + - "and `lastName` (object) if you want to display the user admin menu.") + "and `lastName` (object) if you want to display the user admin menu."); } var $displayedName = $('', {'class': USERNAME_CLS}); var accountName = Cryptpad.getStore().getLoginName ? Cryptpad.getStore().getLoginName() : null; @@ -388,7 +388,7 @@ define([ var $userName = $('', {'class': 'userDisplayName'}); if (readOnly !== 1) { // Hide "Display name:" in read only mode - $userName.append(Messages.user_displayName + ': ') + $userName.append(Messages.user_displayName + ': '); } $userName.append($displayedName.clone()); $userAdminContent.append($userName); @@ -429,12 +429,12 @@ define([ if (account) { $button.append($('', {'class': 'account-name'}).text('(' + accountName + ')')); } - var dropdownConfig = { + var dropdownConfigUser = { text: $button.html(), // Button initial text options: options, // Entries displayed in the menu left: true, // Open to the left of the button }; - var $userAdmin = Cryptpad.createDropdown(dropdownConfig); + var $userAdmin = Cryptpad.createDropdown(dropdownConfigUser); $userContainer.append($userAdmin); $userAdmin.find('a.logout').click(function (e) { @@ -569,9 +569,9 @@ define([ return; } - var e = jQuery.Event("keyup"); - e.which = 13; - $titleElement.find('input').trigger(e); + var ev = $.Event("keyup"); + ev.which = 13; + $titleElement.find('input').trigger(ev); /* $titleElement.find('input').hide(); diff --git a/www/pad/main.js b/www/pad/main.js index df80cef19..3998ad915 100644 --- a/www/pad/main.js +++ b/www/pad/main.js @@ -495,8 +495,9 @@ define([ updateMetadata(shjson); var newInner = JSON.parse(shjson); + var newSInner; if (newInner.length > 2) { - var newSInner = stringify(newInner[2]); + newSInner = stringify(newInner[2]); } // build a dom from HJSON, diff, and patch the editor @@ -535,7 +536,7 @@ define([ // Notify only when the content has changed, not when someone has joined/left var oldSInner = stringify(JSON.parse(oldShjson)[2]); - if (newSInner !== oldSInner) { + if (newSInner && newSInner !== oldSInner) { notify(); } }; diff --git a/www/poll/index.html b/www/poll/index.html index 1b03b54a7..64d47c816 100644 --- a/www/poll/index.html +++ b/www/poll/index.html @@ -32,8 +32,6 @@ } .realtime { display: block; - overflow: auto; - max-height: 100%; max-width: 100%; } diff --git a/www/poll/main.js b/www/poll/main.js index 49e7fa542..3a39da091 100644 --- a/www/poll/main.js +++ b/www/poll/main.js @@ -192,6 +192,20 @@ define([ } }; + var unnotify = function () { + if (APP.tabNotification && + typeof(APP.tabNotification.cancel) === 'function') { + APP.tabNotification.cancel(); + } + }; + + var notify = function () { + if (Visible.isSupported() && !Visible.currently()) { + unnotify(); + APP.tabNotification = Notify.tab(1000, 10); + } + }; + /* Any time the realtime object changes, call this function */ var change = function (o, n, path, throttle) { if (path && !Cryptpad.isArray(path)) { @@ -402,20 +416,6 @@ define([ }); }; - var unnotify = function () { - if (APP.tabNotification && - typeof(APP.tabNotification.cancel) === 'function') { - APP.tabNotification.cancel(); - } - }; - - var notify = function () { - if (Visible.isSupported() && !Visible.currently()) { - unnotify(); - APP.tabNotification = Notify.tab(1000, 10); - } - }; - var userData = APP.userData = {}; // List of pretty names for all users (mapped with their ID) var userList; // List of users still connected to the channel (server IDs) var addToUserData = function(data) { diff --git a/www/slide/main.js b/www/slide/main.js index 4de77868e..e8ef4651b 100644 --- a/www/slide/main.js +++ b/www/slide/main.js @@ -766,7 +766,7 @@ define([ } Slide.update(remoteDoc); - if (oldDoc !== newDoc) { + if (oldDoc !== remoteDoc) { notify(); } }; diff --git a/www/slide/slide.js b/www/slide/slide.js index 501415cad..5fc279d59 100644 --- a/www/slide/slide.js +++ b/www/slide/slide.js @@ -212,19 +212,19 @@ define([ }, 1000); }); $modal.find('#button_exit').click(function (e) { - var e = jQuery.Event("keyup"); - e.which = 27; - $modal.trigger(e); + var ev = $.Event("keyup"); + ev.which = 27; + $modal.trigger(ev); }); $modal.find('#button_left').click(function (e) { - var e = jQuery.Event("keyup"); - e.which = 37; - $modal.trigger(e); + var ev = $.Event("keyup"); + ev.which = 37; + $modal.trigger(ev); }); $modal.find('#button_right').click(function (e) { - var e = jQuery.Event("keyup"); - e.which = 39; - $modal.trigger(e); + var ev = $.Event("keyup"); + ev.which = 39; + $modal.trigger(ev); }); $(ifrw).on('keyup', function (e) {