mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Merge branch 'MDL-57488-master' of git://github.com/danpoltawski/moodle
This commit is contained in:
commit
d7cee87d24
4 changed files with 26 additions and 42 deletions
|
@ -812,42 +812,21 @@ M.util.get_string = function(identifier, component, a) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set focus on username or password field of the login form
|
* Set focus on username or password field of the login form.
|
||||||
|
* @deprecated since Moodle 3.3.
|
||||||
*/
|
*/
|
||||||
M.util.focus_login_form = function(Y) {
|
M.util.focus_login_form = function(Y) {
|
||||||
var username = Y.one('#username');
|
Y.log('M.util.focus_login_form no longer does anything. Please use jquery instead.', 'warn', 'javascript-static.js');
|
||||||
var password = Y.one('#password');
|
};
|
||||||
|
|
||||||
if (username == null || password == null) {
|
|
||||||
// something is wrong here
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var curElement = document.activeElement
|
|
||||||
if (curElement == 'undefined') {
|
|
||||||
// legacy browser - skip refocus protection
|
|
||||||
} else if (curElement.tagName == 'INPUT') {
|
|
||||||
// user was probably faster to focus something, do not mess with focus
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (username.get('value') == '') {
|
|
||||||
username.focus();
|
|
||||||
} else {
|
|
||||||
password.focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set focus on login error message
|
* Set focus on login error message.
|
||||||
|
* @deprecated since Moodle 3.3.
|
||||||
*/
|
*/
|
||||||
M.util.focus_login_error = function(Y) {
|
M.util.focus_login_error = function(Y) {
|
||||||
var errorlog = Y.one('#loginerrormessage');
|
Y.log('M.util.focus_login_error no longer does anything. Please use jquery instead.', 'warn', 'javascript-static.js');
|
||||||
|
};
|
||||||
|
|
||||||
if (errorlog) {
|
|
||||||
errorlog.focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Adds lightbox hidden element that covers the whole node.
|
* Adds lightbox hidden element that covers the whole node.
|
||||||
*
|
*
|
||||||
|
|
|
@ -162,18 +162,20 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#js}}
|
{{#js}}
|
||||||
require(['jquery', 'core/yui'], function($, Y) {
|
|
||||||
{{#error}}
|
{{#error}}
|
||||||
$(function() {
|
require(['jquery'], function($) {
|
||||||
M.util.focus_login_error(Y);
|
$('#loginerrormessage').focus();
|
||||||
});
|
});
|
||||||
{{/error}}
|
{{/error}}
|
||||||
{{^error}}
|
{{^error}}
|
||||||
{{#autofocusform}}
|
{{#autofocusform}}
|
||||||
$(function() {
|
require(['jquery'], function($) {
|
||||||
M.util.focus_login_form(Y);
|
if ($('#username').val()) {
|
||||||
|
$('#password').focus();
|
||||||
|
} else {
|
||||||
|
$('#username').focus();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
{{/autofocusform}}
|
{{/autofocusform}}
|
||||||
{{/error}}
|
{{/error}}
|
||||||
});
|
|
||||||
{{/js}}
|
{{/js}}
|
||||||
|
|
|
@ -8,6 +8,8 @@ information provided here is intended especially for developers.
|
||||||
* $mform->init_javascript_enhancement() is deprecated and no longer does anything. Existing uses of smartselect enhancement
|
* $mform->init_javascript_enhancement() is deprecated and no longer does anything. Existing uses of smartselect enhancement
|
||||||
should be switched to the searchableselector form element or other solutions.
|
should be switched to the searchableselector form element or other solutions.
|
||||||
* Return value of the validate_email() is now proper boolean as documented. Previously the function could return 1, 0 or false.
|
* Return value of the validate_email() is now proper boolean as documented. Previously the function could return 1, 0 or false.
|
||||||
|
* M.util.focus_login_form and M.util.focus_login_error no longer do anything. Please use jquery instead. See
|
||||||
|
lib/templates/login.mustache for an example.
|
||||||
|
|
||||||
=== 3.2 ===
|
=== 3.2 ===
|
||||||
|
|
||||||
|
|
|
@ -216,20 +216,21 @@
|
||||||
</div>
|
</div>
|
||||||
{{/hasinstructions}}
|
{{/hasinstructions}}
|
||||||
|
|
||||||
|
|
||||||
{{#js}}
|
{{#js}}
|
||||||
require(['jquery', 'core/yui'], function($, Y) {
|
|
||||||
{{#error}}
|
{{#error}}
|
||||||
$(function() {
|
require(['jquery'], function($) {
|
||||||
M.util.focus_login_error(Y);
|
$('#loginerrormessage').focus();
|
||||||
});
|
});
|
||||||
{{/error}}
|
{{/error}}
|
||||||
{{^error}}
|
{{^error}}
|
||||||
{{#autofocusform}}
|
{{#autofocusform}}
|
||||||
$(function() {
|
require(['jquery'], function($) {
|
||||||
M.util.focus_login_form(Y);
|
if ($('#username').val()) {
|
||||||
|
$('#password').focus();
|
||||||
|
} else {
|
||||||
|
$('#username').focus();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
{{/autofocusform}}
|
{{/autofocusform}}
|
||||||
{{/error}}
|
{{/error}}
|
||||||
})
|
|
||||||
{{/js}}
|
{{/js}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue