forked from odensecentralbibliotek/ddbasic
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathddbasic.login.js
More file actions
26 lines (22 loc) · 874 Bytes
/
ddbasic.login.js
File metadata and controls
26 lines (22 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(function($) {
"use strict";
$(document).ready(function() {
// Focus on username form field when entering login form.
$('#user-login-form #edit-name').focus();
// Focus on username form field when clicking login tab.
$('.topbar-link-user').bind('click', function(event) {
$('#user-login-form #edit-name').focus();
});
// Unfocus login form when user wants to scroll with key buttons (i.e. clicks the up or down button).
$('#user-login-form').bind('keydown', function(event) {
var keymap = {
up: 38,
down: 40
};
// Only unfocus if we press the up or down key.
if (keymap.up == event.which || keymap.down == event.which) {
document.activeElement.blur();
}
});
});
}(jQuery));