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