mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-30 02:59:29 +02:00
Merge remote-tracking branch 'remotes/cyberalien/ticket/11556' into develop
# By Vjacheslav Trushkin # Via Vjacheslav Trushkin * remotes/cyberalien/ticket/11556: [ticket/11556] Load apply_onkeypress_event() correctly [ticket/11556] Remove fallback JS
This commit is contained in:
commit
ee89a706f9
@ -364,41 +364,24 @@ function submit_default_button(event, selector, class_name) {
|
||||
* The non-jQuery code is a mimick of the jQuery code ;)
|
||||
*/
|
||||
function apply_onkeypress_event() {
|
||||
// jQuery code in case jQuery is used
|
||||
if (jquery_present) {
|
||||
jQuery('form input[type=text], form input[type=password]').live('keypress', function (e) {
|
||||
var default_button = jQuery(this).parents('form').find('input[type=submit].default-submit-action');
|
||||
|
||||
if (!default_button || default_button.length <= 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (phpbb_check_key(e)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((e.which && e.which === 13) || (e.keyCode && e.keyCode === 13)) {
|
||||
default_button.click();
|
||||
return false;
|
||||
}
|
||||
jQuery('form input[type=text], form input[type=password]').live('keypress', function (e) {
|
||||
var default_button = jQuery(this).parents('form').find('input[type=submit].default-submit-action');
|
||||
|
||||
if (!default_button || default_button.length <= 0) {
|
||||
return true;
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var input_tags = document.getElementsByTagName('input');
|
||||
|
||||
for (var i = 0, element = input_tags[0]; i < input_tags.length ; element = input_tags[++i]) {
|
||||
if (element.type === 'text' || element.type === 'password') {
|
||||
// onkeydown is possible too
|
||||
element.onkeypress = function (evt) { submit_default_button((evt || window.event), this, 'default-submit-action'); };
|
||||
}
|
||||
}
|
||||
|
||||
if (phpbb_check_key(e)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((e.which && e.which === 13) || (e.keyCode && e.keyCode === 13)) {
|
||||
default_button.click();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect JQuery existance. We currently do not deliver it, but some styles do, so why not benefit from it. ;)
|
||||
*/
|
||||
var jquery_present = typeof jQuery === 'function';
|
||||
jQuery(document).ready(apply_onkeypress_event);
|
||||
|
@ -1,9 +1,3 @@
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
onload_functions.push(apply_onkeypress_event);
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
<fieldset class="fields1">
|
||||
<!-- IF ERROR --><p class="error">{ERROR}</p><!-- ENDIF -->
|
||||
|
||||
|
@ -10,11 +10,6 @@
|
||||
document.forms['register'].change_lang.value = lang_iso;
|
||||
document.forms['register'].submit.click();
|
||||
}
|
||||
|
||||
<!-- IF CAPTCHA_TEMPLATE and S_CONFIRM_REFRESH -->
|
||||
onload_functions.push(apply_onkeypress_event);
|
||||
<!-- ENDIF -->
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user