From e27086410672d7c4efe37aac0505007fe26d6e8b Mon Sep 17 00:00:00 2001
From: mcramer <m.cramer@pixcept.de>
Date: Wed, 29 Aug 2012 07:35:16 -0400
Subject: [PATCH] Fixed: onClick attributes changed to valid onclick (lower case) Fixed: password match function blocked tabs incorrectly Fixed: set focus on username input field threw an error if this field did not exist on a page

---
 interface/web/js/scrigo.js.php |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/interface/web/js/scrigo.js.php b/interface/web/js/scrigo.js.php
index 4146127..6be0225 100644
--- a/interface/web/js/scrigo.js.php
+++ b/interface/web/js/scrigo.js.php
@@ -269,7 +269,7 @@
 
 function setFocus() {
 	try {
-		document.pageForm.username.focus();
+		jQuery('form#pageForm').find('input[name="username"]').focus();
 	} catch (e) {
 	}
 }
@@ -601,6 +601,8 @@
 	newPWField.attr('id', passwordFieldID).val(pword).trigger('keyup');
 }
 
+var funcDisableClick = function(e) { e.preventDefault(); return false; };
+
 function checkPassMatch(pwField1,pwField2){
     var rpass = jQuery('#'+pwField2).val();
     var npass = jQuery('#'+pwField1).val();
@@ -608,13 +610,22 @@
 		jQuery('#confirmpasswordOK').hide();
         jQuery('#confirmpasswordError').show();
 		jQuery('button.positive').attr('disabled','disabled');
-		jQuery('.tabbox_tabs ul li a').attr('onclick','return false;');
+        jQuery('.tabbox_tabs ul li a').each(function() {
+            var $this = $(this);
+            $this.data('saved_onclick', $this.attr('onclick'));
+            $this.removeAttr('onclick');
+            $this.click(funcDisableClick);
+        });
         return false;
     } else {
 		jQuery('#confirmpasswordError').hide();
         jQuery('#confirmpasswordOK').show();
 		jQuery('button.positive').removeAttr('disabled');
-		jQuery('.tabbox_tabs ul li a').removeAttr('onclick');
+		jQuery('.tabbox_tabs ul li a').each(function() {
+            var $this = $(this);
+            $this.unbind('click', funcDisableClick);
+            if($this.data('saved_onclick') && !$this.attr('onclick')) $this.attr('onclick', $this.data('saved_onclick'));
+        });
     }
 }
 

--
Gitblit v1.9.1