Committer: pkornilov
LJSUP-8014: Credit card payment process refactoringU trunk/htdocs/js/pay.js
Modified: trunk/htdocs/js/pay.js =================================================================== --- trunk/htdocs/js/pay.js 2011-03-11 08:13:22 UTC (rev 10227) +++ trunk/htdocs/js/pay.js 2011-03-14 05:19:20 UTC (rev 10228) @@ -382,25 +382,49 @@ jQuery('dd>input, dd>select', this) .focus(function() { - var selector = '.b-bubble-lite:not(.b-bubble-other)'; + var selector = '.b-bubble-lite:not(.b-bubble-other)', + input = jQuery(this); if (this.name === 'state_other') { selector = '.b-bubble-other'; } - jQuery(this).closest('li') - .find('.b-bubble-warning').hide() - .end().find(selector).show(); + input.data('is_focus', true); + + var container = input.closest('li'), + help_bubble = container.find(selector); + + container.find('.b-bubble-warning').hide(); + help_bubble.show(); + + // for click to link in bubble + help_bubble.hover( + function(){ + input.data('is_hover', true); + }, + function(){ + if (!input.data('is_focus')) { + input.closest('li') + .find('.b-bubble-lite').hide() + .end().find('.b-bubble-warning').show(); + } + input.data('is_hover', false); + }); }) .blur(function() { - jQuery(this).closest('li') - .find('.b-bubble-lite').hide() - .end().find('.b-bubble-warning').show(); + var input = jQuery(this); + if (!input.data('is_hover')) { + input.closest('li') + .find('.b-bubble-lite').hide() + .end().find('.b-bubble-warning').show(); + } + input.data('is_focus', false); }); jQuery([this.name_full, this.email]).input(function() { - if (/[^a-z0-9@'. \-]/i.test(this.value)) { + // keyboard no English + if (/[^a-z0-9!@#$%\^&*()_+\-=,.\/<>?;'\\\[\] ]/i.test(this.value)) { jQuery(this).closest('li') .find('.b-bubble-lite').hide() .end().find('.b-bubble-alert').show();