From 47203c37f184f37936eaf58c5ea64204eb66b7e8 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 12 Jan 2018 17:44:56 +0100 Subject: [PATCH 1/4] Remove console error caused by setTimeout called with undefined --- www/common/common-interface.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/www/common/common-interface.js b/www/common/common-interface.js index f45d44380..14cb3e53a 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -496,6 +496,7 @@ define([ UI.removeLoadingScreen = function (cb) { // Release the test blocker, hopefully every test has been registered. // This test is created in sframe-boot2.js + cb = cb || function () {}; if (Test.__ASYNC_BLOCKER__) { Test.__ASYNC_BLOCKER__.pass(); } $('#' + LOADING).addClass("cp-loading-hidden"); @@ -508,9 +509,9 @@ define([ 'opacity': 0, 'pointer-events': 'none', }); - setTimeout(function () { - $tip.remove(); - }, 3750); + window.setTimeout(function () { + $tip.remove(); + }, 3750); // jquery.fadeout can get stuck }; UI.errorLoadingScreen = function (error, transparent) { From 8ced81d8d74ce46508cfdeee294744be88406895 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 12 Jan 2018 17:45:52 +0100 Subject: [PATCH 2/4] lint compliance --- customize.dist/pages.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/customize.dist/pages.js b/customize.dist/pages.js index 6906de889..02757c711 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -377,7 +377,7 @@ define([ var isAvailableType = function (x) { if (!Array.isArray(AppConfig.availablePadTypes)) { return true; } - return AppConfig.availablePadTypes.some(function (type, i) { + return AppConfig.availablePadTypes.some(function (type) { return x.indexOf(type) > -1; }); }; From a5b75e016469fe65aa4745aa4abe6b9269a96c44 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 12 Jan 2018 18:15:06 +0100 Subject: [PATCH 3/4] Fix default config for anynymous drive --- customize.dist/application_config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/customize.dist/application_config.js b/customize.dist/application_config.js index f7790ad66..2320bf9af 100644 --- a/customize.dist/application_config.js +++ b/customize.dist/application_config.js @@ -68,7 +68,7 @@ define(function() { config.displayCreationScreen = false; - config.disableAnonymousStore = true; + config.disableAnonymousStore = false; return config; }); From f3d8fd359046af1684d33cbb3b57e0447e55cae6 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 12 Jan 2018 18:17:32 +0100 Subject: [PATCH 4/4] Ability to import local pads on login --- customize.dist/pages.js | 13 +++++++++++++ www/login/main.js | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/customize.dist/pages.js b/customize.dist/pages.js index 02757c711..f120beef1 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -570,6 +570,19 @@ define([ 'name': 'password', placeholder: Msg.login_password, }), + h('div.checkbox-container', [ + h('input#import-recent', { + name: 'import-recent', + type: 'checkbox', + checked: true + }), + // hscript doesn't generate for on label for some + // reason... use jquery as a temporary fallback + setHTML($('')[0], Msg.register_importRecent) + /*h('label', { + 'for': 'import-recent', + }, Msg.register_importRecent),*/ + ]), h('div.extra', [ h('button.login.first.btn', Msg.login_login) ]) diff --git a/www/login/main.js b/www/login/main.js index 408203d9b..f6a9cebb6 100644 --- a/www/login/main.js +++ b/www/login/main.js @@ -12,6 +12,7 @@ define([ ], function ($, Cryptpad, Login, UI, Realtime, Feedback, LocalStore, Test) { $(function () { var $main = $('#mainBlock'); + var $checkImport = $('#import-recent'); var Messages = Cryptpad.Messages; // main block is hidden in case javascript is disabled @@ -59,6 +60,7 @@ define([ if (hashing) { return void console.log("hashing is already in progress"); } hashing = true; + var shouldImport = $checkImport[0].checked; // setTimeout 100ms to remove the keyboard on mobile devices before the loading screen pops up window.setTimeout(function () { @@ -96,6 +98,9 @@ define([ test.pass(); return; } + if (shouldImport) { + sessionStorage.migrateAnonDrive = 1; + } if (sessionStorage.redirectTo) { var h = sessionStorage.redirectTo; var parser = document.createElement('a');