Community Support Forums — WordPress® ( Users Helping Users ) — 2011-12-20T09:53:13-05:00 http://www.primothemes.com/forums/feed.php?f=40&t=13396 2011-12-20T09:53:13-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13396&p=58165#p58165 <![CDATA[s2Member v111220 / Source Code: s2member-p...]]>
s2Member v111220
Source Code: s2member-pro\includes\separates\gateways\paypal\paypal.js
Docs updated: December 20, 2011, 9:53 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — December 20th, 2011, 9:53 am


]]>
2011-12-07T01:06:40-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13396&p=55847#p55847 <![CDATA[s2Member v111206 / Source Code: s2member-p...]]>
s2Member v111206
Source Code: s2member-pro\includes\separates\gateways\paypal\paypal.js
Docs updated: December 7, 2011, 1:06 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — December 7th, 2011, 1:06 am


]]>
2011-11-05T19:29:01-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13396&p=52219#p52219 <![CDATA[s2Member v111105 / Source Code: s2member-p...]]>
s2Member v111105
Source Code: s2member-pro\includes\separates\gateways\paypal\paypal.js
Docs updated: November 5, 2011, 8:29 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — November 5th, 2011, 7:29 pm


]]>
2011-10-29T20:38:56-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13396&p=50315#p50315 <![CDATA[s2Member v111029 / Source Code: s2member-p...]]>
s2Member v111029
Source Code: s2member-pro\includes\separates\gateways\paypal\paypal.js
Docs updated: October 29, 2011, 9:39 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 29th, 2011, 8:38 pm


]]>
2011-10-17T15:44:15-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13396&p=48111#p48111 <![CDATA[s2Member v111017 / Source Code: s2member-p...]]>
s2Member v111017
Source Code: s2member-pro\includes\separates\gateways\paypal\paypal.js
Docs updated: October 17, 2011, 1:44 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 17th, 2011, 3:44 pm


]]>
2011-10-11T14:39:15-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13396&p=46512#p46512 <![CDATA[s2Member v111011 / Source Code: s2member-p...]]>
s2Member v111011
Source Code: s2member-pro\includes\separates\gateways\paypal\paypal.js
Docs updated: October 11, 2011, 12:39 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 11th, 2011, 2:39 pm


]]>
2011-10-03T15:51:52-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13396&p=44640#p44640 <![CDATA[s2Member v111003 / Source Code: s2member-p...]]>
s2Member v111003
Source Code: s2member-pro\includes\separates\gateways\paypal\paypal.js
Docs updated: October 3, 2011, 1:51 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 3rd, 2011, 3:51 pm


]]>
2011-10-03T03:45:40-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13396&p=43347#p43347 <![CDATA[s2Member v111002 / Source Code: s2member-p...]]>
s2Member v111002
Source Code: s2member-pro\includes\separates\gateways\paypal\paypal.js
Docs updated: October 3, 2011, 1:45 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 3rd, 2011, 3:45 am


]]>
2011-09-27T05:29:44-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13396&p=41589#p41589 <![CDATA[s2Member v110927 / Source Code: s2member-p...]]>
s2Member v110927
Source Code: s2member-pro\includes\separates\gateways\paypal\paypal.js
Docs updated: September 27, 2011, 3:29 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 27th, 2011, 5:29 am


]]>
2011-09-26T21:06:16-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13396&p=40345#p40345 <![CDATA[s2Member v110926 / Source Code: s2member-p...]]>
s2Member v110926
Source Code: s2member-pro\includes\separates\gateways\paypal\paypal.js
Docs updated: September 26, 2011, 7:06 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 26th, 2011, 9:06 pm


]]>
2011-09-17T17:05:47-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13396&p=38489#p38489 <![CDATA[s2Member v110915 / Source Code: s2member-p...]]>
s2Member v110915
Source Code: s2member-pro\includes\separates\gateways\paypal\paypal.js
Docs updated: September 17, 2011, 3:05 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 17th, 2011, 5:05 pm


]]>
2011-09-14T01:30:40-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13396&p=37067#p37067 <![CDATA[s2Member v110913 / Source Code: s2member-p...]]>
s2Member v110913
Source Code: s2member-pro\includes\separates\gateways\paypal\paypal.js
Docs updated: September 13, 2011, 11:30 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 14th, 2011, 1:30 am


]]>
2011-09-13T12:05:56-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13396&p=35795#p35795 <![CDATA[s2Member v110912 / Source Code: s2member-p...]]>
s2Member v110912
Source Code: s2member-pro\includes\separates\gateways\paypal\paypal.js
Docs updated: September 13, 2011, 10:05 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 13th, 2011, 12:05 pm


]]>
2011-08-15T15:20:05-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13396&p=31903#p31903 <![CDATA[s2Member v110815 / Source Code: s2member-p...]]>
s2Member v110815
Source Code: s2member-pro\includes\separates\gateways\paypal\paypal.js
Docs updated: August 15, 2011, 4:20 pm

