Палсеич— (lusever) wrote in changelog,
Палсеич—
lusever
changelog

[ljcom] r10189: LJSUP-8014: Credit card payment process ...

Committer: pkornilov
LJSUP-8014: Credit card payment process refactoring
U   trunk/htdocs/js/pay.js
Modified: trunk/htdocs/js/pay.js
===================================================================
--- trunk/htdocs/js/pay.js	2011-03-04 10:09:16 UTC (rev 10188)
+++ trunk/htdocs/js/pay.js	2011-03-05 04:43:25 UTC (rev 10189)
@@ -379,14 +379,17 @@
 	{
 		jQuery('form#ccform').each(function()
 		{
-			var form = this;
-			
 			jQuery('dd>input, dd>select', this)
 				.focus(function()
 				{
+					var selector = '.b-bubble-lite:not(.b-bubble-other)';
+					if (this.name === 'state_other') {
+						selector = '.b-bubble-other';
+					}
+					
 					jQuery(this).closest('li')
 						.find('.b-bubble-warning').hide()
-						.end().find('.b-bubble-lite').show();
+						.end().find(selector).show();
 				})
 				.blur(function()
 				{
@@ -397,7 +400,7 @@
 				
 				jQuery([this.name_full, this.email]).input(function()
 				{
-					if (/[^a-z0-9@\'. -]/i.test(this.value)) {
+					if (/[^a-z0-9@'. \-]/i.test(this.value)) {
 						jQuery(this).closest('li')
 							.find('.b-bubble-lite').hide()
 							.end().find('.b-bubble-alert').show();
@@ -412,18 +415,19 @@
 			jQuery(this.type).change(function()
 			{
 				var val = jQuery(this).val(),
-					bubble = $('bubble_cc_num'),
-					bubble_ml;
+					cc_num_ml, cc_cvv2_ml;
 				if (val !== 'AmEx') {
-					bubble_ml = Shop.ml_cardnumber_bubble.replace('%card_type%', val);
+					cc_num_ml = Shop.ml_cc_num.replace('%card_type%', val);
+					cc_cvv2_ml = Shop.ml_cc_cvv2.replace('%card_type%', val);
 					jQuery('#cc_num').attr('maxlength', 16);
 				} else {
-					bubble_ml = Shop.ml_cardnumber_bubble_americanexpress;
+					cc_num_ml = Shop.ml_cc_num_americanexpress;
+					cc_cvv2_ml = Shop.ml_cc_cvv2_americanexpress;
 					jQuery('#cc_num').attr('maxlength', 15);
 				}
 				
-				Shop.ml_cardnumber_bubble
-				bubble.replaceChild(document.createTextNode(bubble_ml), bubble.lastChild);
+				jQuery('#bubble_cc_num>span').html(cc_num_ml);
+				jQuery('#bubble_cc_cvv2>span').html(cc_cvv2_ml);
 			})
 			// init
 			.change();

Tags: js, ljcom, lusever
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments