mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
Merge pull request #264 from matthojo/Login-Cursor
Automatically focus on first login input
This commit is contained in:
commit
6e4755c183
@ -1,6 +1,7 @@
|
||||
// # Temporary Admin UI
|
||||
|
||||
/*global window, document, $ */
|
||||
/*global window, document, _, $ */
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
@ -18,14 +19,23 @@
|
||||
return (obj.textContent || obj.innerText || $(obj).text() || "") === meta[3];
|
||||
};
|
||||
|
||||
// Called on Window resize
|
||||
$(window).resize(function () {
|
||||
var positionCenter = _.debounce(function (e) {
|
||||
|
||||
var loginContainer = $(".js-login-container"),
|
||||
marginTop = Math.floor((loginContainer.parent().height() - loginContainer.height()) / 2) - 15;
|
||||
loginContainer.css('margin-top', marginTop).delay(250).fadeIn(750);
|
||||
var loginContainer = $(".js-login-container"),
|
||||
marginTop = Math.floor((loginContainer.parent().height() - loginContainer.height()) / 2) - 15;
|
||||
loginContainer.animate({'margin-top': marginTop}, 200);
|
||||
$(window).trigger('centered');
|
||||
|
||||
});
|
||||
}, 100); // Maximum run of once per 100 milliseconds
|
||||
|
||||
function fadeInAndFocus() {
|
||||
$(".js-login-container").fadeIn(750, function () {
|
||||
$("[name='email']").focus();
|
||||
});
|
||||
}
|
||||
|
||||
$(window).on('resize', positionCenter);
|
||||
$(window).one('centered', fadeInAndFocus);
|
||||
|
||||
// Allow notifications to be dismissed
|
||||
$(document).on('click', '.js-notification .close', function () {
|
||||
@ -47,8 +57,8 @@
|
||||
});
|
||||
|
||||
// LOGIN SCREEN
|
||||
$(window).trigger('resize');
|
||||
|
||||
$(window).resize();
|
||||
|
||||
// EDITOR / NOTIFICATIONS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user