Added fuctionality of form submit by enter key in Wikidata Login dialogue
This commit is contained in:
parent
3911636f0d
commit
cfc962668c
@ -48,7 +48,7 @@ ManageAccountDialog.display = function(logged_in_username, saved_credentials, ca
|
||||
elmts.loggedInUsername
|
||||
.text(logged_in_username)
|
||||
.attr('href', 'https://www.wikidata.org/wiki/User:'+logged_in_username);
|
||||
|
||||
|
||||
frame.find('.cancel-button').click(function() {
|
||||
dismiss();
|
||||
callback(null);
|
||||
@ -70,6 +70,25 @@ ManageAccountDialog.display = function(logged_in_username, saved_credentials, ca
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
document.addEventListener('keydown', function(event) {
|
||||
if (event.keyCode == 13) {
|
||||
frame.hide();
|
||||
Refine.postCSRF(
|
||||
"command/wikidata/login",
|
||||
elmts.loginForm.serialize(),
|
||||
function(data) {
|
||||
if (data.logged_in) {
|
||||
dismiss();
|
||||
callback(data.username);
|
||||
} else {
|
||||
frame.show();
|
||||
elmts.invalidCredentials.text("Invalid credentials.");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
elmts.logoutButton.click(function() {
|
||||
Refine.postCSRF(
|
||||
"command/wikidata/login",
|
||||
@ -79,7 +98,7 @@ ManageAccountDialog.display = function(logged_in_username, saved_credentials, ca
|
||||
dismiss();
|
||||
callback(null);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@ -95,7 +114,7 @@ ManageAccountDialog.isLoggedIn = function(callback) {
|
||||
ManageAccountDialog.firstLogin = false;
|
||||
callback(data.username);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
ManageAccountDialog.ensureLoggedIn = function(callback) {
|
||||
ManageAccountDialog.isLoggedIn(function(logged_in_username) {
|
||||
|
Loading…
Reference in New Issue
Block a user