diff --git a/customize.dist/main.css b/customize.dist/main.css index 026649207..d54ec6a98 100644 --- a/customize.dist/main.css +++ b/customize.dist/main.css @@ -388,6 +388,11 @@ right: 0; text-align: center; } +@media screen and (max-height: 600px) { + .cp #loadingTip { + display: none; + } +} .cp #loadingTip span { background-color: #302B28; color: #fafafa; diff --git a/customize.dist/main.js b/customize.dist/main.js index cdaeedfdb..088e1f51a 100644 --- a/customize.dist/main.js +++ b/customize.dist/main.js @@ -119,54 +119,57 @@ define([ }); $('button.login').click(function () { - Cryptpad.addLoadingScreen(Messages.login_hashing); - // We need a setTimeout(cb, 0) otherwise the loading screen is only displayed after hashing the password + // setTimeout 100ms to remove the keyboard on mobile devices before the loading screen pops up window.setTimeout(function () { - loginReady(function () { - var uname = $uname.val(); - var passwd = $passwd.val(); - Login.loginOrRegister(uname, passwd, false, function (err, result) { - if (!err) { - var proxy = result.proxy; - - // successful validation and user already exists - // set user hash in localStorage and redirect to drive - if (proxy && !proxy.login_name) { - proxy.login_name = result.userName; - } - - proxy.edPrivate = result.edPrivate; - proxy.edPublic = result.edPublic; - - Cryptpad.whenRealtimeSyncs(result.realtime, function () { - Cryptpad.login(result.userHash, result.userName, function () { - document.location.href = '/drive/'; - }); - }); - return; - } - switch (err) { - case 'NO_SUCH_USER': - Cryptpad.removeLoadingScreen(function () { - Cryptpad.alert(Messages.login_noSuchUser); - }); - break; - case 'INVAL_USER': - Cryptpad.removeLoadingScreen(function () { - Cryptpad.alert(Messages.login_invalUser); + Cryptpad.addLoadingScreen(Messages.login_hashing); + // We need a setTimeout(cb, 0) otherwise the loading screen is only displayed after hashing the password + window.setTimeout(function () { + loginReady(function () { + var uname = $uname.val(); + var passwd = $passwd.val(); + Login.loginOrRegister(uname, passwd, false, function (err, result) { + if (!err) { + var proxy = result.proxy; + + // successful validation and user already exists + // set user hash in localStorage and redirect to drive + if (proxy && !proxy.login_name) { + proxy.login_name = result.userName; + } + + proxy.edPrivate = result.edPrivate; + proxy.edPublic = result.edPublic; + + Cryptpad.whenRealtimeSyncs(result.realtime, function () { + Cryptpad.login(result.userHash, result.userName, function () { + document.location.href = '/drive/'; + }); }); - break; - case 'INVAL_PASS': - Cryptpad.removeLoadingScreen(function () { - Cryptpad.alert(Messages.login_invalPass); - }); - break; - default: // UNHANDLED ERROR - Cryptpad.errorLoadingScreen(Messages.login_unhandledError); - } + return; + } + switch (err) { + case 'NO_SUCH_USER': + Cryptpad.removeLoadingScreen(function () { + Cryptpad.alert(Messages.login_noSuchUser); + }); + break; + case 'INVAL_USER': + Cryptpad.removeLoadingScreen(function () { + Cryptpad.alert(Messages.login_invalUser); + }); + break; + case 'INVAL_PASS': + Cryptpad.removeLoadingScreen(function () { + Cryptpad.alert(Messages.login_invalPass); + }); + break; + default: // UNHANDLED ERROR + Cryptpad.errorLoadingScreen(Messages.login_unhandledError); + } + }); }); - }); - }, 0); + }, 0); + }, 100); }); /* End Log in UI */ diff --git a/customize.dist/src/less/loading.less b/customize.dist/src/less/loading.less index b48045622..6dcf2491a 100644 --- a/customize.dist/src/less/loading.less +++ b/customize.dist/src/less/loading.less @@ -36,6 +36,9 @@ left: 0; right: 0; text-align: center; + @media screen and (max-height: @media-medium-screen) { + display: none; + } span { background-color: @bg-loading; color: @color-loading; diff --git a/www/drive/main.js b/www/drive/main.js index 97a48d79d..d4ac6cce2 100644 --- a/www/drive/main.js +++ b/www/drive/main.js @@ -770,6 +770,7 @@ define([ var displayMenu = function (e, $menu) { $menu.css({ display: "block" }); + if (APP.mobile()) { return; } var h = $menu.outerHeight(); var w = $menu.outerWidth(); var wH = window.innerHeight; @@ -1792,7 +1793,7 @@ define([ module.resetTree(); // in history mode we want to focus the version number input - if (!history.isHistoryMode) { $tree.find('#searchInput').focus(); } + if (!history.isHistoryMode && !APP.mobile()) { $tree.find('#searchInput').focus(); } $tree.find('#searchInput')[0].selectionStart = getSearchCursor(); $tree.find('#searchInput')[0].selectionEnd = getSearchCursor(); @@ -2066,6 +2067,7 @@ define([ if (!filesOp.comparePath(newLocation, currentPath.slice())) { displayDirectory(newLocation); } return; } + if (APP.mobile()) { return; } search.to = window.setTimeout(function () { if (!isInSearchTmp) { search.oldLocation = currentPath.slice(); } var newLocation = [SEARCH, $input.val()]; diff --git a/www/login/main.js b/www/login/main.js index 973cd985f..7a677cebb 100644 --- a/www/login/main.js +++ b/www/login/main.js @@ -57,65 +57,68 @@ define([ }); $('button.login').click(function () { - Cryptpad.addLoadingScreen(Messages.login_hashing); - // We need a setTimeout(cb, 0) otherwise the loading screen is only displayed after hashing the password + // setTimeout 100ms to remove the keyboard on mobile devices before the loading screen pops up window.setTimeout(function () { - loginReady(function () { - var uname = $uname.val(); - var passwd = $passwd.val(); - Login.loginOrRegister(uname, passwd, false, function (err, result) { - if (!err) { - var proxy = result.proxy; + Cryptpad.addLoadingScreen(Messages.login_hashing); + // We need a setTimeout(cb, 0) otherwise the loading screen is only displayed after hashing the password + window.setTimeout(function () { + loginReady(function () { + var uname = $uname.val(); + var passwd = $passwd.val(); + Login.loginOrRegister(uname, passwd, false, function (err, result) { + if (!err) { + var proxy = result.proxy; - // successful validation and user already exists - // set user hash in localStorage and redirect to drive - if (!proxy.login_name) { - result.proxy.login_name = result.userName; - } + // successful validation and user already exists + // set user hash in localStorage and redirect to drive + if (!proxy.login_name) { + result.proxy.login_name = result.userName; + } - proxy.edPrivate = result.edPrivate; - proxy.edPublic = result.edPublic; + proxy.edPrivate = result.edPrivate; + proxy.edPublic = result.edPublic; - Cryptpad.feedback('LOGIN', true); - Cryptpad.whenRealtimeSyncs(result.realtime, function() { - Cryptpad.login(result.userHash, result.userName, function () { - if (sessionStorage.redirectTo) { - var h = sessionStorage.redirectTo; - var parser = document.createElement('a'); - parser.href = h; - if (parser.origin === window.location.origin) { - delete sessionStorage.redirectTo; - window.location.href = h; - return; + Cryptpad.feedback('LOGIN', true); + Cryptpad.whenRealtimeSyncs(result.realtime, function() { + Cryptpad.login(result.userHash, result.userName, function () { + if (sessionStorage.redirectTo) { + var h = sessionStorage.redirectTo; + var parser = document.createElement('a'); + parser.href = h; + if (parser.origin === window.location.origin) { + delete sessionStorage.redirectTo; + window.location.href = h; + return; + } } - } - window.location.href = '/drive/'; - }); - }); - return; - } - switch (err) { - case 'NO_SUCH_USER': - Cryptpad.removeLoadingScreen(function () { - Cryptpad.alert(Messages.login_noSuchUser); - }); - break; - case 'INVAL_USER': - Cryptpad.removeLoadingScreen(function () { - Cryptpad.alert(Messages.login_invalUser); + window.location.href = '/drive/'; + }); }); - break; - case 'INVAL_PASS': - Cryptpad.removeLoadingScreen(function () { - Cryptpad.alert(Messages.login_invalPass); - }); - break; - default: // UNHANDLED ERROR - Cryptpad.errorLoadingScreen(Messages.login_unhandledError); - } + return; + } + switch (err) { + case 'NO_SUCH_USER': + Cryptpad.removeLoadingScreen(function () { + Cryptpad.alert(Messages.login_noSuchUser); + }); + break; + case 'INVAL_USER': + Cryptpad.removeLoadingScreen(function () { + Cryptpad.alert(Messages.login_invalUser); + }); + break; + case 'INVAL_PASS': + Cryptpad.removeLoadingScreen(function () { + Cryptpad.alert(Messages.login_invalPass); + }); + break; + default: // UNHANDLED ERROR + Cryptpad.errorLoadingScreen(Messages.login_unhandledError); + } + }); }); - }); - }, 0); + }, 0); + }, 100); }); }); }); diff --git a/www/register/main.js b/www/register/main.js index 6e97e2a93..bafe55423 100644 --- a/www/register/main.js +++ b/www/register/main.js @@ -101,57 +101,63 @@ define([ function (yes) { if (!yes) { return; } - Cryptpad.addLoadingScreen(Messages.login_hashing); - Login.loginOrRegister(uname, passwd, true, function (err, result) { - var proxy = result.proxy; - - if (err) { - switch (err) { - case 'NO_SUCH_USER': - Cryptpad.removeLoadingScreen(function () { - Cryptpad.alert(Messages.login_noSuchUser); - }); - break; - case 'INVAL_USER': - Cryptpad.removeLoadingScreen(function () { - Cryptpad.alert(Messages.login_invalUser); - }); - break; - case 'INVAL_PASS': - Cryptpad.removeLoadingScreen(function () { - Cryptpad.alert(Messages.login_invalPass); - }); - break; - case 'ALREADY_REGISTERED': - Cryptpad.removeLoadingScreen(function () { - Cryptpad.confirm(Messages.register_alreadyRegistered, function (yes) { - if (!yes) { return; } - proxy.login_name = uname; - - if (!proxy[Cryptpad.displayNameKey]) { - proxy[Cryptpad.displayNameKey] = uname; - } - Cryptpad.eraseTempSessionValues(); - logMeIn(result); - }); - }); - break; - default: // UNHANDLED ERROR - Cryptpad.errorLoadingScreen(Messages.login_unhandledError); - } - return; - } - Cryptpad.eraseTempSessionValues(); - if (shouldImport) { - sessionStorage.migrateAnonDrive = 1; - } - - proxy.login_name = uname; - proxy[Cryptpad.displayNameKey] = uname; - sessionStorage.createReadme = 1; - - logMeIn(result); - }); + // setTimeout 100ms to remove the keyboard on mobile devices before the loading screen pops up + window.setTimeout(function () { + Cryptpad.addLoadingScreen(Messages.login_hashing); + // We need a setTimeout(cb, 0) otherwise the loading screen is only displayed after hashing the password + window.setTimeout(function () { + Login.loginOrRegister(uname, passwd, true, function (err, result) { + var proxy = result.proxy; + + if (err) { + switch (err) { + case 'NO_SUCH_USER': + Cryptpad.removeLoadingScreen(function () { + Cryptpad.alert(Messages.login_noSuchUser); + }); + break; + case 'INVAL_USER': + Cryptpad.removeLoadingScreen(function () { + Cryptpad.alert(Messages.login_invalUser); + }); + break; + case 'INVAL_PASS': + Cryptpad.removeLoadingScreen(function () { + Cryptpad.alert(Messages.login_invalPass); + }); + break; + case 'ALREADY_REGISTERED': + Cryptpad.removeLoadingScreen(function () { + Cryptpad.confirm(Messages.register_alreadyRegistered, function (yes) { + if (!yes) { return; } + proxy.login_name = uname; + + if (!proxy[Cryptpad.displayNameKey]) { + proxy[Cryptpad.displayNameKey] = uname; + } + Cryptpad.eraseTempSessionValues(); + logMeIn(result); + }); + }); + break; + default: // UNHANDLED ERROR + Cryptpad.errorLoadingScreen(Messages.login_unhandledError); + } + return; + } + Cryptpad.eraseTempSessionValues(); + if (shouldImport) { + sessionStorage.migrateAnonDrive = 1; + } + + proxy.login_name = uname; + proxy[Cryptpad.displayNameKey] = uname; + sessionStorage.createReadme = 1; + + logMeIn(result); + }); + }, 0); + }, 100); }, { ok: Messages.register_writtenPassword, cancel: Messages.register_cancel,