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/main.js b/www/poll/main.js index 10a25e01d..49835a13a 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) {