From c77abfa7f4909ffe50242cf8d4b8f56eb79f902a Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 23 Jan 2017 11:05:03 +0100 Subject: [PATCH 1/3] Remove a second scrollbar in polls --- www/poll/index.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/www/poll/index.html b/www/poll/index.html index deac65f77..ab78be2f5 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%; } From 015e6fc26258c54d9e26d4b1052b11515493e903 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 24 Jan 2017 18:17:23 +0100 Subject: [PATCH 2/3] Make sure we have the same hash in all the tabs when disconnecting --- www/common/cryptpad-common.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 9ae31a238..0de076e17 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(); } }; From 373b07ed28913470fa84fe29c556e1e072982a2f Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 25 Jan 2017 10:21:31 +0100 Subject: [PATCH 3/3] Fix lint errors --- www/common/toolbar.js | 14 +++++++------- www/pad/main.js | 5 +++-- www/poll/main.js | 28 ++++++++++++++-------------- www/slide/main.js | 2 +- www/slide/slide.js | 18 +++++++++--------- 5 files changed, 34 insertions(+), 33 deletions(-) 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) {