diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2013-05-20 09:59:28 -0500 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-05-20 09:59:28 -0500 |
commit | ee89a706f9e887f01eb5ee198d7b4a17ace0fecf (patch) | |
tree | 792850ecc11e5e00755876e7d0d535c5eabbbd18 | |
parent | c34118f93ba3c81d3efe21d6585dbc67698aeaaa (diff) | |
parent | c29257f732ce23346e3f85d9a7ee99bff728ca84 (diff) | |
download | forums-ee89a706f9e887f01eb5ee198d7b4a17ace0fecf.tar forums-ee89a706f9e887f01eb5ee198d7b4a17ace0fecf.tar.gz forums-ee89a706f9e887f01eb5ee198d7b4a17ace0fecf.tar.bz2 forums-ee89a706f9e887f01eb5ee198d7b4a17ace0fecf.tar.xz forums-ee89a706f9e887f01eb5ee198d7b4a17ace0fecf.zip |
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
-rw-r--r-- | phpBB/styles/prosilver/template/forum_fn.js | 45 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/posting_editor.html | 6 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/ucp_register.html | 5 |
3 files changed, 14 insertions, 42 deletions
diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 3d05c937da..ef6b7de418 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -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'); + if (phpbb_check_key(e)) { + return true; + } - 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 ((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); diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index 8156968098..83dc6111dd 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -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 --> diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html index db95e5ba13..779c1fc2a3 100644 --- a/phpBB/styles/prosilver/template/ucp_register.html +++ b/phpBB/styles/prosilver/template/ucp_register.html @@ -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> |