Open for public discussion.
(!-- s-words :: --)Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code jQuery(window).load(function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli'+location.hash).addClass('hilite'); }); jQuery(window).bind('hashchange', function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli').removeClass('hilite'); jQuery('olli'+location.hash).addClass('hilite'); }); [ full view ]s2member-pro\includes\separates\gateways\paypal\paypal.js /** * Core JavaScript routines for PayPal®. * * Copyright: © 2009-2011 * {@link http://www.websharks-inc.com/ WebSharks, Inc.} * ( coded in the USA ) * * This WordPress® plugin ( s2Member Pro ) is comprised of two parts: * * o (1) Its PHP code is licensed under the GPL license, as is WordPress®. * You should have received a copy of the GNU General Public License, * along with this software. In the main directory, see: /licensing/ * If not, see: {@link http://www.gnu.org/licenses/}. * * o (2) All other parts of ( s2Member Pro ); including, but not limited to: * the CSS code, some JavaScript code, images, and design; * are licensed according to the license purchased. * See: {@link http://www.s2member.com/prices/} * * Unless you have our prior written consent, you must NOT directly or indirectly license, * sub-license, sell, resell, or provide for free; part (2) of the s2Member Pro Module; * or make an offer to do any of these things. All of these things are strictly * prohibited with part (2) of the s2Member Pro Module. * * Your purchase of s2Member Pro includes free lifetime upgrades via s2Member.com * ( i.e. new features, bug fixes, updates, improvements ); along with full access * to our video tutorial library: {@link http://www.s2member.com/videos/} * * @package s2Member\PayPal * @since 1.5 */ /* Scripting routines handled on document ready state. */ jQuery(document).ready (function($) { var $clForm, $upForm, $rgForm, $spForm, $coForm, jumpToResponses, preloadAjaxLoader, ariaTrue = {'aria-required': 'true'}, ariaFalse = {'aria-required': 'false'}, disabled = {'disabled': 'disabled'}, ariaFalseDis = {'aria-required': 'false', 'disabled': 'disabled'}; /**/ preloadAjaxLoader = new Image (), preloadAjaxLoader.src = '?php echo $vars [ "i" ] ; ?/ajax-loader.gif'; /**/ if (($clForm = $('form#s2member-pro-paypal-cancellation-form')).length === 1) { var captchaSection = 'div#s2member-pro-paypal-cancellation-form-captcha-section', submissionSection = 'div#s2member-pro-paypal-cancellation-form-submission-section', $submissionButton = $(submissionSection + ' input#s2member-pro-paypal-cancellation-submit'); /**/ ws_plugin__s2member_animateProcessing($submissionButton, 'reset'), $submissionButton.removeAttr ('disabled'); /**/ $clForm.submit (function() /* Form validation. */ { var context = this, label = '', error = '', errors = ''; /**/ var $recaptchaResponse = $(captchaSection + ' input#recaptcha_response_field'); /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().children ('span').first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ else if ($recaptchaResponse.length && !$recaptchaResponse.val ()) { alert('— Oops, you missed something: —\n\nSecurity Code missing. Please try again.'); /**/ return false; } /**/ $submissionButton.attr (disabled), ws_plugin__s2member_animateProcessing($submissionButton); /**/ return true; }); } /**/ else if (($upForm = $('form#s2member-pro-paypal-update-form')).length === 1) { var handleBillingMethod, billingMethodSection = 'div#s2member-pro-paypal-update-form-billing-method-section', billingAddressSection = 'div#s2member-pro-paypal-update-form-billing-address-section', cardType = billingMethodSection + ' input[name="s2member_pro_paypal_update\[card_type\]"]', captchaSection = 'div#s2member-pro-paypal-update-form-captcha-section', submissionSection = 'div#s2member-pro-paypal-update-form-submission-section', $submissionButton = $(submissionSection + ' input#s2member-pro-paypal-update-submit'); /**/ ws_plugin__s2member_animateProcessing($submissionButton, 'reset'), $submissionButton.removeAttr ('disabled'); /**/ (handleBillingMethod = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { var billingMethod = $(cardType + ':checked').val (); /* Billing Method. */ /**/ if ($.inArray (billingMethod, ['Visa', 'MasterCard', 'Amex', 'Discover']) !== -1) { $(billingMethodSection + ' div.s2member-pro-paypal-update-form-div').show (); $(billingMethodSection + ' div.s2member-pro-paypal-update-form-div :input').attr (ariaTrue); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-update-form-card-start-date-issue-number-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-update-form-card-start-date-issue-number-div :input').attr (ariaFalse); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-update-form-div').show (); $(billingAddressSection + ' div.s2member-pro-paypal-update-form-div :input').attr (ariaTrue); /**/ $(billingAddressSection).show (), (eventTrigger) ? $(billingMethodSection + ' input#s2member-pro-paypal-update-card-number').focus () : null; } else if ($.inArray (billingMethod, ['Maestro', 'Solo']) !== -1) { $(billingMethodSection + ' div.s2member-pro-paypal-update-form-div').show (); $(billingMethodSection + ' div.s2member-pro-paypal-update-form-div :input').attr (ariaTrue); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-update-form-div').show (); $(billingAddressSection + ' div.s2member-pro-paypal-update-form-div :input').attr (ariaTrue); /**/ $(billingAddressSection).show (), (eventTrigger) ? $(billingMethodSection + ' input#s2member-pro-paypal-update-card-number').focus () : null; } else if (!billingMethod) /* Else there was no Billing Method supplied. */ { $(billingMethodSection + ' div.s2member-pro-paypal-update-form-div').hide (); $(billingMethodSection + ' div.s2member-pro-paypal-update-form-div :input').attr (ariaFalse); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-update-form-card-type-div').show (); $(billingMethodSection + ' div#s2member-pro-paypal-update-form-card-type-div :input').attr (ariaTrue); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-update-form-div').hide (); $(billingAddressSection + ' div.s2member-pro-paypal-update-form-div :input').attr (ariaFalse); /**/ $(billingAddressSection).hide (), (eventTrigger) ? $(submissionSection + ' input#s2member-pro-paypal-update-submit').focus () : null; } }) (); /**/ $(cardType).click (handleBillingMethod).change (handleBillingMethod); /**/ $upForm.submit (function() /* Form validation. */ { var context = this, label = '', error = '', errors = ''; /**/ var $recaptchaResponse = $(captchaSection + ' input#recaptcha_response_field'); /**/ if (!$(cardType + ':checked').val ()) { alert('Please choose a Billing Method.'); /**/ return false; } /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().children ('span').first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ else if ($recaptchaResponse.length && !$recaptchaResponse.val ()) { alert('— Oops, you missed something: —\n\nSecurity Code missing. Please try again.'); /**/ return false; } /**/ $submissionButton.attr (disabled), ws_plugin__s2member_animateProcessing($submissionButton); /**/ return true; }); } /**/ else if (($rgForm = $('form#s2member-pro-paypal-registration-form')).length === 1) { var handleNameIssues, handlePasswordIssues, registrationSection = 'div#s2member-pro-paypal-registration-form-registration-section', captchaSection = 'div#s2member-pro-paypal-registration-form-captcha-section', submissionSection = 'div#s2member-pro-paypal-registration-form-submission-section', $submissionButton = $(submissionSection + ' input#s2member-pro-paypal-registration-submit'); /**/ ws_plugin__s2member_animateProcessing($submissionButton, 'reset'), $submissionButton.removeAttr ('disabled'); /**/ (handleNameIssues = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if ($(submissionSection + ' input#s2member-pro-paypal-registration-names-not-required-or-not-possible').length) { $(registrationSection + ' div#s2member-pro-paypal-registration-form-first-name-div').hide (); $(registrationSection + ' div#s2member-pro-paypal-registration-form-first-name-div :input').attr (ariaFalseDis); /**/ $(registrationSection + ' div#s2member-pro-paypal-registration-form-last-name-div').hide (); $(registrationSection + ' div#s2member-pro-paypal-registration-form-last-name-div :input').attr (ariaFalseDis); } }) (); /**/ (handlePasswordIssues = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if ($(submissionSection + ' input#s2member-pro-paypal-registration-password-not-required-or-not-possible').length) { $(registrationSection + ' div#s2member-pro-paypal-registration-form-password-div').hide (); $(registrationSection + ' div#s2member-pro-paypal-registration-form-password-div :input').attr (ariaFalseDis); } }) (); /**/ $(registrationSection + ' div#s2member-pro-paypal-registration-form-password-div :input').keyup (function() { ws_plugin__s2member_passwordStrength($(registrationSection + ' input#s2member-pro-paypal-registration-username'), $(registrationSection + ' input#s2member-pro-paypal-registration-password1'), $(registrationSection + ' input#s2member-pro-paypal-registration-password2'), $(registrationSection + ' div#s2member-pro-paypal-registration-form-password-strength')); }); /**/ $rgForm.submit (function() /* Form validation. */ { var context = this, label = '', error = '', errors = ''; /**/ var $recaptchaResponse = $(captchaSection + ' input#recaptcha_response_field'); /**/ var $password1 = $(registrationSection + ' input#s2member-pro-paypal-registration-password1[aria-required="true"]'); var $password2 = $(registrationSection + ' input#s2member-pro-paypal-registration-password2'); /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().children ('span').first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ else if ($password1.length && $.trim ($password1.val ()) !== $.trim ($password2.val ())) { alert('— Oops, you missed something: —\n\nPasswords do not match up. Please try again.'); /**/ return false; } /**/ else if ($recaptchaResponse.length && !$recaptchaResponse.val ()) { alert('— Oops, you missed something: —\n\nSecurity Code missing. Please try again.'); /**/ return false; } /**/ $submissionButton.attr (disabled), ws_plugin__s2member_animateProcessing($submissionButton); /**/ return true; }); } /**/ else if (($spForm = $('form#s2member-pro-paypal-sp-checkout-form')).length === 1) { var handleCouponIssues, handleTaxIssues, taxMayApply = true, calculateTax, cTaxDelay, cTaxTimeout, cTaxReq, cTaxLocation, handleExistingUsers, handleBillingMethod, couponSection = 'div#s2member-pro-paypal-sp-checkout-form-coupon-section', couponApplyButton = couponSection + ' input#s2member-pro-paypal-sp-checkout-coupon-apply', registrationSection = 'div#s2member-pro-paypal-sp-checkout-form-registration-section', billingMethodSection = 'div#s2member-pro-paypal-sp-checkout-form-billing-method-section', cardType = billingMethodSection + ' input[name="s2member_pro_paypal_sp_checkout\[card_type\]"]', billingAddressSection = 'div#s2member-pro-paypal-sp-checkout-form-billing-address-section', $ajaxTaxDiv = $(billingAddressSection + ' div#s2member-pro-paypal-sp-checkout-form-ajax-tax-div'), captchaSection = 'div#s2member-pro-paypal-sp-checkout-form-captcha-section', submissionSection = 'div#s2member-pro-paypal-sp-checkout-form-submission-section', submissionNonceVerification = submissionSection + ' input#s2member-pro-paypal-sp-checkout-nonce', submissionButton = submissionSection + ' input#s2member-pro-paypal-sp-checkout-submit'; /**/ var submitButton = 'input type="submit" id="s2member-pro-paypal-sp-checkout-submit" class="s2member-pro-paypal-sp-checkout-submit" value="Submit Form" tabindex="310" /'; var submitExpressCheckoutButton = 'input type="image" src="?php echo $i ; ?/paypal-xco.gif" id="s2member-pro-paypal-sp-checkout-submit" class="s2member-pro-paypal-sp-checkout-submit" value="Submit Form" tabindex="310" /'; /**/ ws_plugin__s2member_animateProcessing($(submissionButton), 'reset'), $(submissionButton).removeAttr ('disabled'), $(couponApplyButton).removeAttr ('disabled'); /**/ (handleCouponIssues = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if ($(submissionSection + ' input#s2member-pro-paypal-sp-checkout-coupons-not-required-or-not-possible').length) { $(couponSection).hide (); /* Not accepting Coupons on this particular form. */ } else /* This is turned off by default for smoother loading. ( via: display:none ). */ $(couponSection).show (); /* OK. So we need to display this now. */ }) (); /**/ (handleTaxIssues = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if ($(submissionSection + ' input#s2member-pro-paypal-sp-checkout-tax-not-required-or-not-possible').length) { $ajaxTaxDiv.hide (), taxMayApply = false; /* Tax does NOT even apply. */ } }) (); /**/ (calculateTax = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if (taxMayApply && !(eventTrigger && eventTrigger.interval && document.activeElement.id === 's2member-pro-paypal-sp-checkout-country')) { var attr = $(submissionSection + ' input#s2member-pro-paypal-sp-checkout-attr').val (); var state = $.trim ($(billingAddressSection + ' input#s2member-pro-paypal-sp-checkout-state').val ()); var country = $(billingAddressSection + ' select#s2member-pro-paypal-sp-checkout-country').val (); var zip = $.trim ($(billingAddressSection + ' input#s2member-pro-paypal-sp-checkout-zip').val ()); var thisTaxLocation = state + '|' + country + '|' + zip; /* Three part location. */ /**/ if (state && country && zip && thisTaxLocation && (!cTaxLocation || cTaxLocation !== thisTaxLocation) && (cTaxLocation = thisTaxLocation)) { (cTaxReq) ? cTaxReq.abort () : null, clearTimeout(cTaxTimeout), cTaxTimeout = null; /* Abort / clear. */ /**/ $ajaxTaxDiv.html ('divimg src="?php echo $vars [ "i" ] ; ?/ajax-loader.gif" alt="Calculating Sales Tax..." / calculating sales tax.../div'); /**/ cTaxTimeout = setTimeout(function() /* Create a new cTaxTimeout with a one second delay. */ { cTaxReq = $.post ('?php echo c_ws_plugin__s2member_utils_strings:: esc_sq ( admin_url ( "/admin-ajax.php" ) ) ; ?', {'action': 'ws_plugin__s2member_pro_paypal_ajax_tax', 'ws_plugin__s2member_pro_paypal_ajax_tax': '?php echo c_ws_plugin__s2member_utils_strings:: esc_sq (c_ws_plugin__s2member_utils_encryption:: encrypt ( "ws-plugin--s2member-pro-paypal-ajax-tax" ) ) ; ?', 'ws_plugin__s2member_pro_paypal_ajax_tax_vars[attr]': attr, 'ws_plugin__s2member_pro_paypal_ajax_tax_vars[state]': state, 'ws_plugin__s2member_pro_paypal_ajax_tax_vars[country]': country, 'ws_plugin__s2member_pro_paypal_ajax_tax_vars[zip]': zip}, function(response) { clearTimeout(cTaxTimeout), cTaxTimeout = null; /* Clear cTaxTimeout. */ /**/ try /* Try/catch here. jQuery will sometimes return a successful response in IE, whenever the connection is aborted with a null response. */ { $ajaxTaxDiv.html ('divstrongSales Tax' + ((response.trial) ? ' Today' : '') + ':/strong ' + ((response.tax_per) ? 'em' + response.tax_per + '/em ( ' + response.cur_symbol + '' + response.tax + ' )' : response.cur_symbol + '' + response.tax) + 'br /strong— Total' + ((response.trial) ? ' Today' : '') + ':/strong ' + response.cur_symbol + '' + response.total + '/div'); } catch (e) {} /**/ }, 'json'); /**/ }, ((eventTrigger && eventTrigger.keyCode) ? 1000 : 100)); } /**/ else if (!state || !country || !zip || !thisTaxLocation) $ajaxTaxDiv.html (''), cTaxLocation = null; } }) (); /**/ cTaxDelay = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { setTimeout(function() /* Trigger event handler with a brief delay. */ { calculateTax(eventTrigger); }, 10); /* Brief delay. */ } /**/ $(billingAddressSection + ' input#s2member-pro-paypal-sp-checkout-state').bind ('keyup blur', calculateTax).bind ('cut paste', cTaxDelay); $(billingAddressSection + ' input#s2member-pro-paypal-sp-checkout-zip').bind ('keyup blur', calculateTax).bind ('cut paste', cTaxDelay); $(billingAddressSection + ' select#s2member-pro-paypal-sp-checkout-country').bind ('change', calculateTax); /**/ setInterval(function() /* Helps with things like Google's Autofill feature. */ { calculateTax({interval: true}); /* Identify as interval trigger. */ }, 1000); /**/ (handleExistingUsers = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN) /* If User/Member is already logged in. */ { $(registrationSection + ' input#s2member-pro-paypal-sp-checkout-first-name').each (function() { var $this = $(this), val = $this.val (); (!val) ? $this.val (S2MEMBER_CURRENT_USER_FIRST_NAME) : null; }); /**/ $(registrationSection + ' input#s2member-pro-paypal-sp-checkout-last-name').each (function() { var $this = $(this), val = $this.val (); (!val) ? $this.val (S2MEMBER_CURRENT_USER_LAST_NAME) : null; }); /**/ $(registrationSection + ' input#s2member-pro-paypal-sp-checkout-email').each (function() { var $this = $(this), val = $this.val (); (!val) ? $this.val (S2MEMBER_CURRENT_USER_EMAIL) : null; }); } }) (); /**/ (handleBillingMethod = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { var billingMethod = $(cardType + ':checked').val (); /* Billing Method. */ /**/ if ($.inArray (billingMethod, ['Visa', 'MasterCard', 'Amex', 'Discover']) !== -1) { $(billingMethodSection + ' div.s2member-pro-paypal-sp-checkout-form-div').show (); $(billingMethodSection + ' div.s2member-pro-paypal-sp-checkout-form-div :input').attr (ariaTrue); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-start-date-issue-number-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-start-date-issue-number-div :input').attr (ariaFalse); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-sp-checkout-form-div').show (); $(billingAddressSection + ' div.s2member-pro-paypal-sp-checkout-form-div :input').attr (ariaTrue); /**/ (!taxMayApply) ? $ajaxTaxDiv.hide () : null; /* Tax does NOT even apply. */ /**/ $(billingAddressSection).show (), $(submissionSection + ' input#s2member-pro-paypal-sp-checkout-submit').replaceWith (submitButton); /**/ (eventTrigger) ? $(billingMethodSection + ' input#s2member-pro-paypal-sp-checkout-card-number').focus () : null; } else if ($.inArray (billingMethod, ['Maestro', 'Solo']) !== -1) { $(billingMethodSection + ' div.s2member-pro-paypal-sp-checkout-form-div').show (); $(billingMethodSection + ' div.s2member-pro-paypal-sp-checkout-form-div :input').attr (ariaTrue); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-sp-checkout-form-div').show (); $(billingAddressSection + ' div.s2member-pro-paypal-sp-checkout-form-div :input').attr (ariaTrue); /**/ (!taxMayApply) ? $ajaxTaxDiv.hide () : null; /* Tax does NOT even apply. */ /**/ $(billingAddressSection).show (), $(submissionSection + ' input#s2member-pro-paypal-sp-checkout-submit').replaceWith (submitButton); /**/ (eventTrigger) ? $(billingMethodSection + ' input#s2member-pro-paypal-sp-checkout-card-number').focus () : null; } else if ((!billingMethod || billingMethod === 'PayPal') && taxMayApply) { $(billingMethodSection + ' div.s2member-pro-paypal-sp-checkout-form-div').show (); $(billingMethodSection + ' div.s2member-pro-paypal-sp-checkout-form-div :input').attr (ariaTrue); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-number-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-number-div :input').attr (ariaFalse); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-expiration-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-expiration-div :input').attr (ariaFalse); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-verification-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-verification-div :input').attr (ariaFalse); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-start-date-issue-number-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-start-date-issue-number-div :input').attr (ariaFalse); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-sp-checkout-form-div').show (); $(billingAddressSection + ' div.s2member-pro-paypal-sp-checkout-form-div :input').attr (ariaTrue); /**/ $(billingAddressSection + ' div#s2member-pro-paypal-sp-checkout-form-street-div').hide (); $(billingAddressSection + ' div#s2member-pro-paypal-sp-checkout-form-street-div :input').attr (ariaFalse); /**/ $(billingAddressSection + ' div#s2member-pro-paypal-sp-checkout-form-city-div').hide (); $(billingAddressSection + ' div#s2member-pro-paypal-sp-checkout-form-city-div :input').attr (ariaFalse); /**/ $(billingAddressSection).show (), $(submissionSection + ' input#s2member-pro-paypal-sp-checkout-submit').replaceWith (submitExpressCheckoutButton); /**/ (eventTrigger) ? $(billingAddressSection + ' input#s2member-pro-paypal-sp-checkout-state').focus () : null; } else if (!billingMethod || billingMethod === 'PayPal') { $(billingMethodSection + ' div.s2member-pro-paypal-sp-checkout-form-div').hide (); $(billingMethodSection + ' div.s2member-pro-paypal-sp-checkout-form-div :input').attr (ariaFalse); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-type-div').show (); $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-type-div :input').attr (ariaTrue); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-sp-checkout-form-div').hide (); $(billingAddressSection + ' div.s2member-pro-paypal-sp-checkout-form-div :input').attr (ariaFalse); /**/ $(billingAddressSection).hide (), $(submissionSection + ' input#s2member-pro-paypal-sp-checkout-submit').replaceWith (submitExpressCheckoutButton); /**/ (eventTrigger) ? $(submissionSection + ' input#s2member-pro-paypal-sp-checkout-submit').focus () : null; } /**/ handleTaxIssues (); /* Tax issues. */ }) (); /**/ $(cardType).click (handleBillingMethod).change (handleBillingMethod); /**/ $(couponApplyButton).click (function() /* Only applying coupon. */ { $(submissionNonceVerification).val ('apply-coupon'), $spForm.submit (); }); /**/ $spForm.submit (function() /* Form validation. */ { if ($(submissionNonceVerification).val () !== 'apply-coupon') { var context = this, label = '', error = '', errors = ''; /**/ var $recaptchaResponse = $(captchaSection + ' input#recaptcha_response_field'); /**/ if (!$(cardType + ':checked').val ()) { $(cardType).val (['PayPal']); } /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().children ('span').first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ else if ($recaptchaResponse.length && !$recaptchaResponse.val ()) { alert('— Oops, you missed something: —\n\nSecurity Code missing. Please try again.'); /**/ return false; } } /**/ $(submissionButton).attr (disabled), ws_plugin__s2member_animateProcessing($(submissionButton)), $(couponApplyButton).attr (disabled); /**/ return true; }); } /**/ else if (($coForm = $('form#s2member-pro-paypal-checkout-form')).length === 1) { var handleCouponIssues, handleTaxIssues, taxMayApply = true, calculateTax, cTaxDelay, cTaxTimeout, cTaxReq, cTaxLocation, handlePasswordIssues, handleBillingMethod, handleExistingUsers, couponSection = 'div#s2member-pro-paypal-checkout-form-coupon-section', couponApplyButton = couponSection + ' input#s2member-pro-paypal-checkout-coupon-apply', registrationSection = 'div#s2member-pro-paypal-checkout-form-registration-section', customFieldsSection = 'div#s2member-pro-paypal-checkout-form-custom-fields-section', billingMethodSection = 'div#s2member-pro-paypal-checkout-form-billing-method-section', cardType = billingMethodSection + ' input[name="s2member_pro_paypal_checkout\[card_type\]"]', billingAddressSection = 'div#s2member-pro-paypal-checkout-form-billing-address-section', $ajaxTaxDiv = $(billingAddressSection + ' div#s2member-pro-paypal-checkout-form-ajax-tax-div'), captchaSection = 'div#s2member-pro-paypal-checkout-form-captcha-section', submissionSection = 'div#s2member-pro-paypal-checkout-form-submission-section', submissionNonceVerification = submissionSection + ' input#s2member-pro-paypal-checkout-nonce', submissionButton = submissionSection + ' input#s2member-pro-paypal-checkout-submit'; /**/ var submitButton = 'input type="submit" id="s2member-pro-paypal-checkout-submit" class="s2member-pro-paypal-checkout-submit" value="Submit Form" tabindex="410" /'; var submitExpressCheckoutButton = 'input type="image" src="?php echo $i ; ?/paypal-xco.gif" id="s2member-pro-paypal-checkout-submit" class="s2member-pro-paypal-checkout-submit" value="Submit Form" tabindex="410" /'; /**/ ws_plugin__s2member_animateProcessing($(submissionButton), 'reset'), $(submissionButton).removeAttr ('disabled'), $(couponApplyButton).removeAttr ('disabled'); /**/ (handleCouponIssues = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if ($(submissionSection + ' input#s2member-pro-paypal-checkout-coupons-not-required-or-not-possible').length) { $(couponSection).hide (); /* Not accepting Coupons on this particular form. */ } else /* This is turned off by default for smoother loading. ( via: display:none ). */ $(couponSection).show (); /* OK. So we need to display this now. */ }) (); /**/ (handleTaxIssues = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if ($(submissionSection + ' input#s2member-pro-paypal-checkout-tax-not-required-or-not-possible').length) { $ajaxTaxDiv.hide (), taxMayApply = false; /* Tax does NOT even apply. */ } }) (); /**/ (calculateTax = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if (taxMayApply && !(eventTrigger && eventTrigger.interval && document.activeElement.id === 's2member-pro-paypal-checkout-country')) { var attr = $(submissionSection + ' input#s2member-pro-paypal-checkout-attr').val (); var state = $.trim ($(billingAddressSection + ' input#s2member-pro-paypal-checkout-state').val ()); var country = $(billingAddressSection + ' select#s2member-pro-paypal-checkout-country').val (); var zip = $.trim ($(billingAddressSection + ' input#s2member-pro-paypal-checkout-zip').val ()); var thisTaxLocation = state + '|' + country + '|' + zip; /* Three part location. */ /**/ if (state && country && zip && thisTaxLocation && (!cTaxLocation || cTaxLocation !== thisTaxLocation) && (cTaxLocation = thisTaxLocation)) { (cTaxReq) ? cTaxReq.abort () : null, clearTimeout(cTaxTimeout), cTaxTimeout = null; /* Abort / clear. */ /**/ $ajaxTaxDiv.html ('divimg src="?php echo $vars [ "i" ] ; ?/ajax-loader.gif" alt="Calculating Sales Tax..." / calculating sales tax.../div'); /**/ cTaxTimeout = setTimeout(function() /* Create a new cTaxTimeout with a one second delay. */ { cTaxReq = $.post ('?php echo c_ws_plugin__s2member_utils_strings:: esc_sq ( admin_url ( "/admin-ajax.php" ) ) ; ?', {'action': 'ws_plugin__s2member_pro_paypal_ajax_tax', 'ws_plugin__s2member_pro_paypal_ajax_tax': '?php echo c_ws_plugin__s2member_utils_strings:: esc_sq (c_ws_plugin__s2member_utils_encryption:: encrypt ( "ws-plugin--s2member-pro-paypal-ajax-tax" ) ) ; ?', 'ws_plugin__s2member_pro_paypal_ajax_tax_vars[attr]': attr, 'ws_plugin__s2member_pro_paypal_ajax_tax_vars[state]': state, 'ws_plugin__s2member_pro_paypal_ajax_tax_vars[country]': country, 'ws_plugin__s2member_pro_paypal_ajax_tax_vars[zip]': zip}, function(response, textStatus) { clearTimeout(cTaxTimeout), cTaxTimeout = null; /* Clear cTaxTimeout. */ /**/ try /* Try/catch here. jQuery will sometimes return a successful response in IE, whenever the connection is aborted with a null response. */ { $ajaxTaxDiv.html ('divstrongSales Tax' + ((response.trial) ? ' Today' : '') + ':/strong ' + ((response.tax_per) ? 'em' + response.tax_per + '/em ( ' + response.cur_symbol + '' + response.tax + ' )' : response.cur_symbol + '' + response.tax) + 'br /strong— Total' + ((response.trial) ? ' Today' : '') + ':/strong ' + response.cur_symbol + '' + response.total + '/div'); } catch (e) {} /**/ }, 'json'); /**/ }, ((eventTrigger && eventTrigger.keyCode) ? 1000 : 100)); } /**/ else if (!state || !country || !zip || !thisTaxLocation) $ajaxTaxDiv.html (''), cTaxLocation = null; } }) (); /**/ cTaxDelay = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { setTimeout(function() /* Trigger event handler with a brief delay. */ { calculateTax(eventTrigger); }, 10); /* Brief delay. */ } /**/ $(billingAddressSection + ' input#s2member-pro-paypal-checkout-state').bind ('keyup blur', calculateTax).bind ('cut paste', cTaxDelay); $(billingAddressSection + ' input#s2member-pro-paypal-checkout-zip').bind ('keyup blur', calculateTax).bind ('cut paste', cTaxDelay); $(billingAddressSection + ' select#s2member-pro-paypal-checkout-country').bind ('change', calculateTax); /**/ setInterval(function() /* Helps with things like Google's Autofill feature. */ { calculateTax({interval: true}); /* Identify as interval trigger. */ }, 1000); /**/ (handlePasswordIssues = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if ($(submissionSection + ' input#s2member-pro-paypal-checkout-password-not-required-or-not-possible').length) { $(registrationSection + ' div#s2member-pro-paypal-checkout-form-password-div').hide (); $(registrationSection + ' div#s2member-pro-paypal-checkout-form-password-div :input').attr (ariaFalseDis); } }) (); /**/ (handleExistingUsers = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN) /* If User/Member is already logged in. */ { $(registrationSection + ' input#s2member-pro-paypal-checkout-first-name').each (function() { var $this = $(this), val = $this.val (); (!val) ? $this.val (S2MEMBER_CURRENT_USER_FIRST_NAME) : null; }); /**/ $(registrationSection + ' input#s2member-pro-paypal-checkout-last-name').each (function() { var $this = $(this), val = $this.val (); (!val) ? $this.val (S2MEMBER_CURRENT_USER_LAST_NAME) : null; }); /**/ $(registrationSection + ' input#s2member-pro-paypal-checkout-email').val (S2MEMBER_CURRENT_USER_EMAIL).attr (ariaFalseDis); $(registrationSection + ' input#s2member-pro-paypal-checkout-username').val (S2MEMBER_CURRENT_USER_LOGIN).attr (ariaFalseDis); /**/ $(registrationSection + ' div#s2member-pro-paypal-checkout-form-password-div').hide (); $(registrationSection + ' div#s2member-pro-paypal-checkout-form-password-div :input').attr (ariaFalseDis); /**/ if ($.trim ($(registrationSection + ' div#s2member-pro-paypal-checkout-form-registration-section-title').html ()) === 'Create Profile') $(registrationSection + ' div#s2member-pro-paypal-checkout-form-registration-section-title').html ('Your Profile'); /**/ $(customFieldsSection).hide (), $(customFieldsSection + ' :input').attr (ariaFalseDis); } }) (); /**/ (handleBillingMethod = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { var billingMethod = $(cardType + ':checked').val (); /* Billing Method. */ /**/ if ($.inArray (billingMethod, ['Visa', 'MasterCard', 'Amex', 'Discover']) !== -1) { $(billingMethodSection + ' div.s2member-pro-paypal-checkout-form-div').show (); $(billingMethodSection + ' div.s2member-pro-paypal-checkout-form-div :input').attr (ariaTrue); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-start-date-issue-number-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-start-date-issue-number-div :input').attr (ariaFalse); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-checkout-form-div').show (); $(billingAddressSection + ' div.s2member-pro-paypal-checkout-form-div :input').attr (ariaTrue); /**/ (!taxMayApply) ? $ajaxTaxDiv.hide () : null; /* Tax does NOT even apply. */ /**/ $(billingAddressSection).show (), $(submissionSection + ' input#s2member-pro-paypal-checkout-submit').replaceWith (submitButton); /**/ (eventTrigger) ? $(billingMethodSection + ' input#s2member-pro-paypal-checkout-card-number').focus () : null; } else if ($.inArray (billingMethod, ['Maestro', 'Solo']) !== -1) { $(billingMethodSection + ' div.s2member-pro-paypal-checkout-form-div').show (); $(billingMethodSection + ' div.s2member-pro-paypal-checkout-form-div :input').attr (ariaTrue); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-checkout-form-div').show (); $(billingAddressSection + ' div.s2member-pro-paypal-checkout-form-div :input').attr (ariaTrue); /**/ (!taxMayApply) ? $ajaxTaxDiv.hide () : null; /* Tax does NOT even apply. */ /**/ $(billingAddressSection).show (), $(submissionSection + ' input#s2member-pro-paypal-checkout-submit').replaceWith (submitButton); /**/ (eventTrigger) ? $(billingMethodSection + ' input#s2member-pro-paypal-checkout-card-number').focus () : null; } else if ((!billingMethod || billingMethod === 'PayPal') && taxMayApply) { $(billingMethodSection + ' div.s2member-pro-paypal-checkout-form-div').show (); $(billingMethodSection + ' div.s2member-pro-paypal-checkout-form-div :input').attr (ariaTrue); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-number-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-number-div :input').attr (ariaFalse); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-expiration-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-expiration-div :input').attr (ariaFalse); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-verification-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-verification-div :input').attr (ariaFalse); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-start-date-issue-number-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-start-date-issue-number-div :input').attr (ariaFalse); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-checkout-form-div').show (); $(billingAddressSection + ' div.s2member-pro-paypal-checkout-form-div :input').attr (ariaTrue); /**/ $(billingAddressSection + ' div#s2member-pro-paypal-checkout-form-street-div').hide (); $(billingAddressSection + ' div#s2member-pro-paypal-checkout-form-street-div :input').attr (ariaFalse); /**/ $(billingAddressSection + ' div#s2member-pro-paypal-checkout-form-city-div').hide (); $(billingAddressSection + ' div#s2member-pro-paypal-checkout-form-city-div :input').attr (ariaFalse); /**/ $(billingAddressSection).show (), $(submissionSection + ' input#s2member-pro-paypal-checkout-submit').replaceWith (submitExpressCheckoutButton); /**/ (eventTrigger) ? $(billingAddressSection + ' input#s2member-pro-paypal-checkout-state').focus () : null; } else if (!billingMethod || billingMethod === 'PayPal') { $(billingMethodSection + ' div.s2member-pro-paypal-checkout-form-div').hide (); $(billingMethodSection + ' div.s2member-pro-paypal-checkout-form-div :input').attr (ariaFalse); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-type-div').show (); $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-type-div :input').attr (ariaTrue); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-checkout-form-div').hide (); $(billingAddressSection + ' div.s2member-pro-paypal-checkout-form-div :input').attr (ariaFalse); /**/ $(billingAddressSection).hide (), $(submissionSection + ' input#s2member-pro-paypal-checkout-submit').replaceWith (submitExpressCheckoutButton); /**/ (eventTrigger) ? $(submissionSection + ' input#s2member-pro-paypal-checkout-submit').focus () : null; } }) (); /**/ $(cardType).click (handleBillingMethod).change (handleBillingMethod); /**/ $(couponApplyButton).click (function() /* Only applying coupon. */ { $(submissionNonceVerification).val ('apply-coupon'), $coForm.submit (); }); /**/ $(registrationSection + ' div#s2member-pro-paypal-checkout-form-password-div :input').keyup (function() { ws_plugin__s2member_passwordStrength($(registrationSection + ' input#s2member-pro-paypal-checkout-username'), $(registrationSection + ' input#s2member-pro-paypal-checkout-password1'), $(registrationSection + ' input#s2member-pro-paypal-checkout-password2'), $(registrationSection + ' div#s2member-pro-paypal-checkout-form-password-strength')); }); /**/ $coForm.submit (function() /* Form validation. */ { if ($(submissionNonceVerification).val () !== 'apply-coupon') { var context = this, label = '', error = '', errors = ''; /**/ var $recaptchaResponse = $(captchaSection + ' input#recaptcha_response_field'); /**/ var $password1 = $(registrationSection + ' input#s2member-pro-paypal-checkout-password1[aria-required="true"]'); var $password2 = $(registrationSection + ' input#s2member-pro-paypal-checkout-password2'); /**/ if (!$(cardType + ':checked').val ()) { $(cardType).val (['PayPal']); } /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().children ('span').first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ else if ($password1.length && $.trim ($password1.val ()) !== $.trim ($password2.val ())) { alert('— Oops, you missed something: —\n\nPasswords do not match up. Please try again.'); /**/ return false; } /**/ else if ($recaptchaResponse.length && !$recaptchaResponse.val ()) { alert('— Oops, you missed something: —\n\nSecurity Code missing. Please try again.'); /**/ return false; } } /**/ $(submissionButton).attr (disabled), ws_plugin__s2member_animateProcessing($(submissionButton)), $(couponApplyButton).attr (disabled); /**/ return true; }); } /**/ (jumpToResponses = function() /* Jump to form responses. */ { $('div#s2member-pro-paypal-form-response').each (function() { var offset = $(this).offset (); window.scrollTo (0, offset.top - 100); }); }) (); }); [ full view ]s2member-pro\includes\separates\gateways\paypal\paypal.js Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code(!-- :: s-words --)

Statistics: Posted by System Robot — August 15th, 2011, 3:20 pm


]]>
2011-07-11T17:39:39-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13396&p=28062#p28062 <![CDATA[s2Member v110710 / Source Code: s2member-p...]]>
s2Member v110710
Source Code: s2member-pro\includes\separates\gateways\paypal\paypal.js
Docs updated: July 11, 2011, 6:39 pm

Open for public discussion.
(!-- s-words :: --)Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code jQuery(window).load(function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli'+location.hash).addClass('hilite'); }); jQuery(window).bind('hashchange', function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli').removeClass('hilite'); jQuery('olli'+location.hash).addClass('hilite'); }); [ full view ]s2member-pro\includes\separates\gateways\paypal\paypal.js /** * Core JavaScript routines for PayPal®. * * Copyright: © 2009-2011 * {@link http://www.websharks-inc.com/ WebSharks, Inc.} * ( coded in the USA ) * * This WordPress® plugin ( s2Member Pro ) is comprised of two parts: * * o (1) Its PHP code is licensed under the GPL license, as is WordPress®. * You should have received a copy of the GNU General Public License, * along with this software. In the main directory, see: /licensing/ * If not, see: {@link http://www.gnu.org/licenses/}. * * o (2) All other parts of ( s2Member Pro ); including, but not limited to: * the CSS code, some JavaScript code, images, and design; * are licensed according to the license purchased. * See: {@link http://www.s2member.com/prices/} * * Unless you have our prior written consent, you must NOT directly or indirectly license, * sub-license, sell, resell, or provide for free; part (2) of the s2Member Pro Module; * or make an offer to do any of these things. All of these things are strictly * prohibited with part (2) of the s2Member Pro Module. * * Your purchase of s2Member Pro includes free lifetime upgrades via s2Member.com * ( i.e. new features, bug fixes, updates, improvements ); along with full access * to our video tutorial library: {@link http://www.s2member.com/videos/} * * @package s2Member\PayPal * @since 1.5 */ /* Scripting routines handled on document ready state. */ jQuery(document).ready (function($) { var $clForm, $upForm, $rgForm, $spForm, $coForm, jumpToResponses, preloadAjaxLoader, ariaTrue = {'aria-required': 'true'}, ariaFalse = {'aria-required': 'false'}, disabled = {'disabled': 'disabled'}, ariaFalseDis = {'aria-required': 'false', 'disabled': 'disabled'}; /**/ preloadAjaxLoader = new Image (), preloadAjaxLoader.src = '?php echo $vars [ "i" ] ; ?/ajax-loader.gif'; /**/ if (($clForm = $('form#s2member-pro-paypal-cancellation-form')).length === 1) { var captchaSection = 'div#s2member-pro-paypal-cancellation-form-captcha-section', submissionSection = 'div#s2member-pro-paypal-cancellation-form-submission-section', $submissionButton = $(submissionSection + ' input#s2member-pro-paypal-cancellation-submit'); /**/ ws_plugin__s2member_animateProcessing($submissionButton, 'reset'), $submissionButton.removeAttr ('disabled'); /**/ $clForm.submit (function() /* Form validation. */ { var context = this, label = '', error = '', errors = ''; /**/ var $recaptchaResponse = $(captchaSection + ' input#recaptcha_response_field'); /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().children ('span').first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ else if ($recaptchaResponse.length && !$recaptchaResponse.val ()) { alert('— Oops, you missed something: —\n\nSecurity Code missing. Please try again.'); /**/ return false; } /**/ $submissionButton.attr (disabled), ws_plugin__s2member_animateProcessing($submissionButton); /**/ return true; }); } /**/ else if (($upForm = $('form#s2member-pro-paypal-update-form')).length === 1) { var handleBillingMethod, billingMethodSection = 'div#s2member-pro-paypal-update-form-billing-method-section', billingAddressSection = 'div#s2member-pro-paypal-update-form-billing-address-section', cardType = billingMethodSection + ' input[name="s2member_pro_paypal_update\[card_type\]"]', captchaSection = 'div#s2member-pro-paypal-update-form-captcha-section', submissionSection = 'div#s2member-pro-paypal-update-form-submission-section', $submissionButton = $(submissionSection + ' input#s2member-pro-paypal-update-submit'); /**/ ws_plugin__s2member_animateProcessing($submissionButton, 'reset'), $submissionButton.removeAttr ('disabled'); /**/ (handleBillingMethod = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { var billingMethod = $(cardType + ':checked').val (); /* Billing Method. */ /**/ if ($.inArray (billingMethod, ['Visa', 'MasterCard', 'Amex', 'Discover']) !== -1) { $(billingMethodSection + ' div.s2member-pro-paypal-update-form-div').show (); $(billingMethodSection + ' div.s2member-pro-paypal-update-form-div :input').attr (ariaTrue); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-update-form-card-start-date-issue-number-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-update-form-card-start-date-issue-number-div :input').attr (ariaFalse); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-update-form-div').show (); $(billingAddressSection + ' div.s2member-pro-paypal-update-form-div :input').attr (ariaTrue); /**/ $(billingAddressSection).show (), (eventTrigger) ? $(billingMethodSection + ' input#s2member-pro-paypal-update-card-number').focus () : null; } else if ($.inArray (billingMethod, ['Maestro', 'Solo']) !== -1) { $(billingMethodSection + ' div.s2member-pro-paypal-update-form-div').show (); $(billingMethodSection + ' div.s2member-pro-paypal-update-form-div :input').attr (ariaTrue); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-update-form-div').show (); $(billingAddressSection + ' div.s2member-pro-paypal-update-form-div :input').attr (ariaTrue); /**/ $(billingAddressSection).show (), (eventTrigger) ? $(billingMethodSection + ' input#s2member-pro-paypal-update-card-number').focus () : null; } else if (!billingMethod) /* Else there was no Billing Method supplied. */ { $(billingMethodSection + ' div.s2member-pro-paypal-update-form-div').hide (); $(billingMethodSection + ' div.s2member-pro-paypal-update-form-div :input').attr (ariaFalse); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-update-form-card-type-div').show (); $(billingMethodSection + ' div#s2member-pro-paypal-update-form-card-type-div :input').attr (ariaTrue); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-update-form-div').hide (); $(billingAddressSection + ' div.s2member-pro-paypal-update-form-div :input').attr (ariaFalse); /**/ $(billingAddressSection).hide (), (eventTrigger) ? $(submissionSection + ' input#s2member-pro-paypal-update-submit').focus () : null; } }) (); /**/ $(cardType).click (handleBillingMethod).change (handleBillingMethod); /**/ $upForm.submit (function() /* Form validation. */ { var context = this, label = '', error = '', errors = ''; /**/ var $recaptchaResponse = $(captchaSection + ' input#recaptcha_response_field'); /**/ if (!$(cardType + ':checked').val ()) { alert('Please choose a Billing Method.'); /**/ return false; } /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().children ('span').first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ else if ($recaptchaResponse.length && !$recaptchaResponse.val ()) { alert('— Oops, you missed something: —\n\nSecurity Code missing. Please try again.'); /**/ return false; } /**/ $submissionButton.attr (disabled), ws_plugin__s2member_animateProcessing($submissionButton); /**/ return true; }); } /**/ else if (($rgForm = $('form#s2member-pro-paypal-registration-form')).length === 1) { var handleNameIssues, handlePasswordIssues, registrationSection = 'div#s2member-pro-paypal-registration-form-registration-section', captchaSection = 'div#s2member-pro-paypal-registration-form-captcha-section', submissionSection = 'div#s2member-pro-paypal-registration-form-submission-section', $submissionButton = $(submissionSection + ' input#s2member-pro-paypal-registration-submit'); /**/ ws_plugin__s2member_animateProcessing($submissionButton, 'reset'), $submissionButton.removeAttr ('disabled'); /**/ (handleNameIssues = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if ($(submissionSection + ' input#s2member-pro-paypal-registration-names-not-required-or-not-possible').length) { $(registrationSection + ' div#s2member-pro-paypal-registration-form-first-name-div').hide (); $(registrationSection + ' div#s2member-pro-paypal-registration-form-first-name-div :input').attr (ariaFalseDis); /**/ $(registrationSection + ' div#s2member-pro-paypal-registration-form-last-name-div').hide (); $(registrationSection + ' div#s2member-pro-paypal-registration-form-last-name-div :input').attr (ariaFalseDis); } }) (); /**/ (handlePasswordIssues = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if ($(submissionSection + ' input#s2member-pro-paypal-registration-password-not-required-or-not-possible').length) { $(registrationSection + ' div#s2member-pro-paypal-registration-form-password-div').hide (); $(registrationSection + ' div#s2member-pro-paypal-registration-form-password-div :input').attr (ariaFalseDis); } }) (); /**/ $(registrationSection + ' div#s2member-pro-paypal-registration-form-password-div :input').keyup (function() { ws_plugin__s2member_passwordStrength($(registrationSection + ' input#s2member-pro-paypal-registration-username'), $(registrationSection + ' input#s2member-pro-paypal-registration-password1'), $(registrationSection + ' input#s2member-pro-paypal-registration-password2'), $(registrationSection + ' div#s2member-pro-paypal-registration-form-password-strength')); }); /**/ $rgForm.submit (function() /* Form validation. */ { var context = this, label = '', error = '', errors = ''; /**/ var $recaptchaResponse = $(captchaSection + ' input#recaptcha_response_field'); /**/ var $password1 = $(registrationSection + ' input#s2member-pro-paypal-registration-password1[aria-required="true"]'); var $password2 = $(registrationSection + ' input#s2member-pro-paypal-registration-password2'); /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().children ('span').first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ else if ($password1.length && $.trim ($password1.val ()) !== $.trim ($password2.val ())) { alert('— Oops, you missed something: —\n\nPasswords do not match up. Please try again.'); /**/ return false; } /**/ else if ($recaptchaResponse.length && !$recaptchaResponse.val ()) { alert('— Oops, you missed something: —\n\nSecurity Code missing. Please try again.'); /**/ return false; } /**/ $submissionButton.attr (disabled), ws_plugin__s2member_animateProcessing($submissionButton); /**/ return true; }); } /**/ else if (($spForm = $('form#s2member-pro-paypal-sp-checkout-form')).length === 1) { var handleCouponIssues, handleTaxIssues, taxMayApply = true, calculateTax, cTaxDelay, cTaxTimeout, cTaxReq, cTaxLocation, handleExistingUsers, handleBillingMethod, couponSection = 'div#s2member-pro-paypal-sp-checkout-form-coupon-section', couponApplyButton = couponSection + ' input#s2member-pro-paypal-sp-checkout-coupon-apply', registrationSection = 'div#s2member-pro-paypal-sp-checkout-form-registration-section', billingMethodSection = 'div#s2member-pro-paypal-sp-checkout-form-billing-method-section', cardType = billingMethodSection + ' input[name="s2member_pro_paypal_sp_checkout\[card_type\]"]', billingAddressSection = 'div#s2member-pro-paypal-sp-checkout-form-billing-address-section', $ajaxTaxDiv = $(billingAddressSection + ' div#s2member-pro-paypal-sp-checkout-form-ajax-tax-div'), captchaSection = 'div#s2member-pro-paypal-sp-checkout-form-captcha-section', submissionSection = 'div#s2member-pro-paypal-sp-checkout-form-submission-section', submissionNonceVerification = submissionSection + ' input#s2member-pro-paypal-sp-checkout-nonce', submissionButton = submissionSection + ' input#s2member-pro-paypal-sp-checkout-submit'; /**/ var submitButton = 'input type="submit" id="s2member-pro-paypal-sp-checkout-submit" class="s2member-pro-paypal-sp-checkout-submit" value="Submit Form" tabindex="310" /'; var submitExpressCheckoutButton = 'input type="image" src="?php echo $i ; ?/paypal-xco.gif" id="s2member-pro-paypal-sp-checkout-submit" class="s2member-pro-paypal-sp-checkout-submit" value="Submit Form" tabindex="310" /'; /**/ ws_plugin__s2member_animateProcessing($(submissionButton), 'reset'), $(submissionButton).removeAttr ('disabled'), $(couponApplyButton).removeAttr ('disabled'); /**/ (handleCouponIssues = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if ($(submissionSection + ' input#s2member-pro-paypal-sp-checkout-coupons-not-required-or-not-possible').length) { $(couponSection).hide (); /* Not accepting Coupons on this particular form. */ } else /* This is turned off by default for smoother loading. ( via: display:none ). */ $(couponSection).show (); /* OK. So we need to display this now. */ }) (); /**/ (handleTaxIssues = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if ($(submissionSection + ' input#s2member-pro-paypal-sp-checkout-tax-not-required-or-not-possible').length) { $ajaxTaxDiv.hide (), taxMayApply = false; /* Tax does NOT even apply. */ } }) (); /**/ (calculateTax = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if (taxMayApply && !(eventTrigger && eventTrigger.interval && document.activeElement.id === 's2member-pro-paypal-sp-checkout-country')) { var attr = $(submissionSection + ' input#s2member-pro-paypal-sp-checkout-attr').val (); var state = $.trim ($(billingAddressSection + ' input#s2member-pro-paypal-sp-checkout-state').val ()); var country = $(billingAddressSection + ' select#s2member-pro-paypal-sp-checkout-country').val (); var zip = $.trim ($(billingAddressSection + ' input#s2member-pro-paypal-sp-checkout-zip').val ()); var thisTaxLocation = state + '|' + country + '|' + zip; /* Three part location. */ /**/ if (state && country && zip && thisTaxLocation && (!cTaxLocation || cTaxLocation !== thisTaxLocation) && (cTaxLocation = thisTaxLocation)) { (cTaxReq) ? cTaxReq.abort () : null, clearTimeout(cTaxTimeout), cTaxTimeout = null; /* Abort / clear. */ /**/ $ajaxTaxDiv.html ('divimg src="?php echo $vars [ "i" ] ; ?/ajax-loader.gif" alt="Calculating Sales Tax..." / calculating sales tax.../div'); /**/ cTaxTimeout = setTimeout(function() /* Create a new cTaxTimeout with a one second delay. */ { cTaxReq = $.post ('?php echo c_ws_plugin__s2member_utils_strings:: esc_sq ( admin_url ( "/admin-ajax.php" ) ) ; ?', {'action': 'ws_plugin__s2member_pro_paypal_ajax_tax', 'ws_plugin__s2member_pro_paypal_ajax_tax': '?php echo c_ws_plugin__s2member_utils_strings:: esc_sq (c_ws_plugin__s2member_utils_encryption:: encrypt ( "ws-plugin--s2member-pro-paypal-ajax-tax" ) ) ; ?', 'ws_plugin__s2member_pro_paypal_ajax_tax_vars[attr]': attr, 'ws_plugin__s2member_pro_paypal_ajax_tax_vars[state]': state, 'ws_plugin__s2member_pro_paypal_ajax_tax_vars[country]': country, 'ws_plugin__s2member_pro_paypal_ajax_tax_vars[zip]': zip}, function(response) { clearTimeout(cTaxTimeout), cTaxTimeout = null; /* Clear cTaxTimeout. */ /**/ try /* Try/catch here. jQuery will sometimes return a successful response in IE, whenever the connection is aborted with a null response. */ { $ajaxTaxDiv.html ('divstrongSales Tax' + ((response.trial) ? ' Today' : '') + ':/strong ' + ((response.tax_per) ? 'em' + response.tax_per + '/em ( ' + response.cur_symbol + '' + response.tax + ' )' : response.cur_symbol + '' + response.tax) + 'br /strong— Total' + ((response.trial) ? ' Today' : '') + ':/strong ' + response.cur_symbol + '' + response.total + '/div'); } catch (e) {} /**/ }, 'json'); /**/ }, ((eventTrigger && eventTrigger.keyCode) ? 1000 : 100)); } /**/ else if (!state || !country || !zip || !thisTaxLocation) $ajaxTaxDiv.html (''), cTaxLocation = null; } }) (); /**/ cTaxDelay = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { setTimeout(function() /* Trigger event handler with a brief delay. */ { calculateTax(eventTrigger); }, 10); /* Brief delay. */ } /**/ $(billingAddressSection + ' input#s2member-pro-paypal-sp-checkout-state').bind ('keyup blur', calculateTax).bind ('cut paste', cTaxDelay); $(billingAddressSection + ' input#s2member-pro-paypal-sp-checkout-zip').bind ('keyup blur', calculateTax).bind ('cut paste', cTaxDelay); $(billingAddressSection + ' select#s2member-pro-paypal-sp-checkout-country').bind ('change', calculateTax); /**/ setInterval(function() /* Helps with things like Google's Autofill feature. */ { calculateTax({interval: true}); /* Identify as interval trigger. */ }, 1000); /**/ (handleExistingUsers = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN) /* If User/Member is already logged in. */ { $(registrationSection + ' input#s2member-pro-paypal-sp-checkout-first-name').each (function() { var $this = $(this), val = $this.val (); (!val) ? $this.val (S2MEMBER_CURRENT_USER_FIRST_NAME) : null; }); /**/ $(registrationSection + ' input#s2member-pro-paypal-sp-checkout-last-name').each (function() { var $this = $(this), val = $this.val (); (!val) ? $this.val (S2MEMBER_CURRENT_USER_LAST_NAME) : null; }); /**/ $(registrationSection + ' input#s2member-pro-paypal-sp-checkout-email').each (function() { var $this = $(this), val = $this.val (); (!val) ? $this.val (S2MEMBER_CURRENT_USER_EMAIL) : null; }); } }) (); /**/ (handleBillingMethod = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { var billingMethod = $(cardType + ':checked').val (); /* Billing Method. */ /**/ if ($.inArray (billingMethod, ['Visa', 'MasterCard', 'Amex', 'Discover']) !== -1) { $(billingMethodSection + ' div.s2member-pro-paypal-sp-checkout-form-div').show (); $(billingMethodSection + ' div.s2member-pro-paypal-sp-checkout-form-div :input').attr (ariaTrue); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-start-date-issue-number-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-start-date-issue-number-div :input').attr (ariaFalse); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-sp-checkout-form-div').show (); $(billingAddressSection + ' div.s2member-pro-paypal-sp-checkout-form-div :input').attr (ariaTrue); /**/ (!taxMayApply) ? $ajaxTaxDiv.hide () : null; /* Tax does NOT even apply. */ /**/ $(billingAddressSection).show (), $(submissionSection + ' input#s2member-pro-paypal-sp-checkout-submit').replaceWith (submitButton); /**/ (eventTrigger) ? $(billingMethodSection + ' input#s2member-pro-paypal-sp-checkout-card-number').focus () : null; } else if ($.inArray (billingMethod, ['Maestro', 'Solo']) !== -1) { $(billingMethodSection + ' div.s2member-pro-paypal-sp-checkout-form-div').show (); $(billingMethodSection + ' div.s2member-pro-paypal-sp-checkout-form-div :input').attr (ariaTrue); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-sp-checkout-form-div').show (); $(billingAddressSection + ' div.s2member-pro-paypal-sp-checkout-form-div :input').attr (ariaTrue); /**/ (!taxMayApply) ? $ajaxTaxDiv.hide () : null; /* Tax does NOT even apply. */ /**/ $(billingAddressSection).show (), $(submissionSection + ' input#s2member-pro-paypal-sp-checkout-submit').replaceWith (submitButton); /**/ (eventTrigger) ? $(billingMethodSection + ' input#s2member-pro-paypal-sp-checkout-card-number').focus () : null; } else if ((!billingMethod || billingMethod === 'PayPal') && taxMayApply) { $(billingMethodSection + ' div.s2member-pro-paypal-sp-checkout-form-div').show (); $(billingMethodSection + ' div.s2member-pro-paypal-sp-checkout-form-div :input').attr (ariaTrue); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-number-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-number-div :input').attr (ariaFalse); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-expiration-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-expiration-div :input').attr (ariaFalse); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-verification-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-verification-div :input').attr (ariaFalse); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-start-date-issue-number-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-start-date-issue-number-div :input').attr (ariaFalse); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-sp-checkout-form-div').show (); $(billingAddressSection + ' div.s2member-pro-paypal-sp-checkout-form-div :input').attr (ariaTrue); /**/ $(billingAddressSection + ' div#s2member-pro-paypal-sp-checkout-form-street-div').hide (); $(billingAddressSection + ' div#s2member-pro-paypal-sp-checkout-form-street-div :input').attr (ariaFalse); /**/ $(billingAddressSection + ' div#s2member-pro-paypal-sp-checkout-form-city-div').hide (); $(billingAddressSection + ' div#s2member-pro-paypal-sp-checkout-form-city-div :input').attr (ariaFalse); /**/ $(billingAddressSection).show (), $(submissionSection + ' input#s2member-pro-paypal-sp-checkout-submit').replaceWith (submitExpressCheckoutButton); /**/ (eventTrigger) ? $(billingAddressSection + ' input#s2member-pro-paypal-sp-checkout-state').focus () : null; } else if (!billingMethod || billingMethod === 'PayPal') { $(billingMethodSection + ' div.s2member-pro-paypal-sp-checkout-form-div').hide (); $(billingMethodSection + ' div.s2member-pro-paypal-sp-checkout-form-div :input').attr (ariaFalse); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-type-div').show (); $(billingMethodSection + ' div#s2member-pro-paypal-sp-checkout-form-card-type-div :input').attr (ariaTrue); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-sp-checkout-form-div').hide (); $(billingAddressSection + ' div.s2member-pro-paypal-sp-checkout-form-div :input').attr (ariaFalse); /**/ $(billingAddressSection).hide (), $(submissionSection + ' input#s2member-pro-paypal-sp-checkout-submit').replaceWith (submitExpressCheckoutButton); /**/ (eventTrigger) ? $(submissionSection + ' input#s2member-pro-paypal-sp-checkout-submit').focus () : null; } /**/ handleTaxIssues (); /* Tax issues. */ }) (); /**/ $(cardType).click (handleBillingMethod).change (handleBillingMethod); /**/ $(couponApplyButton).click (function() /* Only applying coupon. */ { $(submissionNonceVerification).val ('apply-coupon'), $spForm.submit (); }); /**/ $spForm.submit (function() /* Form validation. */ { if ($(submissionNonceVerification).val () !== 'apply-coupon') { var context = this, label = '', error = '', errors = ''; /**/ var $recaptchaResponse = $(captchaSection + ' input#recaptcha_response_field'); /**/ if (!$(cardType + ':checked').val ()) { $(cardType).val (['PayPal']); } /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().children ('span').first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ else if ($recaptchaResponse.length && !$recaptchaResponse.val ()) { alert('— Oops, you missed something: —\n\nSecurity Code missing. Please try again.'); /**/ return false; } } /**/ $(submissionButton).attr (disabled), ws_plugin__s2member_animateProcessing($(submissionButton)), $(couponApplyButton).attr (disabled); /**/ return true; }); } /**/ else if (($coForm = $('form#s2member-pro-paypal-checkout-form')).length === 1) { var handleCouponIssues, handleTaxIssues, taxMayApply = true, calculateTax, cTaxDelay, cTaxTimeout, cTaxReq, cTaxLocation, handlePasswordIssues, handleBillingMethod, handleExistingUsers, couponSection = 'div#s2member-pro-paypal-checkout-form-coupon-section', couponApplyButton = couponSection + ' input#s2member-pro-paypal-checkout-coupon-apply', registrationSection = 'div#s2member-pro-paypal-checkout-form-registration-section', customFieldsSection = 'div#s2member-pro-paypal-checkout-form-custom-fields-section', billingMethodSection = 'div#s2member-pro-paypal-checkout-form-billing-method-section', cardType = billingMethodSection + ' input[name="s2member_pro_paypal_checkout\[card_type\]"]', billingAddressSection = 'div#s2member-pro-paypal-checkout-form-billing-address-section', $ajaxTaxDiv = $(billingAddressSection + ' div#s2member-pro-paypal-checkout-form-ajax-tax-div'), captchaSection = 'div#s2member-pro-paypal-checkout-form-captcha-section', submissionSection = 'div#s2member-pro-paypal-checkout-form-submission-section', submissionNonceVerification = submissionSection + ' input#s2member-pro-paypal-checkout-nonce', submissionButton = submissionSection + ' input#s2member-pro-paypal-checkout-submit'; /**/ var submitButton = 'input type="submit" id="s2member-pro-paypal-checkout-submit" class="s2member-pro-paypal-checkout-submit" value="Submit Form" tabindex="410" /'; var submitExpressCheckoutButton = 'input type="image" src="?php echo $i ; ?/paypal-xco.gif" id="s2member-pro-paypal-checkout-submit" class="s2member-pro-paypal-checkout-submit" value="Submit Form" tabindex="410" /'; /**/ ws_plugin__s2member_animateProcessing($(submissionButton), 'reset'), $(submissionButton).removeAttr ('disabled'), $(couponApplyButton).removeAttr ('disabled'); /**/ (handleCouponIssues = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if ($(submissionSection + ' input#s2member-pro-paypal-checkout-coupons-not-required-or-not-possible').length) { $(couponSection).hide (); /* Not accepting Coupons on this particular form. */ } else /* This is turned off by default for smoother loading. ( via: display:none ). */ $(couponSection).show (); /* OK. So we need to display this now. */ }) (); /**/ (handleTaxIssues = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if ($(submissionSection + ' input#s2member-pro-paypal-checkout-tax-not-required-or-not-possible').length) { $ajaxTaxDiv.hide (), taxMayApply = false; /* Tax does NOT even apply. */ } }) (); /**/ (calculateTax = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if (taxMayApply && !(eventTrigger && eventTrigger.interval && document.activeElement.id === 's2member-pro-paypal-checkout-country')) { var attr = $(submissionSection + ' input#s2member-pro-paypal-checkout-attr').val (); var state = $.trim ($(billingAddressSection + ' input#s2member-pro-paypal-checkout-state').val ()); var country = $(billingAddressSection + ' select#s2member-pro-paypal-checkout-country').val (); var zip = $.trim ($(billingAddressSection + ' input#s2member-pro-paypal-checkout-zip').val ()); var thisTaxLocation = state + '|' + country + '|' + zip; /* Three part location. */ /**/ if (state && country && zip && thisTaxLocation && (!cTaxLocation || cTaxLocation !== thisTaxLocation) && (cTaxLocation = thisTaxLocation)) { (cTaxReq) ? cTaxReq.abort () : null, clearTimeout(cTaxTimeout), cTaxTimeout = null; /* Abort / clear. */ /**/ $ajaxTaxDiv.html ('divimg src="?php echo $vars [ "i" ] ; ?/ajax-loader.gif" alt="Calculating Sales Tax..." / calculating sales tax.../div'); /**/ cTaxTimeout = setTimeout(function() /* Create a new cTaxTimeout with a one second delay. */ { cTaxReq = $.post ('?php echo c_ws_plugin__s2member_utils_strings:: esc_sq ( admin_url ( "/admin-ajax.php" ) ) ; ?', {'action': 'ws_plugin__s2member_pro_paypal_ajax_tax', 'ws_plugin__s2member_pro_paypal_ajax_tax': '?php echo c_ws_plugin__s2member_utils_strings:: esc_sq (c_ws_plugin__s2member_utils_encryption:: encrypt ( "ws-plugin--s2member-pro-paypal-ajax-tax" ) ) ; ?', 'ws_plugin__s2member_pro_paypal_ajax_tax_vars[attr]': attr, 'ws_plugin__s2member_pro_paypal_ajax_tax_vars[state]': state, 'ws_plugin__s2member_pro_paypal_ajax_tax_vars[country]': country, 'ws_plugin__s2member_pro_paypal_ajax_tax_vars[zip]': zip}, function(response, textStatus) { clearTimeout(cTaxTimeout), cTaxTimeout = null; /* Clear cTaxTimeout. */ /**/ try /* Try/catch here. jQuery will sometimes return a successful response in IE, whenever the connection is aborted with a null response. */ { $ajaxTaxDiv.html ('divstrongSales Tax' + ((response.trial) ? ' Today' : '') + ':/strong ' + ((response.tax_per) ? 'em' + response.tax_per + '/em ( ' + response.cur_symbol + '' + response.tax + ' )' : response.cur_symbol + '' + response.tax) + 'br /strong— Total' + ((response.trial) ? ' Today' : '') + ':/strong ' + response.cur_symbol + '' + response.total + '/div'); } catch (e) {} /**/ }, 'json'); /**/ }, ((eventTrigger && eventTrigger.keyCode) ? 1000 : 100)); } /**/ else if (!state || !country || !zip || !thisTaxLocation) $ajaxTaxDiv.html (''), cTaxLocation = null; } }) (); /**/ cTaxDelay = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { setTimeout(function() /* Trigger event handler with a brief delay. */ { calculateTax(eventTrigger); }, 10); /* Brief delay. */ } /**/ $(billingAddressSection + ' input#s2member-pro-paypal-checkout-state').bind ('keyup blur', calculateTax).bind ('cut paste', cTaxDelay); $(billingAddressSection + ' input#s2member-pro-paypal-checkout-zip').bind ('keyup blur', calculateTax).bind ('cut paste', cTaxDelay); $(billingAddressSection + ' select#s2member-pro-paypal-checkout-country').bind ('change', calculateTax); /**/ setInterval(function() /* Helps with things like Google's Autofill feature. */ { calculateTax({interval: true}); /* Identify as interval trigger. */ }, 1000); /**/ (handlePasswordIssues = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if ($(submissionSection + ' input#s2member-pro-paypal-checkout-password-not-required-or-not-possible').length) { $(registrationSection + ' div#s2member-pro-paypal-checkout-form-password-div').hide (); $(registrationSection + ' div#s2member-pro-paypal-checkout-form-password-div :input').attr (ariaFalseDis); } }) (); /**/ (handleExistingUsers = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN) /* If User/Member is already logged in. */ { $(registrationSection + ' input#s2member-pro-paypal-checkout-first-name').each (function() { var $this = $(this), val = $this.val (); (!val) ? $this.val (S2MEMBER_CURRENT_USER_FIRST_NAME) : null; }); /**/ $(registrationSection + ' input#s2member-pro-paypal-checkout-last-name').each (function() { var $this = $(this), val = $this.val (); (!val) ? $this.val (S2MEMBER_CURRENT_USER_LAST_NAME) : null; }); /**/ $(registrationSection + ' input#s2member-pro-paypal-checkout-email').val (S2MEMBER_CURRENT_USER_EMAIL).attr (ariaFalseDis); $(registrationSection + ' input#s2member-pro-paypal-checkout-username').val (S2MEMBER_CURRENT_USER_LOGIN).attr (ariaFalseDis); /**/ $(registrationSection + ' div#s2member-pro-paypal-checkout-form-password-div').hide (); $(registrationSection + ' div#s2member-pro-paypal-checkout-form-password-div :input').attr (ariaFalseDis); /**/ $(customFieldsSection).hide (), $(customFieldsSection + ' :input').attr (ariaFalseDis); } }) (); /**/ (handleBillingMethod = function(eventTrigger) /* eventTrigger is passed by jQuery for DOM events. */ { var billingMethod = $(cardType + ':checked').val (); /* Billing Method. */ /**/ if ($.inArray (billingMethod, ['Visa', 'MasterCard', 'Amex', 'Discover']) !== -1) { $(billingMethodSection + ' div.s2member-pro-paypal-checkout-form-div').show (); $(billingMethodSection + ' div.s2member-pro-paypal-checkout-form-div :input').attr (ariaTrue); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-start-date-issue-number-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-start-date-issue-number-div :input').attr (ariaFalse); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-checkout-form-div').show (); $(billingAddressSection + ' div.s2member-pro-paypal-checkout-form-div :input').attr (ariaTrue); /**/ (!taxMayApply) ? $ajaxTaxDiv.hide () : null; /* Tax does NOT even apply. */ /**/ $(billingAddressSection).show (), $(submissionSection + ' input#s2member-pro-paypal-checkout-submit').replaceWith (submitButton); /**/ (eventTrigger) ? $(billingMethodSection + ' input#s2member-pro-paypal-checkout-card-number').focus () : null; } else if ($.inArray (billingMethod, ['Maestro', 'Solo']) !== -1) { $(billingMethodSection + ' div.s2member-pro-paypal-checkout-form-div').show (); $(billingMethodSection + ' div.s2member-pro-paypal-checkout-form-div :input').attr (ariaTrue); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-checkout-form-div').show (); $(billingAddressSection + ' div.s2member-pro-paypal-checkout-form-div :input').attr (ariaTrue); /**/ (!taxMayApply) ? $ajaxTaxDiv.hide () : null; /* Tax does NOT even apply. */ /**/ $(billingAddressSection).show (), $(submissionSection + ' input#s2member-pro-paypal-checkout-submit').replaceWith (submitButton); /**/ (eventTrigger) ? $(billingMethodSection + ' input#s2member-pro-paypal-checkout-card-number').focus () : null; } else if ((!billingMethod || billingMethod === 'PayPal') && taxMayApply) { $(billingMethodSection + ' div.s2member-pro-paypal-checkout-form-div').show (); $(billingMethodSection + ' div.s2member-pro-paypal-checkout-form-div :input').attr (ariaTrue); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-number-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-number-div :input').attr (ariaFalse); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-expiration-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-expiration-div :input').attr (ariaFalse); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-verification-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-verification-div :input').attr (ariaFalse); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-start-date-issue-number-div').hide (); $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-start-date-issue-number-div :input').attr (ariaFalse); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-checkout-form-div').show (); $(billingAddressSection + ' div.s2member-pro-paypal-checkout-form-div :input').attr (ariaTrue); /**/ $(billingAddressSection + ' div#s2member-pro-paypal-checkout-form-street-div').hide (); $(billingAddressSection + ' div#s2member-pro-paypal-checkout-form-street-div :input').attr (ariaFalse); /**/ $(billingAddressSection + ' div#s2member-pro-paypal-checkout-form-city-div').hide (); $(billingAddressSection + ' div#s2member-pro-paypal-checkout-form-city-div :input').attr (ariaFalse); /**/ $(billingAddressSection).show (), $(submissionSection + ' input#s2member-pro-paypal-checkout-submit').replaceWith (submitExpressCheckoutButton); /**/ (eventTrigger) ? $(billingAddressSection + ' input#s2member-pro-paypal-checkout-state').focus () : null; } else if (!billingMethod || billingMethod === 'PayPal') { $(billingMethodSection + ' div.s2member-pro-paypal-checkout-form-div').hide (); $(billingMethodSection + ' div.s2member-pro-paypal-checkout-form-div :input').attr (ariaFalse); /**/ $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-type-div').show (); $(billingMethodSection + ' div#s2member-pro-paypal-checkout-form-card-type-div :input').attr (ariaTrue); /**/ $(billingAddressSection + ' div.s2member-pro-paypal-checkout-form-div').hide (); $(billingAddressSection + ' div.s2member-pro-paypal-checkout-form-div :input').attr (ariaFalse); /**/ $(billingAddressSection).hide (), $(submissionSection + ' input#s2member-pro-paypal-checkout-submit').replaceWith (submitExpressCheckoutButton); /**/ (eventTrigger) ? $(submissionSection + ' input#s2member-pro-paypal-checkout-submit').focus () : null; } }) (); /**/ $(cardType).click (handleBillingMethod).change (handleBillingMethod); /**/ $(couponApplyButton).click (function() /* Only applying coupon. */ { $(submissionNonceVerification).val ('apply-coupon'), $coForm.submit (); }); /**/ $(registrationSection + ' div#s2member-pro-paypal-checkout-form-password-div :input').keyup (function() { ws_plugin__s2member_passwordStrength($(registrationSection + ' input#s2member-pro-paypal-checkout-username'), $(registrationSection + ' input#s2member-pro-paypal-checkout-password1'), $(registrationSection + ' input#s2member-pro-paypal-checkout-password2'), $(registrationSection + ' div#s2member-pro-paypal-checkout-form-password-strength')); }); /**/ $coForm.submit (function() /* Form validation. */ { if ($(submissionNonceVerification).val () !== 'apply-coupon') { var context = this, label = '', error = '', errors = ''; /**/ var $recaptchaResponse = $(captchaSection + ' input#recaptcha_response_field'); /**/ var $password1 = $(registrationSection + ' input#s2member-pro-paypal-checkout-password1[aria-required="true"]'); var $password2 = $(registrationSection + ' input#s2member-pro-paypal-checkout-password2'); /**/ if (!$(cardType + ':checked').val ()) { $(cardType).val (['PayPal']); } /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().children ('span').first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ else if ($password1.length && $.trim ($password1.val ()) !== $.trim ($password2.val ())) { alert('— Oops, you missed something: —\n\nPasswords do not match up. Please try again.'); /**/ return false; } /**/ else if ($recaptchaResponse.length && !$recaptchaResponse.val ()) { alert('— Oops, you missed something: —\n\nSecurity Code missing. Please try again.'); /**/ return false; } } /**/ $(submissionButton).attr (disabled), ws_plugin__s2member_animateProcessing($(submissionButton)), $(couponApplyButton).attr (disabled); /**/ return true; }); } /**/ (jumpToResponses = function() /* Jump to form responses. */ { $('div#s2member-pro-paypal-form-response').each (function() { var offset = $(this).offset (); window.scrollTo (0, offset.top - 100); }); }) (); }); [ full view ]s2member-pro\includes\separates\gateways\paypal\paypal.js Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code(!-- :: s-words --)

Statistics: Posted by System Robot — July 11th, 2011, 5:39 pm


]]>
2011-07-09T06:19:53-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13396&p=25691#p25691 <![CDATA[s2Member v111220 / Source Code: s2member-p...]]>
s2Member v111220
Source Code: s2member-pro\includes\separates\gateways\paypal\paypal.js
Docs updated: December 20, 2011, 9:53 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — July 9th, 2011, 6:19 am


]]>