aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/styles/prosilver/template/forum_fn.js
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/styles/prosilver/template/forum_fn.js')
-rw-r--r--phpBB/styles/prosilver/template/forum_fn.js45
1 files changed, 13 insertions, 32 deletions
diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js
index 23450d910b..781c2ed31f 100644
--- a/phpBB/styles/prosilver/template/forum_fn.js
+++ b/phpBB/styles/prosilver/template/forum_fn.js
@@ -364,41 +364,22 @@ 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;
}
- }
-}
-/**
-* 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';
+ return true;
+ });
+}