1(function(a){if(typeof a.sprintf!=="function"){a.sprintf=function(){var g=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuidfegEG])/g;var h=arguments,f=0,k=h[f++];var b=function(o,i,l,n){if(!l){l=" "}var m=(o.length>=i)?"":Array(1+i-o.length>>>0).join(l);return n?o+m:m+o};var c=function(n,m,q,i,l,p){var o=i-n.length;if(o>0){if(q||!l){n=b(n,i,p,q)}else{n=n.slice(0,m.length)+b("",o,"0",true)+n.slice(m.length)}}return n};var j=function(q,p,o,r,l,i,n){var m=q>>>0;o=o&&m&&{"2":"0b","8":"0","16":"0x"}[p]||"";q=o+b(m.toString(p),i||0,"0",false);return c(q,o,r,l,n)};var e=function(n,p,l,i,m,o){if(i!=null){n=n.slice(0,i)}return c(n,"",p,l,m,o)};var d=function(A,n,o,s,C,x,m){var i;var w;var l;var B;var u;if(A=="%%"){return"%"}var t=false,p="",r=false,z=false,y=" ";var q=o.length;for(var v=0;o&&v<q;v++){switch(o.charAt(v)){case" ":p=" ";break;case"+":p="+";break;case"-":t=true;break;case"'":y=o.charAt(v+1);break;case"0":r=true;break;case"#":z=true;break}}if(!s){s=0}else{if(s=="*"){s=+h[f++]}else{if(s.charAt(0)=="*"){s=+h[s.slice(1,-1)]}else{s=+s}}}if(s<0){s=-s;t=true}if(!isFinite(s)){throw new Error("sprintf: (minimum-)width must be finite")}if(!x){x="fFeE".indexOf(m)>-1?6:(m=="d")?0:undefined}else{if(x=="*"){x=+h[f++]}else{if(x.charAt(0)=="*"){x=+h[x.slice(1,-1)]}else{x=+x}}}u=n?h[n.slice(0,-1)]:h[f++];switch(m){case"s":return e(String(u),t,s,x,r,y);case"c":return e(String.fromCharCode(+u),t,s,x,r);case"b":return j(u,2,z,t,s,x,r);case"o":return j(u,8,z,t,s,x,r);case"x":return j(u,16,z,t,s,x,r);case"X":return j(u,16,z,t,s,x,r).toUpperCase();case"u":return j(u,10,z,t,s,x,r);case"i":case"d":i=(+u)|0;w=i<0?"-":p;u=w+b(String(Math.abs(i)),x,"0",false);return c(u,w,t,s,r);case"e":case"E":case"f":case"F":case"g":case"G":i=+u;w=i<0?"-":p;l=["toExponential","toFixed","toPrecision"]["efg".indexOf(m.toLowerCase())];B=["toString","toUpperCase"]["eEfFgG".indexOf(m)%2];u=w+Math.abs(i)[l](x);return c(u,w,t,s,r)[B]();default:return A}};return k.replace(g,d)}}})(jQuery); 2var S2MEMBER_CURRENT_USER_IS_LOGGED_IN = false,S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER = false,S2MEMBER_CURRENT_USER_FIRST_NAME = '',S2MEMBER_CURRENT_USER_LAST_NAME = '',S2MEMBER_CURRENT_USER_LOGIN = '',S2MEMBER_CURRENT_USER_EMAIL = '',S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED = 0,S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED = false,S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY = 0,S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS = 0; 3jQuery(document).ready(function(d){window.ws_plugin__s2member_skip_all_file_confirmations=window.ws_plugin__s2member_skip_all_file_confirmations||false;var c='',a='s2member-files',b=ws_plugin__s2member_skip_all_file_confirmations?true:false,e=[];window.ws_plugin__s2member_passwordMinLength=function(){return parseInt("8")};window.ws_plugin__s2member_passwordMinStrengthCode=function(){return"good"};window.ws_plugin__s2member_passwordMinStrengthLabel=function(){return"`good` or `strong` (i.e., use numbers, letters, and mixed caSe)"};window.ws_plugin__s2member_passwordMinStrengthScore=function(){return parseInt("30")};window.ws_plugin__s2member_passwordStrengthMeter=function(j,g,i){var h=0,f=ws_plugin__s2member_passwordMinLength();j=String(j);g=String(g);if(j!=g&&g.length>0){return"mismatch"}else{if(j.length<1){return"empty"}else{if(j.length<f){return"short"}}}if(j.match(/[0-9]/)){h+=10}if(j.match(/[a-z]/)){h+=10}if(j.match(/[A-Z]/)){h+=10}if(j.match(/[^0-9a-zA-Z]/)){h=h===30?h+20:h+10}if(i){return h}if(h<30){return"weak"}if(h<50){return"good"}return"strong"};window.ws_plugin__s2member_passwordStrength=function(h,k,i,g){if(h instanceof jQuery&&k instanceof jQuery&&i instanceof jQuery&&g instanceof jQuery){var j={empty:'Strength indicator',"short":'Very weak',weak:'Weak',good:'Good',strong:'Strong',mismatch:'Mismatch'};g.removeClass("ws-plugin--s2member-password-strength-short");g.removeClass("ws-plugin--s2member-password-strength-weak");g.removeClass("ws-plugin--s2member-password-strength-good");g.removeClass("ws-plugin--s2member-password-strength-strong");g.removeClass("ws-plugin--s2member-password-strength-mismatch");g.removeClass("ws-plugin--s2member-password-strength-empty");var f=ws_plugin__s2member_passwordStrengthMeter(k.val(),i.val());g.addClass("ws-plugin--s2member-password-strength-"+f).html(j[f])}};window.ws_plugin__s2member_validationErrors=function(r,q,g,m,l){if(typeof r==="string"&&r&&typeof q==="object"&&typeof g==="object"){if(typeof q.tagName==="string"&&/^(input|textarea|
3select)$/i.test(q.tagName)&&!q.disabled){var t=q.tagName.toLowerCase(),p=d(q),o=d.trim(p.attr("type")).toLowerCase(),f=d.trim(p.attr("name")),s=p.val();m=(typeof m==="boolean")?m:(p.attr("aria-required")==="true"),l=(typeof l==="string")?l:d.trim(p.attr("data-expected"));var k=('0'>0);var i=new RegExp('^()@',"i");if(t==="input"&&o==="checkbox"&&/\[\]$/.test(f)){if(typeof q.id==="string"&&/-0$/.test(q.id)){if(m&&!d('input[name="'+ws_plugin__s2member_escjQAttr(f)+'"]:checked',g).length){return r+'\nPlease check at least one of the boxes.'}}}else{if(t==="input"&&o==="checkbox"){if(m&&!q.checked){return r+'\nRequired. This box must be checked.'}}else{if(t==="input"&&o==="radio"){if(typeof q.id==="string"&&/-0$/.test(q.id)){if(m&&!d('input[name="'+ws_plugin__s2member_escjQAttr(f)+'"]:checked',g).length){return r+'\nPlease select one of the options.'}}}else{if(t==="select"&&p.attr("multiple")){if(m&&(!(s instanceof Array)||!s.length)){return r+'\nPlease select at least one of the options.'}}else{if(typeof s!=="string"||(m&&!(s=d.trim(s)).length)){return r+'\nThis is a required field, please try again.'}else{if((s=d.trim(s)).length&&((t==="input"&&/^(text|password)$/i.test(o))||t==="textarea")&&typeof l==="string"&&l.length){if(l==="numeric-wp-commas"&&(!/^[0-9\.,]+$/.test(s)||isNaN(s.replace(/,/g,"")))){return r+'\nMust be numeric (with or without decimals, commas allowed).'}else{if(l==="numeric"&&(!/^[0-9\.]+$/.test(s)||isNaN(s))){return r+'\nMust be numeric (with or without decimals, no commas).'}else{if(l==="integer"&&(!/^[0-9]+$/.test(s)||isNaN(s))){return r+'\nMust be an integer (a whole number, without any decimals).'}else{if(l==="integer-gt-0"&&(!/^[0-9]+$/.test(s)||isNaN(s)||s<=0)){return r+'\nMust be an integer > 0 (whole number, no decimals, greater than 0).'}else{if(l==="float"&&(!/^[0-9\.]+$/.test(s)||!/[0-9]/.test(s)||!/\./.test(s)||isNaN(s))){return r+'\nMust be a float (floating point number, decimals required).'}else{if(l==="float-gt-0"&&(!/^[0-9\.]+$/.test(s)||!/[0-9]/.test(s)||!/\./.test(s)||isNaN(s)||s<=0)){return r+'\nMust be a float > 0 (floating point number, decimals required, greater than 0).'}else{if(l==="date"&&!/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/.test(s)){return r+'\nMust be a date (required date format: dd/mm/yyyy).'}else{if(l==="email"&&!/^[a-zA-Z0-9_!#$%&*+=?`{}~|\/\^\'\-]+(?:\.?[a-zA-Z0-9_!#$%&*+=?`{}~|\/\^\'\-]+)*@[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*(?:\.[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*)*(?:\.[a-zA-Z][a-zA-Z0-9]+)?$/.test(s)){return r+'\nMust be a valid email address.'}else{if(l==="email"&&k&&i.test(s)){return r+"\n"+d.sprintf('Please use a personal email address.\nAddresses like <%s@> are problematic.',s.split("@")[0])}else{if(l==="url"&&!/^https?\:\/\/.+$/i.test(s)){return r+'\nMust be a full URL (starting with http or https).'}else{if(l==="domain"&&!/^[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*(?:\.[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*)*(?:\.[a-zA-Z][a-zA-Z0-9]+)?$/.test(s)){return r+'\nMust be a domain name (domain name only, without http).'}else{if(l==="phone"&&(!/^[0-9 ()\-]+$/.test(s)||s.replace(/[^0-9]+/g,"").length!==10)){return r+'\nMust be a phone # (10 digits w/possible hyphens, spaces, brackets).'}else{if(l==="uszip"&&!/^[0-9]{5}(?:\-[0-9]{4})?$/.test(s)){return r+'\nMust be a US zipcode (5-9 digits w/ possible hyphen).'}else{if(l==="cazip"&&!/^[0-9A-Z]{3} ?[0-9A-Z]{3}$/i.test(s)){return r+'\nMust be a Canadian zipcode (6 alpha-numerics w/possible space).'}else{if(l==="uczip"&&!/^[0-9]{5}(?:\-[0-9]{4})?$/.test(s)&&!/^[0-9A-Z]{3} ?[0-9A-Z]{3}$/i.test(s)){return r+'\nMust be a zipcode (either a US or Canadian zipcode).'}else{if(l==="ukpostcode"&&!/^(([a-zA-Z]{1,2}[0-9][a-zA-Z0-9]?|ASCN|STHL|TDCU|BBND|[BFS]IQQ|PCRN|TKCA) ?[0-9][a-zA-Z]{2}|BFPO ?[0-9]{1,4}|(KY[0-9]|MSR|VG|AI)[ -]?[0-9]{4}|[a-zA-Z]{2} ?[0-9]{2}|GE ?CX|GIR ?0A{2}|SAN ?TA1)$/.test(s)){return r+'\nMust be a valid UK postcode.'}else{if(/^alphanumerics\-spaces\-punctuation\-[0-9]+(?:\-e)?$/.test(l)&&!/^[a-z 0-9\/\\\\,.?:;"\'{}[\]\^|+=_()*&%$#@!`~\-]+$/i.test(s)){return r+'\nPlease use alphanumerics, spaces & punctuation only.'}else{if(/^alphanumerics\-spaces\-[0-9]+(?:\-e)?$/.test(l)&&!/^[a-z 0-9]+$/i.test(s)){return r+'\nPlease use alphanumerics & spaces only.'}else{if(/^alphanumerics\-punctuation\-[0-9]+(?:\-e)?$/.test(l)&&!/^[a-z0-9\/\\\\,.?:;"\'{}[\]\^|+=_()*&%$#@!`~\-]+$/i.test(s)){return r+'\nPlease use alphanumerics & punctuation only (no spaces).'}else{if(/^alphanumerics\-[0-9]+(?:\-e)?$/.test(l)&&!/^[a-z0-9]+$/i.test(s)){return r+'\nPlease use alphanumerics only (no spaces/punctuation).'}else{if(/^alphabetics\-[0-9]+(?:\-e)?$/.test(l)&&!/^[a-z]+$/i.test(s)){return r+'\nPlease use alphabetics only (no digits/spaces
3/punctuation).'}else{if(/^numerics\-[0-9]+(?:\-e)?$/.test(l)&&!/^[0-9]+$/i.test(s)){return r+'\nPlease use numeric digits only.'}else{if(/^(?:any|alphanumerics\-spaces\-punctuation|alphanumerics\-spaces|alphanumerics\-punctuation|alphanumerics|alphabetics|numerics)\-[0-9]+(?:\-e)?$/.test(l)){var n=l.split("-"),h=Number(n[1]),j=(n.length>2&&n[2]==="e");if(j&&s.length!==h){return r+"\n"+d.sprintf('Must be exactly %s %s.',h,((n[0]==="numerics")?((h===1)?'digit':'digits'):((h===1)?'character':'characters')))}else{if(s.length<h){return r+"\n"+d.sprintf('Must be at least %s %s.',h,((n[0]==="numerics")?((h===1)?'digit':'digits'):((h===1)?'character':'characters')))}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}return""};window.ws_plugin__s2member_animateProcessing=function(g,f){if(f){d(g).removeClass("ws-plugin--s2member-animate-processing")}else{d(g).addClass("ws-plugin--s2member-animate-processing")}};window.ws_plugin__s2member_escAttr=window.ws_plugin__s2member_escHtml=function(f){if(/[&\<\>"']/.test(f=String(f))){f=f.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),f=f.replace(/"/g,""").replace(/'/g,"'")}return f};window.ws_plugin__s2member_escjQAttr=function(f){return String(f).replace(/([.:\[\]])/g,"\\$1")};if(!b&&S2MEMBER_CURRENT_USER_IS_LOGGED_IN&&S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY<S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED){d('a[href*="s2member_file_download="], a[href*="/s2member-files/"], a[href^="s2member-files/"], a[href*="/'+a.replace(/([\:\.\[\]])/g,"\\$1")+'/"], a[href^="'+a.replace(/([\:\.\[\]])/g,"\\$1")+'/"]').click(function(){if(!/s2member[_\-]file[_\-]download[_\-]key[\=\-].+/i.test(this.href)){var f='â Confirm File Download â\n\n';f+=d.sprintf('You`ve downloaded %s protected %s in the last %s.',S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY,((S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY===1)?'file':'files'),((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS===1)?'24 hours':d.sprintf('%s days',S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS)))+"\n\n";f+=(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)?'You`re entitled to UNLIMITED downloads though (so, no worries).':d.sprintf('You`re entitled to %s unique %s %s.',S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED,((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED===1)?'download':'downloads'),((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS===1)?'each day':d.sprintf('every %s-day period',S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS)));if((/s2member[_\-]skip[_\-]confirmation/i.test(this.href)&&!/s2member[_\-]skip[_\-]confirmation[\=\-](0|no|false)/i.test(this.href))||confirm(f)){if(d.inArray(this.href,e)===-1){S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY++,e.push(this.href)}return true}return false}return true})}if(!/\/wp-admin([\/?#]|$)/i.test(location.href)){d("input#ws-plugin--s2member-profile-password1, input#ws-plugin--s2member-profile-password2").on("keyup initialize.s2",function(){ws_plugin__s2member_passwordStrength(d("input#ws-plugin--s2member-profile-login"),d("input#ws-plugin--s2member-profile-password1"),d("input#ws-plugin--s2member-profile-password2"),d("div#ws-plugin--s2member-profile-password-strength"))}).trigger("initialize.s2");d("form#ws-plugin--s2member-profile").submit(function(){var h=this,g="",f="",l="",j=d("input#ws-plugin--s2member-profile-password1",h),i=d("input#ws-plugin--s2member-profile-password2",h);var k=d("input#ws-plugin--s2member-profile-submit",h);d(":input",h).each(function(){var m=d.trim(d(this).attr("id")).replace(/---[0-9]+$/g,"");if(m&&(g=d.trim(d('label[for="'+m+'"]',h).first().children("strong").first().text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){l+=f+"\n\n"}}});if(l=d.trim(l)){alert('â Oops, you missed something: â\n\n'+l);return false}else{if(d.trim(j.val())&&d.trim(j.val())!==d.trim(i.val())){alert('â Oops, you missed something: â\n\nPasswords do not match up. Please try again.');return false}else{if(d.trim(j.val())&&d.trim(j.val()).length<ws_plugin__s2member_passwordMinLength()){alert('â Oops, you missed something: â\n\nPassword MUST be at least 8 characters. Please try again.');return false}else{if(d.trim(j.val())&&ws_plugin__s2member_passwordStrengthMeter(d.trim(j.val()),d.trim(i.val()),true)<ws_plugin__s2member_passwordMinStrengthScore()){alert('â Oops, you missed something: â\n\nPassword strength MUST be `good` or `strong` (i.e., use numbers, letters, and mixed caSe). Please try again.');return false}}}}ws_plugin__s2member_animateProcessing(k);return true})}if(/\/wp-signup\.php/i.test(location.href)){d("div#content > div.mu_register > form#setupform").submit(function(){var h=this,g="",f="",j="",i=d('p.submit input[type="submit"]',h);d("input#user_email",h).attr("data-expected","email");d("input#user_name, input#user_email, input#blogname, input#blog_title, input#captcha_code",h).attr({"aria-required":"true"});d(":input",h).each(function(){var k=d.trim(d(this).attr("id")).replace(/---[0-9]+$/g,"");if(k&&(g=d.trim(d('label[for="'+k+'"]',h).first().text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){j+=f+"\n\n"}}});if(j=d.trim(j)){alert('â Oops, you missed something: â\n\n'+j);return false}ws_plugin__s2member_animateProcessing(i);return true})}if(/\/wp-login\.php/i.test(location.href)){d("div#login > form#registerform input#user_login").attr("tabindex","10");d("div#login > form#registerform input#user_email").attr("tabindex","20");d("div#login > form#registerform input#wp-submit").attr("tabindex","1000");d("input#ws-plugin--s2member-custom-reg-field-user-pass1, input#ws-plugin--s2member-custom-reg-field-user-pass2").on("keyup initialize.s2",function(){ws_plugin__s2member_passwordStrength(d("input#user_login"),d("input#ws-plugin--s2member-custom-reg-field-user-pass1"),d("input#ws-plugin--s2member-custom-reg-field-user-pass2"),d("div#ws-
3plugin--s2member-custom-reg-field-user-pass-strength"))}).trigger("initialize.s2");d("div#login > form#registerform").submit(function(){var h=this,g="",f="",l="",k=d('input#ws-plugin--s2member-custom-reg-field-user-pass1[aria-required="true"]',h),i=d("input#ws-plugin--s2member-custom-reg-field-user-pass2",h),j=d("input#wp-submit",h);d("input#user_email",h).attr("data-expected","email");d("input#user_login, input#user_email, input#captcha_code",h).attr({"aria-required":"true"});d(":input",h).each(function(){var m=d.trim(d(this).attr("id")).replace(/---[0-9]+$/g,"");if(d.inArray(m,["user_login","user_email","captcha_code"])!==-1){if((g=d.trim(d(this).parent("label").text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){l+=f+"\n\n"}}}else{if(m&&(g=d.trim(d('label[for="'+m+'"]',h).first().children("span").first().text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){l+=f+"\n\n"}}}});if(l=d.trim(l)){alert('â Oops, you missed something: â\n\n'+l);return false}else{if(k.length&&d.trim(k.val())!==d.trim(i.val())){alert('â Oops, you missed something: â\n\nPasswords do not match up. Please try again.');return false}else{if(k.length&&d.trim(k.val()).length<ws_plugin__s2member_passwordMinLength()){alert('â Oops, you missed something: â\n\nPassword MUST be at least 8 characters. Please try again.');return false}else{if(k.length&&ws_plugin__s2member_passwordStrengthMeter(d.trim(k.val()),d.trim(i.val()),true)<ws_plugin__s2member_passwordMinStrengthScore()){alert('â Oops, you missed something: â\n\nPassword strength MUST be `good` or `strong` (i.e., use numbers, letters, and mixed caSe). Please try again.');return false}}}}ws_plugin__s2member_animateProcessing(j);return true})}if(/\/wp-admin\/(?:user\/)?profile\.php/i.test(location.href)){d("form#your-profile").submit(function(){var h=this,g="",f="",i="";d("input#email",h).attr("data-expected","email");d(':input[id^="ws-plugin--s2member-profile-"]',h).each(function(){var j=d.trim(d(this).attr("id")).replace(/---[0-9]+$/g,"");if(j&&(g=d.trim(d('label[for="'+j+'"]',h).first().text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){i+=f+"\n\n"}}});if(i=d.trim(i)){alert('â Oops, you missed something: â\n\n'+i);return false}return true})}if(c){d("body.registration form div#ws-plugin--s2member-custom-reg-fields-4bp-section").closest("form").submit(function(){var h=this,g="",f="",i="";d("input#signup_email",h).attr("data-expected","email");d("input#signup_username, input#signup_email, input#signup_password, input#field_1",h).attr({"aria-required":"true"});d(":input",h).each(function(){var j=d.trim(d(this).attr("id")).replace(/---[0-9]+$/g,"");if(j&&(g=d.trim(d('label[for="'+j+'"]',h).first().text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){i+=f+"\n\n"}}});if(i=d.trim(i)){alert('â Oops, you missed something: â\n\n'+i);return false}return true});d("body.logged-in.profile.profile-edit :input.ws-plugin--s2member-profile-field-4bp").closest("form").submit(function(){var h=this,g="",f="",i="";d("input#field_1",h).attr({"aria-required":"true"});d(":input",h).each(function(){var j=d.trim(d(this).attr("id")).replace(/---[0-9]+$/g,"");if(j&&(g=d.trim(d('label[for="'+j+'"]',h).first().text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){i+=f+"\n\n"}}});if(i=d.trim(i)){alert('â Oops, you missed something: â\n\n'+i);return false}return true})}}); 4var S2MEMBER_PRO_VERSION = '220421'; 5jQuery(document).ready(function(a){}); 6var S2MEMBER_PRO_PAYPAL_GATEWAY = true; 7jQuery(document).ready(function(A){var e,r,k,n,q,L,z,x={"aria-required":"true"},b={"aria-required":"false"},B={disabled:"disabled"},i={"aria-required":"false",disabled:"disabled"};z=new Image(),z.src='https://betterbaking.com/wp-content/plugins/s2member/src/images/ajax-loader.gif';if(A("form.s2member-pro-paypal-registration-form").length>1||A("form.s2member-pro-paypal-checkout-form").length>1||A("form.s2member-pro-paypal-sp-checkout-form").length>1){return alert("Detected more than one s2Member Pro-Form.\n\nPlease use only ONE s2Member Pro-Form Shortcode on each Post/Page. Attempting to serve more than one Pro-Form on each Post/Page (even w/ DHTML) may result in unexpected/broken functionality.")}if((e=A("form#s2member-pro-paypal-cancellation-form")).length===1){var O="div#s2member-pro-paypal-cancellation-form-captcha-section",o="div#s2member-pro-paypal-cancellation-form-submission-section",w=A(o+" button#s2member-pro-paypal-cancellation-submit");ws_plugin__s2member_animateProcessing(w,"reset"),w.removeAttr("disabled");
7e.submit(function(){var U=this,S="",R="",V="";var T=A(O+" input#recaptcha_response_field, "+O+" #g-recaptcha-response");A(":input",U).each(function(){var W=A.trim(A(this).attr("id")).replace(/---[0-9]+$/g,"");if(W&&(S=A.trim(A('label[for="'+W+'"]',U).first().children("span").first().text().replace(/[\r\n\t]+/g," ")))){if(R=ws_plugin__s2member_validationErrors(S,this,U)){V+=R+"\n\n"}}});if(V=A.trim(V)){alert('â Oops, you missed something: â\n\n'+V);return false}else{if(T.length&&!T.val()){alert('â Oops, you missed something: â\n\nSecurity Verification missing. Please try again.');return false}}w.attr(B),ws_plugin__s2member_animateProcessing(w);return true})}else{if((r=A("form#s2member-pro-paypal-update-form")).length===1){var u,v="div#s2member-pro-paypal-update-form-billing-method-section",I="div#s2member-pro-paypal-update-form-billing-address-section",m=v+' input[name="s2member_pro_paypal_update[card_type]"]',O="div#s2member-pro-paypal-update-form-captcha-section",o="div#s2member-pro-paypal-update-form-submission-section",w=A(o+" button#s2member-pro-paypal-update-submit");ws_plugin__s2member_animateProcessing(w,"reset"),w.removeAttr("disabled");(u=function(R){var S=A(m+":checked").val();if(A.inArray(S,["Visa","MasterCard","Amex","Discover"])!==-1){A(v+" > div.s2member-pro-paypal-update-form-div").show();A(v+" > div.s2member-pro-paypal-update-form-div :input").attr(x);A(v+" > div#s2member-pro-paypal-update-form-card-start-date-issue-number-div").hide();A(v+" > div#s2member-pro-paypal-update-form-card-start-date-issue-number-div :input").attr(b);A(I+" > div.s2member-pro-paypal-update-form-div").show();A(I+" > div.s2member-pro-paypal-update-form-div :input").attr(x);A(I).show(),(R)?A(v+" input#s2member-pro-paypal-update-card-number").focus():null}else{if(A.inArray(S,["Maestro","Solo"])!==-1){A(v+" > div.s2member-pro-paypal-update-form-div").show();A(v+" > div.s2member-pro-paypal-update-form-div :input").attr(x);A(I+" > div.s2member-pro-paypal-update-form-div").show();A(I+" > div.s2member-pro-paypal-update-form-div :input").attr(x);A(I).show(),(R)?A(v+" input#s2member-pro-paypal-update-card-number").focus():null}else{if(!S){A(v+" > div.s2member-pro-paypal-update-form-div").hide();A(v+" > div.s2member-pro-paypal-update-form-div :input").attr(b);A(v+" > div#s2member-pro-paypal-update-form-card-type-div").show();A(v+" > div#s2member-pro-paypal-update-form-card-type-div :input").attr(x);A(I+" > div.s2member-pro-paypal-update-form-div").hide();A(I+" > div.s2member-pro-paypal-update-form-div :input").attr(b);A(I).hide(),(R)?A(o+" button#s2member-pro-paypal-update-submit").focus():null}}}})();A(m).click(u).change(u);r.submit(function(){var U=this,S="",R="",V="";var T=A(O+" input#recaptcha_response_field, "+O+" #g-recaptcha-response");if(!A(m+":checked").val()){alert('Please choose a Billing Method.');return false}A(":input",U).each(function(){var W=A.trim(A(this).attr("id")).replace(/---[0-9]+$/g,"");if(W&&(S=A.trim(A('label[for="'+W.replace(/-(month|year)/,"")+'"]',U).first().children("span").first().text().replace(/[\r\n\t]+/g," ")))){if(R=ws_plugin__s2member_validationErrors(S,this,U)){V+=R+"\n\n"}}});if(V=A.trim(V)){alert('â Oops, you missed something: â\n\n'+V);return false}else{if(T.length&&!T.val()){alert('â Oops, you missed something: â\n\nSecurity Verification missing. Please try again.');return false}}w.attr(B),ws_plugin__s2member_animateProcessing(w);return true})}else{if((k=A("form#s2member-pro-paypal-registration-form")).length===1){var j,M,s,a="div#s2member-pro-paypal-registration-form-options-section",G="div#s2member-pro-paypal-registration-form-description-section",N="div#s2member-pro-paypal-registration-form-registration-section",O="div#s2member-pro-paypal-registration-form-captcha-section",o="div#s2member-pro-paypal-registration-form-submission-section",l=o+" input#s2member-pro-paypal-registration-nonce",w=A(o+" button#s2member-pro-paypal-registration-submit");ws_plugin__s2member_animateProcessing(w,"reset"),w.removeAttr("disabled");(j=function(R){if(!A(a+" select#s2member-pro-paypal-registration-options option").length){A(a).hide();A(G).show()}else{A(a).show();A(G).hide();A(a+" select#s2member-pro-paypal-registration-options").change(function(){A(l).val("option");k.attr("action",k.attr("action").replace(/#.*$/,"")+"#s2p-form");k.submit()})}})();(M=function(R){if(A(o+" input#s2member-pro-paypal-registration-names-not-required-or-not-possible").length){A(N+" > div#s2member-pro-paypal-registration-form-first-name-div").hide();A(N+" > div#s2member-pro-paypal-registration-form-first-name-div :input").attr(i);A(N+" > div#s2member-pro-paypal-registration-form-last-name-div").hide();A(N+" > div#s2member-pro-paypal-registration-form-last-name-div :input").attr(i)}})();(s=function(R){if(A(o+" input#s2member-pro-paypal-registration-password-not-required-or-not-possible").length){A(N+" > div#s2member-pro-paypal-registration-form-password-div").hide();A(N+" > div#s2member-pro-paypal-registration-form-password-div :input").attr(i)}})();A(N+" > div#s2member-pro-paypal-registration-form-password-div :input").on("keyup initialize.s2",function(){ws_plugin__s2member_passwordStrength(A(N+" input#s2member-pro-paypal-registration-username"),A(N+" input#s2member-pro-paypal-registration-password1"),A(N+" input#s2member-pro-paypal-registration-password2"),A(N+" div#s2member-pro-paypal-registration-form-password-strength"))}).trigger("initialize.s2");k.submit(function(){if(A.inArray(A(l).val(),["option"])===-1){var U=this,S="",R="",X="";var T=A(O+" input#recaptcha_response_field, "+O+" #g-recaptcha-response");var W=A(N+' input#s2member-pro-paypal-registration-password1[aria-required="true"]');var V=A(N+" input#s2member-pro-paypal-registration-password2");A(":input",U).each(function(){var Y=A.trim(A(this).attr("id")).replace(/---[0-9]+$/g,"");if(Y&&(S=A.trim(A('label[for="'+Y+'"]',U).first().children("span").first().text().replace(/[\r\n\t]+/g," ")))){if(R=ws_plugin__s2member_validationErrors(S,this,U)){X+=R+"\n\n"}}});if(X=A.trim(X)){alert('â Oops, you missed something: â\n\n'+X);return false}else{if(W.length&&A.trim(W.val())!==A.trim(V.val())){alert('â Oops, you missed something: â\n\nPasswords do not match up. Please try again.');return false}else{if(W.length&&A.trim(W.val()).length<ws_plugin__s2member_passwordMinLength()){alert('â Oops, you missed something: â\n\nPassword MUST be at least 8 characters. Please try again.');return false}else{if(W.length&&ws_plugin__s2member_passwordStrengthMeter(A.trim(W.val()),A.trim(V.val()),true)<ws_plugin__s2member_passwordMinStrengthScore()){alert('â Oops, you missed something: â\n\nPassword strength MUST be `good` or `strong` (i.e., use numbers, letters, and mixed caSe). Please try again.');return false}else{if(T.length&&!T.val()){alert('â Oops, you missed something: â\n\nSecurity Verification missing. Please try again.');return false}}}}}}w.attr(B),ws_plugin__s2member_animateProcessing(w);return true})}else{if((n=A("form#s2member-pro-paypal-sp-checkout-form")).length===1){var j,F,K,t=true,J,p,f,D,c,E,u,a="div#s2member-pro-paypal-sp-checkout-form-options-section",G="div#s2member-pro-paypal-sp-checkout-form-description-section",H="div#s2member-pro-paypal-sp-checkout-form-coupon-section",P=H+" input#s2member-pro-paypal-sp-checkout-coupon-apply",N="div#s2member-pro-paypal-sp-checkout-form-registration-section",v="div#s2member-pro-paypal-sp-checkout-form-billing-method-section",m=v+' input[name="s2member_pro_paypal_sp_checkout[card_type]"]',I="div#s2member-pro-paypal-sp-checkout-form-billing-address-section",y=A(I+" > div#s2member-pro-paypal-sp-checkout-form-ajax-tax-div"),O="div#s2member-pro-paypal-sp-checkout-form-captcha-section",o="div#s2member-pro-paypal-sp-checkout-form-submission-section",l=o+" input#s2member-pro-paypal-sp-checkout-nonce",d=o+" #s2member-pro-paypal-sp-checkout-submit";var C=A.trim(A("input#s2member-pro-paypal-lang-attr").val());var g='<button type="submit" id="s2member-pro-paypal-sp-checkout-submit" class="s2member-pro-paypal-submit s2member-pro-paypal-sp-checkout-submit btn btn-primary" tabindex="500">Submit Form</button>';var h='<input type="image" src="https://www.paypal.com/'+((C)?C:'en_US')+'/i/btn/btn_xpressCheckout.gif" id="s2member-pro-paypal-sp-checkout-submit" class="s2member-pro-paypal-submit s2member-pro-paypal-sp-checkout-submit" value="Submit Form" tabindex="500" />';ws_plugin__s2member_animateProcessing(A(d),"reset"),A(d).removeAttr("disabled"),A(P).removeAttr("disabled");(j=function(R){if(!A(a+" select#s2member-pro-paypal-sp-checkout-options option").length){A(a).hide();A(G).show()}else{A(a).show();A(G).hide();A(a+" select#s2member-pro-paypal-sp-checkout-options").change(function(){A(l).val("option");n.attr("action",n.attr("action").replace(/#.*$/,"")+"#s2p-form");n.submit()})}})();(F=function(R){if(A(o+" input#s2member-pro-paypal-sp-checkout-coupons-not-required-or-not-possible").length){A(H).hide()}else{A(H).show()}})();(K=function(R){if(A(o+" input#s2member-pro-paypal-sp-checkout-tax-not-required-or-not-possible").length){y.hide(),t=false}})();(J=function(S){if(t&&!(S&&S.interval&&document.activeElement.id==="s2member-pro-paypal-sp-checkout-country")){var R=A(o+" input#s2member-pro-paypal-sp-checkout-attr").val();var V=A.trim(A(I+" input#s2member-pro-paypal-sp-checkout-state").val());var W=A(I+" select#s2member-pro-paypal-sp-checkout-country").val();var U=A.trim(A(I+" input#s2member-pro-paypal-sp-checkout-zip").val());var T=V+"|"+W+"|"+U;if(V&&W&&U&&T&&(!c||c!==T)&&(c=T)){(D)?D.abort():null,clearTimeout(f),f=null;y.html('<div><img src="https://betterbaking.com/wp-content/plugins/s2member/src/images/ajax-loader.gif" alt="Calculating Sales Tax..." /> calculating sales tax...</div>');f=setTimeout(function(){D=A.post('https://betterbaking.com/wp-admin/admin-ajax.php',{action:"ws_plugin__s2member_pro_paypal_ajax_tax",ws_plugin__s2member_pro_paypal_ajax_tax:'ZGVmNTAyMDBlYjZjMWRmMTNhMTE5MTkwYmU5ZjVjMTQyNWYzMDcxYWNhYmVjZDZjYzBiZjBiMWQ1MDhjZTAzMTQ3OGU1YTJiYThiNmYwMzc5MWJmZDE1YmQ4NTkzOTYwMDQ1NDI0YjA2ODE1NTZjOTZmMzllYzc0MzE4YzY5MzA1YzAwNmUxOTFlZDI5ZWU3MGRlYTRjYTI1ODUxNDlkZTBiMWEzYmFlYzA3NWZhZjM0NTNlMjk5ZDg2NDM4YmE3MzkxNDI5NzA4NDRkNGI1YzQ2NGYxMzdmYjY5MmEyZWU0N2MyMTc0NjhlMzVmYTc2MWM2YjA4',"ws_plugin__s2member_pro_paypal_ajax_tax_vars[attr]":R,"ws_plugin__s2member_pro_paypal_ajax_tax_vars[state]":V,"ws_plugin__s2member_pro_paypal_ajax_tax_vars[country]":W,"ws_plugin__s2member_pro_paypal_ajax_tax_vars[zip]":U},function(X){clearTimeout(f),f=null;try{y.html("<div>"+A.sprintf('<strong>Sales Tax%s:</strong> %s<br /><strong>â Total%s:</strong> %s',((X.trial)?' Today':""),((X.tax_per)?"<em>"+X.tax_per+"</em> ( "+X.cur_symbol+""+X.tax+" )":X.cur_symbol+""+X.tax),((X.trial)?' Today':""),X.cur_symbol+""+X.total)+"</div>")}catch(Y){}},"json")},((S&&S.keyCode)?1000:100))}else{if(!V||!W||!U||!T){y.html(""),c=null}}}})();p=function(R){setTimeout(function(){J(R)},10)};
7A(I+" input#s2member-pro-paypal-sp-checkout-state").bind("keyup blur",J).bind("cut paste",p);A(I+" input#s2member-pro-paypal-sp-checkout-zip").bind("keyup blur",J).bind("cut paste",p);A(I+" select#s2member-pro-paypal-sp-checkout-country").bind("change",J);setInterval(function(){J({interval:true})},1000);(E=function(R){if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN){A(N+" input#s2member-pro-paypal-sp-checkout-first-name").each(function(){var S=A(this),T=S.val();(!T)?S.val(S2MEMBER_CURRENT_USER_FIRST_NAME):null});A(N+" input#s2member-pro-paypal-sp-checkout-last-name").each(function(){var S=A(this),T=S.val();(!T)?S.val(S2MEMBER_CURRENT_USER_LAST_NAME):null});A(N+" input#s2member-pro-paypal-sp-checkout-email").each(function(){var S=A(this),T=S.val();(!T)?S.val(S2MEMBER_CURRENT_USER_EMAIL):null})}})();(u=function(R){if(A(o+" input#s2member-pro-paypal-sp-checkout-payment-not-required-or-not-possible").length){A(m).val(["Free"])}var S=A(m+":checked").val();if(A.inArray(S,["Free"])!==-1){A(v).hide(),A(I).hide();A(v+" > div.s2member-pro-paypal-sp-checkout-form-div").hide();A(v+" > div.s2member-pro-paypal-sp-checkout-form-div :input").attr(b);A(I+" > div.s2member-pro-paypal-sp-checkout-form-div").hide();A(I+" > div.s2member-pro-paypal-sp-checkout-form-div :input").attr(b);(!t)?y.hide():null;A(o+" #s2member-pro-paypal-sp-checkout-submit").replaceWith(g);(R)?A(o+" #s2member-pro-paypal-sp-checkout-submit").focus():null}else{if(A.inArray(S,["Visa","MasterCard","Amex","Discover"])!==-1){A(v).show(),A(I).show();A(v+" > div.s2member-pro-paypal-sp-checkout-form-div").show();A(v+" > div.s2member-pro-paypal-sp-checkout-form-div :input").attr(x);A(v+" > div#s2member-pro-paypal-sp-checkout-form-card-start-date-issue-number-div").hide();A(v+" > div#s2member-pro-paypal-sp-checkout-form-card-start-date-issue-number-div :input").attr(b);A(I+" > div.s2member-pro-paypal-sp-checkout-form-div").show();A(I+" > div.s2member-pro-paypal-sp-checkout-form-div :input").attr(x);(!t)?y.hide():null;A(o+" #s2member-pro-paypal-sp-checkout-submit").replaceWith(g);(R)?A(v+" input#s2member-pro-paypal-sp-checkout-card-number").focus():null}else{if(A.inArray(S,["Maestro","Solo"])!==-1){A(v).show(),A(I).show();A(v+" > div.s2member-pro-paypal-sp-checkout-form-div").show();A(v+" > div.s2member-pro-paypal-sp-checkout-form-div :input").attr(x);A(I+" > div.s2member-pro-paypal-sp-checkout-form-div").show();A(I+" > div.s2member-pro-paypal-sp-checkout-form-div :input").attr(x);(!t)?y.hide():null;A(o+" #s2member-pro-paypal-sp-checkout-submit").replaceWith(g);(R)?A(v+" input#s2member-pro-paypal-sp-checkout-card-number").focus():null}else{if((!S||S==="PayPal")&&t){if(A(v).attr("data-paypal-only")){A(v).hide()}else{A(v).show()}A(I).show();A(v+" > div.s2member-pro-paypal-sp-checkout-form-div").show();A(v+" > div.s2member-pro-paypal-sp-checkout-form-div :input").attr(x);A(v+" > div#s2member-pro-paypal-sp-checkout-form-card-number-div").hide();A(v+" > div#s2member-pro-paypal-sp-checkout-form-card-number-div :input").attr(b);A(v+" > div#s2member-pro-paypal-sp-checkout-form-card-expiration-div").hide();A(v+" > div#s2member-pro-paypal-sp-checkout-form-card-expiration-div :input").attr(b);A(v+" > div#s2member-pro-paypal-sp-checkout-form-card-verification-div").hide();A(v+" > div#s2member-pro-paypal-sp-checkout-form-card-verification-div :input").attr(b);A(v+" > div#s2member-pro-paypal-sp-checkout-form-card-start-date-issue-number-div").hide();A(v+" > div#s2member-pro-paypal-sp-checkout-form-card-start-date-issue-number-div :input").attr(b);A(I+" > div.s2member-pro-paypal-sp-checkout-form-div").show();A(I+" > div.s2member-pro-paypal-sp-checkout-form-div :input").attr(x);A(I+" > div#s2member-pro-paypal-sp-checkout-form-street-div").hide();A(I+" > div#s2member-pro-paypal-sp-checkout-form-street-div :input").attr(b);A(I+" > div#s2member-pro-paypal-sp-checkout-form-city-div").hide();A(I+" > div#s2member-pro-paypal-sp-checkout-form-city-div :input").attr(b);A(o+" #s2member-pro-paypal-sp-checkout-submit").replaceWith(h);(R)?A(I+" input#s2member-pro-paypal-sp-checkout-state").focus():null}else{if(!S||S==="PayPal"){if(A(v).attr("data-paypal-only")){A(v).hide()}else{A(v).show()}A(I).hide();A(v+" > div.s2member-pro-paypal-sp-checkout-form-div").hide();A(v+" > div.s2member-pro-paypal-sp-checkout-form-div :input").attr(b);A(v+" > div#s2member-pro-paypal-sp-checkout-form-card-type-div").show();A(v+" > div#s2member-pro-paypal-sp-checkout-form-card-type-div :input").attr(x);A(I+" > div.s2member-pro-paypal-sp-checkout-form-div").hide();A(I+" > div.s2member-pro-paypal-sp-checkout-form-div :input").attr(b);A(o+" #s2member-pro-paypal-sp-checkout-submit").replaceWith(h);(R)?A(o+" #s2member-pro-paypal-sp-checkout-submit").focus():null}}}}}K()})();A(m).click(u).change(u);A(P).click(function(){A(l).val("apply-coupon"),n.submit()});n.submit(function(){if(A.inArray(A(l).val(),["option","apply-coupon"])===-1){var U=this,S="",R="",V="";var T=A(O+" input#recaptcha_response_field, "+O+" #g-recaptcha-response");if(!A(m+":checked").val()){A(m).val(["PayPal"])}A(":input",U).each(function(){var W=A.trim(A(this).attr("id")).replace(/---[0-9]+$/g,"");if(W&&(S=A.trim(A('label[for="'+W.replace(/-(month|year)/,"")+'"]',U).first().children("span").first().text().replace(/[\r\n\t]+/g," ")))){if(R=ws_plugin__s2member_validationErrors(S,this,U)){V+=R+"\n\n"}}});if(V=A.trim(V)){alert('â Oops, you missed something: â\n\n'+V);return false}else{if(T.length&&!T.val()){alert('â Oops, you missed something: â\n\nSecurity Verification missing. Please try again.');return false}}}
7A(d).attr(B),ws_plugin__s2member_animateProcessing(A(d)),A(P).attr(B);return true})}else{if((q=A("form#s2member-pro-paypal-checkout-form")).length===1){var j,F,K,t=true,J,p,f,D,c,s,u,E,a="div#s2member-pro-paypal-checkout-form-options-section",G="div#s2member-pro-paypal-checkout-form-description-section",H="div#s2member-pro-paypal-checkout-form-coupon-section",P=H+" input#s2member-pro-paypal-checkout-coupon-apply",N="div#s2member-pro-paypal-checkout-form-registration-section",Q="div#s2member-pro-paypal-checkout-form-custom-fields-section",v="div#s2member-pro-paypal-checkout-form-billing-method-section",m=v+' input[name="s2member_pro_paypal_checkout[card_type]"]',I="div#s2member-pro-paypal-checkout-form-billing-address-section",y=A(I+" > div#s2member-pro-paypal-checkout-form-ajax-tax-div"),O="div#s2member-pro-paypal-checkout-form-captcha-section",o="div#s2member-pro-paypal-checkout-form-submission-section",l=o+" input#s2member-pro-paypal-checkout-nonce",d=o+" #s2member-pro-paypal-checkout-submit";var C=A.trim(A("input#s2member-pro-paypal-lang-attr").val());var g='<button type="submit" id="s2member-pro-paypal-checkout-submit" class="s2member-pro-paypal-submit s2member-pro-paypal-checkout-submit btn btn-primary" tabindex="600">Submit Form</button>';var h='<input type="image" src="https://www.paypal.com/'+((C)?C:'en_US')+'/i/btn/btn_xpressCheckout.gif" id="s2member-pro-paypal-checkout-submit" class="s2member-pro-paypal-submit s2member-pro-paypal-checkout-submit" value="Submit Form" tabindex="600" />';ws_plugin__s2member_animateProcessing(A(d),"reset"),A(d).removeAttr("disabled"),A(P).removeAttr("disabled");(j=function(R){if(!A(a+" select#s2member-pro-paypal-checkout-options option").length){A(a).hide();A(G).show()}else{A(a).show();A(G).hide();A(a+" select#s2member-pro-paypal-checkout-options").change(function(){A(l).val("option");q.attr("action",q.attr("action").replace(/#.*$/,"")+"#s2p-form");q.submit()})}})();(F=function(R){if(A(o+" input#s2member-pro-paypal-checkout-coupons-not-required-or-not-possible").length){A(H).hide()}else{A(H).show()}})();(K=function(R){if(A(o+" input#s2member-pro-paypal-checkout-tax-not-required-or-not-possible").length){y.hide(),t=false}})();(J=function(S){if(t&&!(S&&S.interval&&document.activeElement.id==="s2member-pro-paypal-checkout-country")){var R=A(o+" input#s2member-pro-paypal-checkout-attr").val();var V=A.trim(A(I+" input#s2member-pro-paypal-checkout-state").val());var W=A(I+" select#s2member-pro-paypal-checkout-country").val();var U=A.trim(A(I+" input#s2member-pro-paypal-checkout-zip").val());var T=V+"|"+W+"|"+U;if(V&&W&&U&&T&&(!c||c!==T)&&(c=T)){(D)?D.abort():null,clearTimeout(f),f=null;y.html('<div><img src="https://betterbaking.com/wp-content/plugins/s2member/src/images/ajax-loader.gif" alt="Calculating Sales Tax..." /> calculating sales tax...</div>');f=setTimeout(function(){D=A.post('https://betterbaking.com/wp-admin/admin-ajax.php',{action:"ws_plugin__s2member_pro_paypal_ajax_tax",ws_plugin__s2member_pro_paypal_ajax_tax:'ZGVmNTAyMDAwNTU4YzQ2MjUwYWEwNzZmZmFkNGZkMGQwNDYwNTFiMTYwZWUxMDkxNDBlZjE0ZDM3ZGJiZThkZjVmMGNhMTZmMmEwZjUxYWFlMDIxNDc4MTE3NjBiYWI3NjAzYTM5ZDIyMTE1ZDRiZmY4YmU0YjYzYTE2Mjk2MjE2ZDA3OGEwNDJjZDAyYjkxODcwYWU0N2IzZDU1MGRkZjE1ZjI0MGQ4ZWFiN2Q3NzY1ZTVhMTFjNmRmNjU4ZjMxZWE1NTIyMTkxYzllYmMxMTU2NTRmMGIxZmIyZWU0M2YxOTg3MzcyYmRhYjBhYTE4NWI0Mzhl',"ws_plugin__s2member_pro_paypal_ajax_tax_vars[attr]":R,"ws_plugin__s2member_pro_paypal_ajax_tax_vars[state]":V,"ws_plugin__s2member_pro_paypal_ajax_tax_vars[country]":W,"ws_plugin__s2member_pro_paypal_ajax_tax_vars[zip]":U},function(X,Z){clearTimeout(f),f=null;try{y.html("<div>"+A.sprintf('<strong>Sales Tax%s:</strong> %s<br /><strong>â Total%s:</strong> %s',((X.trial)?' Today':""),((X.tax_per)?"<em>"+X.tax_per+"</em> ( "+X.cur_symbol+""+X.tax+" )":X.cur_symbol+""+X.tax),((X.trial)?' Today':""),X.cur_symbol+""+X.total)+"</div>")}catch(Y){}},"json")},((S&&S.keyCode)?1000:100))}else{if(!V||!W||!U||!T){y.html(""),c=null}}}})();p=function(R){setTimeout(function(){J(R)},10)};
7A(I+" input#s2member-pro-paypal-checkout-state").bind("keyup blur",J).bind("cut paste",p);A(I+" input#s2member-pro-paypal-checkout-zip").bind("keyup blur",J).bind("cut paste",p);A(I+" select#s2member-pro-paypal-checkout-country").bind("change",J);setInterval(function(){J({interval:true})},1000);(s=function(R){if(A(o+" input#s2member-pro-paypal-checkout-password-not-required-or-not-possible").length){A(N+" > div#s2member-pro-paypal-checkout-form-password-div").hide();A(N+" > div#s2member-pro-paypal-checkout-form-password-div :input").attr(i)}})();(E=function(R){if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN){A(N+" input#s2member-pro-paypal-checkout-first-name").each(function(){var S=A(this),T=S.val();(!T)?S.val(S2MEMBER_CURRENT_USER_FIRST_NAME):null});A(N+" input#s2member-pro-paypal-checkout-last-name").each(function(){var S=A(this),T=S.val();(!T)?S.val(S2MEMBER_CURRENT_USER_LAST_NAME):null});A(N+" input#s2member-pro-paypal-checkout-email").val(S2MEMBER_CURRENT_USER_EMAIL).attr(i);A(N+" input#s2member-pro-paypal-checkout-username").val(S2MEMBER_CURRENT_USER_LOGIN).attr(i);A(N+" > div#s2member-pro-paypal-checkout-form-password-div").hide();A(N+" > div#s2member-pro-paypal-checkout-form-password-div :input").attr(i);if(A.trim(A(N+" > div#s2member-pro-paypal-checkout-form-registration-section-title").html())==='Create Profile'){A(N+" > div#s2member-pro-paypal-checkout-form-registration-section-title").html('Your Profile')}A(Q).hide(),A(Q+" :input").attr(i)}})();(u=function(R){if(A(o+" input#s2member-pro-paypal-checkout-payment-not-required-or-not-possible").length){A(m).val(["Free"])}var S=A(m+":checked").val();if(A.inArray(S,["Free"])!==-1){A(v).hide(),A(I).hide();A(v+" > div.s2member-pro-paypal-checkout-form-div").hide();A(v+" > div.s2member-pro-paypal-checkout-form-div :input").attr(b);A(I+" > div.s2member-pro-paypal-checkout-form-div").hide();A(I+" > div.s2member-pro-paypal-checkout-form-div :input").attr(b);(!t)?y.hide():null;A(o+" #s2member-pro-paypal-checkout-submit").replaceWith(g);(R)?A(o+" #s2member-pro-paypal-checkout-submit").focus():null}else{if(A.inArray(S,["Visa","MasterCard","Amex","Discover"])!==-1){A(v).show(),A(I).show();A(v+" > div.s2member-pro-paypal-checkout-form-div").show();A(v+" > div.s2member-pro-paypal-checkout-form-div :input").attr(x);A(v+" > div#s2member-pro-paypal-checkout-form-card-start-date-issue-number-div").hide();A(v+" > div#s2member-pro-paypal-checkout-form-card-start-date-issue-number-div :input").attr(b);A(I+" > div.s2member-pro-paypal-checkout-form-div").show();A(I+" > div.s2member-pro-paypal-checkout-form-div :input").attr(x);(!t)?y.hide():null;A(o+" #s2member-pro-paypal-checkout-submit").replaceWith(g);(R)?A(v+" input#s2member-pro-paypal-checkout-card-number").focus():null}else{if(A.inArray(S,["Maestro","Solo"])!==-1){A(v).show(),A(I).show();A(v+" > div.s2member-pro-paypal-checkout-form-div").show();A(v+" > div.s2member-pro-paypal-checkout-form-div :input").attr(x);A(I+" > div.s2member-pro-paypal-checkout-form-div").show();A(I+" > div.s2member-pro-paypal-checkout-form-div :input").attr(x);(!t)?y.hide():null;A(o+" #s2member-pro-paypal-checkout-submit").replaceWith(g);(R)?A(v+" input#s2member-pro-paypal-checkout-card-number").focus():null}else{if((!S||S==="PayPal")&&t){if(A(v).attr("data-paypal-only")){A(v).hide()}else{A(v).show()}A(I).show();A(v+" > div.s2member-pro-paypal-checkout-form-div").show();A(v+" > div.s2member-pro-paypal-checkout-form-div :input").attr(x);A(v+" > div#s2member-pro-paypal-checkout-form-card-number-div").hide();A(v+" > div#s2member-pro-paypal-checkout-form-card-number-div :input").attr(b);A(v+" > div#s2member-pro-paypal-checkout-form-card-expiration-div").hide();A(v+" > div#s2member-pro-paypal-checkout-form-card-expiration-div :input").attr(b);A(v+" > div#s2member-pro-paypal-checkout-form-card-verification-div").hide();A(v+" > div#s2member-pro-paypal-checkout-form-card-verification-div :input").attr(b);A(v+" > div#s2member-pro-paypal-checkout-form-card-start-date-issue-number-div").hide();A(v+" > div#s2member-pro-paypal-checkout-form-card-start-date-issue-number-div :input").attr(b);A(I+" > div.s2member-pro-paypal-checkout-form-div").show();A(I+" > div.s2member-pro-paypal-checkout-form-div :input").attr(x);A(I+" > div#s2member-pro-paypal-checkout-form-street-div").hide();A(I+" > div#s2member-pro-paypal-checkout-form-street-div :input").attr(b);A(I+" > div#s2member-pro-paypal-checkout-form-city-div").hide();A(I+" > div#s2member-pro-paypal-checkout-form-city-div :input").attr(b);A(o+" #s2member-pro-paypal-checkout-submit").replaceWith(h);(R)?A(I+" input#s2member-pro-paypal-checkout-state").focus():null}else{if(!S||S==="PayPal"){if(A(v).attr("data-paypal-only")){A(v).hide()}else{A(v).show()}A(I).hide();A(v+" > div.s2member-pro-paypal-checkout-form-div").hide();A(v+" > div.s2member-pro-paypal-checkout-form-div :input").attr(b);A(v+" > div#s2member-pro-paypal-checkout-form-card-type-div").show();A(v+" > div#s2member-pro-paypal-checkout-form-card-type-div :input").attr(x);A(I+" > div.s2member-pro-paypal-checkout-form-div").hide();A(I+" > div.s2member-pro-paypal-checkout-form-div :input").attr(b);A(o+" #s2member-pro-paypal-checkout-submit").replaceWith(h);(R)?A(o+" #s2member-pro-paypal-checkout-submit").focus():null}}}}}})();A(m).click(u).change(u);A(P).click(function(){A(l).val("apply-coupon"),q.submit()});A(N+" > div#s2member-pro-paypal-checkout-form-password-div :input").on("keyup initialize.s2",function(){ws_plugin__s2member_passwordStrength(A(N+" input#s2member-pro-paypal-checkout-username"),A(N+" input#s2member-pro-paypal-checkout-password1"),A(N+" input#s2member-pro-paypal-checkout-password2"),A(N+" div#s2member-pro-paypal-checkout-form-password-strength"))}).trigger("initialize.s2");q.submit(function(){if(A.inArray(A(l).val(),["option","apply-coupon"])===-1){var U=this,S="",R="",X="";var T=A(O+" input#recaptcha_response_field, "+O+" #g-recaptcha-response");var W=A(N+' input#s2member-pro-paypal-checkout-password1[aria-required="true"]');var V=A(N+" input#s2member-pro-paypal-checkout-password2");if(!A(m+":checked").val()){A(m).val(["PayPal"])}A(":input",U).each(function(){var Y=A.trim(A(this).attr("id")).replace(/---[0-9]+$/g,"");if(Y&&(S=A.trim(A('label[for="'+Y.replace(/-(month|year)/,"")+'"]',U).first().children("span").first().text().replace(/[\r\n\t]+/g," ")))){if(R=ws_plugin__s2member_validationErrors(S,this,U)){X+=R+"\n\n"}}});if(X=A.trim(X)){alert('â Oops, you missed something: â\n\n'+X);return false}else{if(W.length&&A.trim(W.val())!==A.trim(V.val())){alert('â Oops, you missed something: â\n\nPasswords do not match up. Please try again.');return false}else{if(W.length&&A.trim(W.val()).length<ws_plugin__s2member_passwordMinLength()){alert('â Oops, you missed something: â\n\nPassword MUST be at least 8 characters. Please try again.');return false}else{if(W.length&&ws_plugin__s2member_passwordStrengthMeter(A.trim(W.val()),A.trim(V.val()),true)<ws_plugin__s2member_passwordMinStrengthScore()){alert('â Oops, you missed something: â\n\nPassword strength MUST be `good` or `strong` (i.e., use numbers, letters, and mixed caSe). Please try again.');return false}else{if(T.length&&!T.val()){alert('â Oops, you missed something: â\n\nSecurity Verification missing. Please try again.');return false}}}}}}A(d).attr(B),ws_plugin__s2member_animateProcessing(A(d)),A(P).attr(B);return true})}}}}}(L=function(){A("div#s2member-pro-paypal-form-response").each(function(){var R=A(this).offset();window.scrollTo(0,R.top-100)})})()}); 8var S2MEMBER_PRO_STRIPE_GATEWAY = true; 9/** 10 * Core JavaScript routines for Stripe. 11 * 12 * Copyright: © 2009-2011 13 * {@link http://websharks-inc.com/ WebSharks, Inc.} 14 * (coded in the USA) 15 * 16 * This WordPress plugin (s2Member Pro) is comprised of two parts: 17 * 18 * o (1) Its PHP code is licensed under the GPL license, as is WordPress. 19 * You should have received a copy of the GNU General Public License, 20 * along with this software. In the main directory, see: /licensing/ 21 * If not, see: {@link http://www.gnu.org/licenses/}. 22 * 23 * o (2) All other parts of (s2Member Pro); including, but not limited to: 24 * the CSS code, some JavaScript code, images, and design; 25 * are licensed according to the license purchased. 26 * See: {@link http://s2member.com/prices/} 27 * 28 * Unless you have our prior written consent, you must NOT directly or indirectly license, 29 * sub-license, sell, resell, or provide for free; part (2) of the s2Member Pro Add-on; 30 * or make an offer to do any of these things. All of these things are strictly 31 * prohibited with part (2) of the s2Member Pro Add-on. 32 * 33 * Your purchase of s2Member Pro includes free lifetime upgrades via s2Member.com 34 * (i.e., new features, bug fixes, updates, improvements); along with full access 35 * to our video tutorial library: {@link http://s2member.com/videos/} 36 * 37 * @package s2Member\Stripe 38 * @since 140617 39 */ 40jQuery(document).ready( // DOM ready. 41 function($) // Depends on Stripe lib. 42 { 43 // Load this only if we have a Stripe pro-form on the page. 44 if ($('form.s2member-pro-stripe-form').length > 0) 45 { 46 // Setup the pro-forms only after we managed to load stripe's JS.
47 $.ajax({cache: true, dataType: 'script', url: 'https://js.stripe.com/v3/'}); 48 var stripeCheck = function() { 49 if(window.Stripe) // Stripe available? 50 clearInterval(stripeCheckInterval), 51 setupProForms(); 52 }, 53 stripeCheckInterval = setInterval(stripeCheck, 100); 54 55 var setupProForms = function() 56 { 57 /* 58 Initializations. 59 */ 60 var preloadAjaxLoader, // Loading image. 61 $clForm, $upForm, $rgForm, $spForm, $coForm, 62 ariaTrue = {'aria-required': 'true'}, ariaFalse = {'aria-required': 'false'}, 63 ariaFalseDis = {'aria-required': 'false', 'disabled': 'disabled'}, 64 disabled = {'disabled': 'disabled'}, 65 66 taxMayApply = true, calculateTax, cTaxDelay, cTaxTimeout, cTaxReq, cTaxLocation, ajaxTaxDiv, 67 optionsSection, optionsSelect, descSection, couponSection, couponApplyButton, registrationSection, customFieldsSection, 68 billingMethodSection, handleBillingMethod, sourceTokenButton, sourceTokenSummary, sourceTokenInput, sourceTokenSummaryInput, billingAddressSection, captchaSection, 69 submissionSection, submissionButton, submissionNonceVerification; 70 71 preloadAjaxLoader = new Image(), preloadAjaxLoader.src = 'https://betterbaking.com/wp-content/plugins/s2member/src/images/ajax-loader.gif'; 72 73 /* 74 Check for more than a single form on this page. 75 */ 76 if($('form.s2member-pro-stripe-cancellation-form').length > 1 77 || $('form.s2member-pro-stripe-registration-form').length > 1 || $('form.s2member-pro-stripe-update-form').length > 1 78 || $('form.s2member-pro-stripe-sp-checkout-form').length > 1 || $('form.s2member-pro-stripe-checkout-form').length > 1) 79 { 80 return alert('Detected more than one s2Member Pro-Form.\n\nPlease use only ONE s2Member Pro-Form Shortcode on each Post/Page.' + 81 ' Attempting to serve more than one Pro-Form on each Post/Page (even w/ DHTML) may result in unexpected/broken functionality.'); 82 } 83 /* 84 Cancellation form handler. 85 */ 86 if(($clForm = $('form#s2member-pro-stripe-cancellation-form')).length === 1) 87 { 88 captchaSection = 'div#s2member-pro-stripe-cancellation-form-captcha-section', 89 submissionSection = 'div#s2member-pro-stripe-cancellation-form-submission-section', 90 submissionButton = submissionSection + ' button#s2member-pro-stripe-cancellation-submit'; 91 92 $(submissionButton).removeAttr('disabled'), 93 ws_plugin__s2member_animateProcessing($(submissionButton), 'reset'); 94 95 $clForm.on('submit', function(/* Form validation. */) 96 { 97 var context = this, label = '', error = '', errors = '', 98 $recaptchaResponse = $(captchaSection + ' input#recaptcha_response_field, '+captchaSection+' #g-recaptcha-response'); 99 100 $(':input', context) 101 .each(function(/* Go through them all together. */) 102 { 103 var id = $.trim($(this).attr('id')).replace(/---[0-9]+$/g, ''/* Remove numeric suffixes. */); 104 105 if(id && (label = $.trim($('label[for="' + id + '"]', context).first().children('span').first().text().replace(/[\r\n\t]+/g, ' ')))) 106 { 107 if(error = ws_plugin__s2member_validationErrors(label, this, context)) 108 errors += error + '\n\n'/* Collect errors. */; 109 } 110 }); 111 if((errors = $.trim(errors))) 112 { 113 alert('â Oops, you missed something: â' + '\n\n' + errors); 114 return false; // Error; cannot continue in this scenario. 115 } 116 else if($recaptchaResponse.length && !$recaptchaResponse.val()) 117 { 118 alert('â Oops, you missed something: â' + '\n\n' + 'Security Verification missing. Please try again.'); 119 return false; // Error; cannot continue in this scenario. 120 } 121 $(submissionButton).attr(disabled), 122 ws_plugin__s2member_animateProcessing($(submissionButton)); 123 return true; // Allow submission. 124 }); 125 } 126 /* 127 Registration form handler. 128 */ 129 else if(($rgForm = $('form#s2member-pro-stripe-registration-form')).length === 1) 130 { 131 optionsSection = 'div#s2member-pro-stripe-registration-form-options-section', 132 optionsSelect = optionsSection + ' select#s2member-pro-stripe-registration-options', 133 134 descSection = 'div#s2member-pro-stripe-registration-form-description-section', 135 136 registrationSection = 'div#s2member-pro-stripe-registration-form-registration-section', 137 captchaSection = 'div#s2member-pro-stripe-registration-form-captcha-section', 138 submissionSection = 'div#s2member-pro-stripe-registration-form-submission-section', 139 submissionButton = submissionSection + ' button#s2member-pro-stripe-registration-submit', 140 submissionNonceVerification = submissionSection + ' input#s2member-pro-stripe-registration-nonce'; 141 142 $(submissionButton).removeAttr('disabled'), 143 ws_plugin__s2member_animateProcessing($(submissionButton), 'reset'); 144 145 if(!$(optionsSelect + ' option').length) 146 $(optionsSection).hide(), $(descSection).show(); 147 148 else $(optionsSection).show(), $(descSection).hide(), 149 $(optionsSelect).on('change', function(/* Handle checkout option changes. */) 150 { 151 $(submissionNonceVerification).val('option'), 152 $rgForm.attr('action', $rgForm.attr('action').replace(/#.*$/, '') + '#s2p-form'), 153 $rgForm.submit(); // Submit form with a new checkout option. 154 }); 155 if($(submissionSection + ' input#s2member-pro-stripe-registration-names-not-required-or-not-possible').length) 156 { 157 $(registrationSection + ' > div#s2member-pro-stripe-registration-form-first-name-div').hide(), 158 $(registrationSection + ' > div#s2member-pro-stripe-registration-form-first-name-div :input').attr(ariaFalseDis); 159 160 $(registrationSection + ' > div#s2member-pro-stripe-registration-form-last-name-div').hide(), 161 $(registrationSection + ' > div#s2member-pro-stripe-registration-form-last-name-div :input').attr(ariaFalseDis); 162 } 163 if($(submissionSection + ' input#s2member-pro-stripe-registration-password-not-required-or-not-possible').length) 164 { 165 $(registrationSection + ' > div#s2member-pro-stripe-registration-form-password-div').hide(), 166 $(registrationSection + ' > div#s2member-pro-stripe-registration-form-password-div :input').attr(ariaFalseDis); 167 } 168 $(registrationSection + ' > div#s2member-pro-stripe-registration-form-password-div :input').on('keyup initialize.s2', function() 169 { 170 ws_plugin__s2member_passwordStrength( 171 $(registrationSection + ' input#s2member-pro-stripe-registration-username'), 172 $(registrationSection + ' input#s2member-pro-stripe-registration-password1'), 173 $(registrationSection + ' input#s2member-pro-stripe-registration-password2'), 174 $(registrationSection + ' div#s2member-pro-stripe-registration-form-password-strength') 175 ); 176 }).trigger('initialize.s2'); 177 $rgForm.on('submit', function(/* Form validation. */) 178 { 179 if($.inArray($(submissionNonceVerification).val(), ['option']) === -1) 180 { 181 var context = this, label = '', error = '', errors = '', 182 $recaptchaResponse = $(captchaSection + ' input#recaptcha_response_field, '+captchaSection+' #g-recaptcha-response'), 183 $password1 = $(registrationSection + ' input#s2member-pro-stripe-registration-password1[aria-required="true"]'), 184 $password2 = $(registrationSection + ' input#s2member-pro-stripe-registration-password2'); 185 186 $(':input', context) 187 .each(function(/* Go through them all together. */) 188 { 189 var id = $.trim($(this).attr('id')).replace(/---[0-9]+$/g, ''/* Remove numeric suffixes. */); 190 191 if(id && (label = $.trim($('label[for="' + id + '"]', context).first().children('span').first().text().replace(/[\r\n\t]+/g, ' ')))) 192 { 193 if(error = ws_plugin__s2member_validationErrors(label, this, context)) 194 errors += error + '\n\n'/* Collect errors. */; 195 } 196 }); 197 if((errors = $.trim(errors))) 198 { 199 alert('â Oops, you missed something: â' + '\n\n' + errors); 200 return false; // Error; cannot continue in this scenario. 201 } 202 else if($password1.length && $.trim($password1.val()) !== $.trim($password2.val())) 203 { 204 alert('â Oops, you missed something: â' + '\n\n' + 'Passwords do not match up. Please try again.'); 205 return false; // Error; cannot continue in this scenario. 206 } 207 else if($password1.length && $.trim($password1.val()).length < ws_plugin__s2member_passwordMinLength()) 208 { 209 alert('â Oops, you missed something: â' + '\n\n' + 'Password MUST be at least 8 characters. Please try again.'); 210 return false;
211 } 212 else if($password1.length && ws_plugin__s2member_passwordStrengthMeter($.trim($password1.val()), $.trim($password2.val()), true) < ws_plugin__s2member_passwordMinStrengthScore()) 213 { 214 alert('â Oops, you missed something: â' + '\n\n' + 'Password strength MUST be `good` or `strong` (i.e., use numbers, letters, and mixed caSe). Please try again.'); 215 return false; 216 } 217 else if($recaptchaResponse.length && !$recaptchaResponse.val()) 218 { 219 alert('â Oops, you missed something: â' + '\n\n' + 'Security Verification missing. Please try again.'); 220 return false; // Error; cannot continue in this scenario. 221 } 222 // $(optionsSelect).attr(disabled); // Not an option selection. 223 // Bug fix. Don't disable, because that prevents it from being submitted. 224 } 225 $(submissionButton).attr(disabled), 226 ws_plugin__s2member_animateProcessing($(submissionButton)); 227 return true; // Allow submission. 228 }); 229 } 230 /* 231 Update form handler. 232 */ 233 else if(($upForm = $('form#s2member-pro-stripe-update-form')).length === 1) 234 { 235 billingMethodSection = 'div#s2member-pro-stripe-update-form-billing-method-section', 236 sourceTokenButton = billingMethodSection + ' button#s2member-pro-stripe-update-form-source-token-button', 237 sourceTokenSummary = billingMethodSection + ' div#s2member-pro-stripe-update-form-source-token-summary', 238 239 billingAddressSection = 'div#s2member-pro-stripe-update-form-billing-address-section', 240 241 captchaSection = 'div#s2member-pro-stripe-update-form-captcha-section', 242 243 submissionSection = 'div#s2member-pro-stripe-update-form-submission-section', 244 sourceTokenInput = submissionSection + ' input[name="' + ws_plugin__s2member_escjQAttr('s2member_pro_stripe_update[source_token]') + '"]', 245 sourceTokenSummaryInput = submissionSection + ' input[name="' + ws_plugin__s2member_escjQAttr('s2member_pro_stripe_update[source_token_summary]') + '"]', 246 submissionButton = submissionSection + ' button#s2member-pro-stripe-update-submit'; 247 248 $(submissionButton).removeAttr('disabled'), 249 ws_plugin__s2member_animateProcessing($(submissionButton), 'reset'); 250 251 handleBillingMethod = function(eventTrigger /* eventTrigger is passed by jQuery for DOM events. */) 252 { 253 var sourceToken = $(sourceTokenInput).val(/* Source token from Stripe. */); 254 255 if(sourceToken/* They have now supplied a source token? */) 256 { 257 $(billingMethodSection).show(), // Show billing method section. 258 $(billingMethodSection + ' > div.s2member-pro-stripe-update-form-div').show(), 259 $(billingMethodSection + ' > div.s2member-pro-stripe-update-form-div :input').attr(ariaTrue); 260 261 if(taxMayApply/* If tax may apply, we need to collect a tax location. */) 262 { 263 $(billingAddressSection).show(), // Show billing address section. 264 $(billingAddressSection + ' > div.s2member-pro-stripe-update-form-div').show(), 265 $(billingAddressSection + ' > div.s2member-pro-stripe-update-form-div :input').attr(ariaTrue); 266 } 267 else // There is no reason to collect tax information in this case. 268 { 269 $(billingAddressSection).hide(), // Hide billing address section. 270 $(billingAddressSection + ' > div.s2member-pro-stripe-update-form-div').hide(), 271 $(billingAddressSection + ' > div.s2member-pro-stripe-update-form-div :input').attr(ariaFalse); 272 } 273 if(eventTrigger) $(submissionSection + ' button#s2member-pro-stripe-update-submit').focus(); 274 } 275 else if(!sourceToken/* Else there is no Billing Method supplied. */) 276 { 277 $(billingMethodSection).show(), // Show billing method section. 278 $(billingMethodSection + ' > div.s2member-pro-stripe-update-form-div').show(), 279 $(billingMethodSection + ' > div.s2member-pro-stripe-update-form-div :input').attr(ariaTrue); 280 281 $(billingAddressSection).hide(), // Hide billing address section. 282 $(billingAddressSection + ' > div.s2member-pro-stripe-update-form-div').hide(), 283 $(billingAddressSection + ' > div.s2member-pro-stripe-update-form-div :input').attr(ariaFalse); 284 } 285 }; 286 handleBillingMethod(); // Handle billing method immediately to deal with fields already filled in. 287 288 $(sourceTokenButton).on('click', function() // Stripe integration. 289 {
290 var validateZipCode = $(submissionSection + ' input#s2member-pro-stripe-update-should-validate-zipcode').val() == '1', 291 collectBillingAddress = $(submissionSection + ' input#s2member-pro-stripe-update-should-collect-billing-address').val() == '1', 292 collectShippingAddress = $(submissionSection + ' input#s2member-pro-stripe-update-should-collect-shipping-address').val() == '1', 293 stripeImage = ''; 294 295 var getSourceToken = StripeCheckout.configure 296 ({ 297 bitcoin: false, // Accept Bitcoin as a funding source in this instance? 298 299 image : stripeImage ? stripeImage : undefined, 300 locale : 'auto', // Based on visitor's country. 301 302 key : '', 303 allowRememberMe: '1' == '1', 304 panelLabel : 'Add', 305 zipCode : validateZipCode, billingAddress : collectBillingAddress, shippingAddress: collectShippingAddress, 306 email : typeof S2MEMBER_CURRENT_USER_EMAIL === 'string' ? S2MEMBER_CURRENT_USER_EMAIL : '', 307 308 token: function(token) // Callback handler. 309 { 310 $(sourceTokenInput).val(token.id), $(sourceTokenSummaryInput).val(buildSourceTokenTextSummary(token)), 311 $(sourceTokenSummary).html(ws_plugin__s2member_escHtml(buildSourceTokenTextSummary(token))), 312 handleBillingMethod(); // Adjust billing methods fields now also. 313 } 314 }); 315 getSourceToken.open(); // Open Stripe overlay. 316 }); 317 $upForm.on('submit', function(/* Form validation. */) 318 { 319 var context = this, label = '', error = '', errors = '', 320 $recaptchaResponse = $(captchaSection + ' input#recaptcha_response_field, '+captchaSection+' #g-recaptcha-response'); 321 322 //!!! if(!$(sourceTokenInput).val()) 323 // { 324 // alert('No Billing Method; please try again.'); 325 // return false; // Error; cannot continue in this scenario. 326 // } 327 $(':input', context) 328 .each(function(/* Go through them all together. */) 329 { 330 var id = $.trim($(this).attr('id')).replace(/---[0-9]+$/g, ''/* Remove numeric suffixes. */); 331 332 if(id && (label = $.trim($('label[for="' + id.replace(/-(month|year)/, '') + '"]', context).first().children('span').first().text().replace(/[\r\n\t]+/g, ' ')))) 333 { 334 if(error = ws_plugin__s2member_validationErrors(label, this, context)) 335 errors += error + '\n\n'/* Collect errors. */; 336 } 337 }); 338 if((errors = $.trim(errors))) 339 { 340 alert('â Oops, you missed something: â' + '\n\n' + errors); 341 return false; // Error; cannot continue in this scenario. 342 } 343 else if($recaptchaResponse.length && !$recaptchaResponse.val()) 344 { 345 alert('â Oops, you missed something: â' + '\n\n' + 'Security Verification missing. Please try again.'); 346 return false; // Error; cannot continue in this scenario. 347 } 348 $(submissionButton).attr(disabled), 349 ws_plugin__s2member_animateProcessing($(submissionButton)); 350 return true; // Allow submission. 351 }); 352 } 353 /* 354 Handles both types of checkout forms. 355 */ 356 else if(($coForm = $('form#s2member-pro-stripe-sp-checkout-form')).length === 1 || ($coForm = $('form#s2member-pro-stripe-checkout-form')).length === 1) 357 { 358 (function($coForm)// Handles both types of checkout forms; i.e., Specific Post/Page and also Checkout/Modification forms. 359 { 360 var coTypeWithDashes = $coForm[0].id.replace(/^s2member\-pro\-stripe\-/, '').replace(/\-form$/, ''), 361 coTypeWithUnderscores = coTypeWithDashes.replace(/[^a-z0-9]/gi, '_'); // e.g., `sp_checkout`. 362 363 optionsSection = 'div#s2member-pro-stripe-' + coTypeWithDashes + '-form-options-section', 364 optionsSelect = optionsSection + ' select#s2member-pro-stripe-' + coTypeWithDashes + '-options', 365 366 descSection = 'div#s2member-pro-stripe-' + coTypeWithDashes + '-form-description-section', 367 368 couponSection = 'div#s2member-pro-stripe-' + coTypeWithDashes + '-form-coupon-section', 369 couponApplyButton = couponSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-coupon-apply', 370 371 registrationSection = 'div#s2member-pro-stripe-' + coTypeWithDashes + '-form-registration-section', 372 customFieldsSection = 'div#s2member-pro-stripe-' + coTypeWithDashes + '-form-custom-fields-section', 373 374 billingMethodSection = 'div#s2member-pro-stripe-form-billing-method-section', 375 sourceTokenButton = billingMethodSection + ' button#s2member-pro-stripe-' + coTypeWithDashes + '-form-source-token-button', 376 sourceTokenSummary = billingMethodSection + ' div#s2member-pro-stripe-' + coTypeWithDashes + '-form-source-token-summary', 377 378 billingAddressSection = 'div#s2member-pro-stripe-' + coTypeWithDashes + '-form-billing-address-section', 379 ajaxTaxDiv = billingAddressSection + ' > div#s2member-pro-stripe-' + coTypeWithDashes + '-form-ajax-tax-div', 380 381 captchaSection = 'div#s2member-pro-stripe-' + coTypeWithDashes + '-form-captcha-section', 382 383 submissionSection = 'div#s2member-pro-stripe-' + coTypeWithDashes + '-form-submission-section', 384 sourceTokenInput = submissionSection + ' input[name="' + ws_plugin__s2member_escjQAttr('s2member_pro_stripe_' + coTypeWithUnderscores + '[source_token]') + '"]', 385 sourceTokenSummaryInput = submissionSection + ' input[name="' + ws_plugin__s2member_escjQAttr('s2member_pro_stripe_' + coTypeWithUnderscores + '[source_token_summary]') + '"]', 386 submissionNonceVerification = submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-nonce', 387 submissionButton = submissionSection + ' button#s2member-pro-stripe-' + coTypeWithDashes + '-submit'; 388 389 /* 390 Reset button states; in case of a back button. 391 */ 392 $(optionsSelect).removeAttr('disabled'), $(couponApplyButton).removeAttr('disabled'), 393 $(submissionButton).removeAttr('disabled'), ws_plugin__s2member_animateProcessing($(submissionButton), 'reset'); 394 /* 395 Handle checkout options. Does this form have checkout options? 396 */ 397 if(!$(optionsSelect + ' option').length) 398 $(optionsSection).hide(), $(descSection).show(); 399 400 else $(optionsSection).show(), $(descSection).hide(), 401 $(optionsSelect).on('change', function(/* Handle checkout option changes. */) 402 { 403 $(submissionNonceVerification).val('option'), 404 $coForm.attr('action', $coForm.attr('action').replace(/#.*$/, '') + '#s2p-form'), 405 $coForm.submit(); // Submit form with a new checkout option. 406 }); 407 /* 408 Handle the coupon code section. Enabled on this form? 409 */ 410 if($(submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-coupons-not-required-or-not-possible').length) 411 $(couponSection).hide(); // Not accepting coupons on this particular form. 412 413 else $(couponSection).show(), $(couponApplyButton).on('click', function(/* Submit c
413oupon code upon clicking apply button. */) 414 { 415 $(submissionNonceVerification).val('apply-coupon'), 416 $coForm.attr('action', $coForm.attr('action').replace(/#.*$/, '') + '#s2p-form'), 417 $coForm.submit(); // Submit form with hash positioning. 418 }); 419 /* 420 Handle a user that is already logged into their account. 421 */ 422 if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN/* User is already logged in? */) 423 { 424 $(registrationSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-first-name') 425 .each(function() 426 { 427 var $this = $(this), val = $this.val(); 428 if(!val) $this.val(S2MEMBER_CURRENT_USER_FIRST_NAME); 429 }); 430 $(registrationSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-last-name') 431 .each(function() 432 { 433 var $this = $(this), val = $this.val(); 434 if(!val) $this.val(S2MEMBER_CURRENT_USER_LAST_NAME); 435 }); 436 $(registrationSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-email').val(S2MEMBER_CURRENT_USER_EMAIL).attr(ariaFalseDis), 437 $(registrationSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-username').val(S2MEMBER_CURRENT_USER_LOGIN).attr(ariaFalseDis); 438 439 if(coTypeWithDashes === 'sp-checkout') // Specific Post/Page Access requires an email address. 440 $(registrationSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-email').attr(ariaTrue).removeAttr('disabled'); 441 442 $(registrationSection + ' > div#s2member-pro-stripe-' + coTypeWithDashes + '-form-password-div').hide(), 443 $(registrationSection + ' > div#s2member-pro-stripe-' + coTypeWithDashes + '-form-password-div :input').attr(ariaFalseDis); 444 445 if($.trim($(registrationSection + ' > div#s2member-pro-stripe-' + coTypeWithDashes + '-form-registration-section-title').html()) === 'Create Profile') 446 $(registrationSection + ' > div#s2member-pro-stripe-' + coTypeWithDashes + '-form-registration-section-title').html('Your Profile'); 447 448 $(customFieldsSection).hide(), $(customFieldsSection + ' :input').attr(ariaFalseDis); 449 } 450 /* 451 Handle the password input field in various scenarios. 452 */ 453 if($(submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-password-not-required-or-not-possible').length) 454 { 455 $(registrationSection + ' > div#s2member-pro-stripe-' + coTypeWithDashes + '-form-password-div').hide(), 456 $(registrationSection + ' > div#s2member-pro-stripe-' + coTypeWithDashes + '-form-password-div :input').attr(ariaFalseDis); 457 } 458 else $(registrationSection + ' > div#s2member-pro-stripe-' + coTypeWithDashes + '-form-password-div :input').on('keyup initialize.s2', function() 459 { 460 ws_plugin__s2member_passwordStrength( 461 $(registrationSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-username'), 462 $(registrationSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-password1'), 463 $(registrationSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-password2'), 464 $(registrationSection + ' div#s2member-pro-stripe-' + coTypeWithDashes + '-form-password-strength') 465 ); 466 }).trigger('initialize.s2'); 467 /* 468 Handle tax calulations via tax-related input fields. 469 */ 470 if($(submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-tax-not-required-or-not-possible').length) 471 $(ajaxTaxDiv).hide(), taxMayApply = false; // Tax does NOT even apply. 472 473 else // We need to setup a few handlers. 474 { 475 cTaxDelay = function(eventTrigger) 476 { 477 setTimeout(function(){ calculateTax(eventTrigger); }, 10); 478 }; 479 calculateTax = function(eventTrigger) // Calculates tax. 480 { 481 if(!taxMayApply) return; // Not applicable. 482 483 if(eventTrigger && eventTrigger.interval && document.activeElement 484 && document.activeElement.id === 's2member-pro-stripe-' + coTypeWithDashes + '-country') 485 return; // Nothing to do in this special case. 486 487 var attr = $(submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-attr').val(), 488 state = $.trim($(billingAddressSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-state').val()), 489 country = $.trim($(billingAddressSection + ' select#s2member-pro-stripe-' + coTypeWithDashes + '-country').val()), 490 zip = $.trim($(billingAddressSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-zip').val()),
491 thisTaxLocation = state + '|' + country + '|' + zip, // Three part location. 492 isBitcoin = $.trim($(sourceTokenInput).val()).indexOf('btcrcv_') === 0; 493 494 if(state && country && zip && thisTaxLocation && !isBitcoin && (!cTaxLocation || cTaxLocation !== thisTaxLocation)) 495 { 496 clearTimeout(cTaxTimeout), cTaxTimeout = 0, 497 cTaxLocation = thisTaxLocation; // Set current location. 498 if(cTaxReq) cTaxReq.abort(); // Abort any existing connections. 499 500 var verifier = 'ZGVmNTAyMDBlMGQxYzc2MjBmYmY0M2UxODMyNjAzNmQxMDJhNDFjN2I2MzMzMDAyNDY4ZDMwN2E5NzFkNzRlOWUxNzc1ZmM1YzA4OTJmZGE4N2FhMzljMDJlZWEyODhjY2ViZmEzNDhhNDIzMjFjN2VkOTQ1YjcyYTJjYjZiZTYyYmU3OTBlYjVkMzI3NjBmOWU0ODViNjExZTczZWFkZjRiMTFlMzVlMzVjOTBhZTM1ZjBkYzc2YzQ1YTBjOWIxMWI2NTQyNjdhZmUxYWFmZTAyMjMyODM4NWUyMDc2MzFmYTIwZjZlY2NiYjJlNTZhZjEyNWE2', 501 calculating = '<div><img src="' + ws_plugin__s2member_escAttr(preloadAjaxLoader.src) + '" alt="" /> calculating sales tax...</div>', 502 ajaxTaxHandler = function(/* Create a new cTaxTimeout with a one second delay. */) 503 { 504 cTaxReq = $.post('https://betterbaking.com/wp-admin/admin-ajax.php', 505 { 506 'action' : 'ws_plugin__s2member_pro_stripe_ajax_tax', 507 'ws_plugin__s2member_pro_stripe_ajax_tax' : verifier, 508 'ws_plugin__s2member_pro_stripe_ajax_tax_vars[attr]' : attr, 509 'ws_plugin__s2member_pro_stripe_ajax_tax_vars[state]' : state, 510 'ws_plugin__s2member_pro_stripe_ajax_tax_vars[country]': country, 511 'ws_plugin__s2member_pro_stripe_ajax_tax_vars[zip]' : zip 512 }, 513 function(response, textStatus) 514 { 515 clearTimeout(cTaxTimeout), cTaxTimeout = 0; 516 if(typeof response === 'object' && response.hasOwnProperty('tax')) 517 /* translators: `Sales Tax (Today)` and `Total (Today)`. The word `Today` is displayed when/if a trial period is offered. The word `Today` is translated elsewhere. */ 518 $(ajaxTaxDiv).html('<div>' + $.sprintf('<strong>Sales Tax%s:</strong> %s<br /><strong>â Total%s:</strong> %s', ((response.trial) ? ' ' + 'Today' : ''), ((response.tax_per) ? '<em>' + response.tax_per + '</em> ( ' + response.cur_symbol + '' + response.tax + ' )' : response.cur_symbol + '' + response.tax), ((response.trial) ? ' ' + 'Today' : ''), response.cur_symbol + '' + response.total) + '</div>'); 519 }, 'json'); 520 }; 521 $(ajaxTaxDiv).html(calculating), cTaxTimeout = setTimeout(ajaxTaxHandler, ((eventTrigger && eventTrigger.keyCode) ? 1000 : 100)); 522 } 523 else if(!state || !country || !zip || !thisTaxLocation || isBitcoin) 524 { 525 clearTimeout(cTaxTimeout), cTaxTimeout = 0, 526 cTaxLocation = ''; // Reset the current location. 527 if(cTaxReq) cTaxReq.abort(); // Abort any existing connections. 528 $(ajaxTaxDiv).html(''); // Empty the tax calculation div here also. 529 } 530 }; 531 setInterval(function(){ calculateTax({interval: true}); }, 1000), // Helps with things like Google's Autofill feature. 532 $(billingAddressSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-state').on('keyup blur', calculateTax).on('cut paste', cTaxDelay), 533 $(billingAddressSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-zip').on('keyup blur', calculateTax).on('cut paste', cTaxDelay), 534 $(billingAddressSection + ' select#s2member-pro-stripe-' + coTypeWithDashes + '-country').on('change', calculateTax), 535 calculateTax(); // Calculate immediately to deal with fields already filled in. 536 } 537 handleBillingMethod = function(eventTrigger /* eventTrigger is passed by jQuery for DOM events. */) 538 { 539 if($(submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-payment-not-required-or-not-possible').length) 540 $(sourceTokenInput).val('free'); // No payment required in this very special case. 541 542 var sourceToken = $(sourceTokenInput).val(/* Source token from Stripe. */); 543 544 if(sourceToken/* They have now supplied a source token? */) 545 { 546 if(sourceToken === 'free' /* Special source token value. */) 547 { 548 $(billingMethodSection).hide(), // Hide billing method section. 549 $(billingMethodSection + ' > div.s2member-pro-stripe-' + coTypeWithDashes + '-form-div').hide(), 550 $(billingMethodSection + ' > div.s2member-pro-stripe-' + coTypeWithDashes + '-form-div :input').attr(ariaFalse); 551 } 552 else // We need to display the billing method section in all other cases. 553 { 554 $(billingMethodSection).show(), // Show billing method section. 555 $(billingMethodSection + ' > div.s2member-pro-stripe-' + coTypeWithDashes + '-form-div').show(), 556 $(billingMethodSection + ' > div.s2member-pro-stripe-' + coTypeWithDashes + '-form-div :input').attr(ariaTrue); 557 } 558 if(sourceToken !== 'free' && taxMayApply && sourceToken.indexOf('btcrcv_') !== 0) 559 { 560 $(billingAddressSection).show(), // Show billing address section. 561 $(billingAddressSection + ' > div.s2member-pro-stripe-' + coTypeWithDashes + '-form-div').show(), 562 $(billingAddressSection + ' > div.s2member-pro-stripe-' + coTypeWithDashes + '-form-div :input').attr(ariaTrue); 563 } 564 else // There is no reason to collect tax information in this case. 565 { 566 $(billingAddressSection).hide(), // Hide billing address section. 567 $(billingAddressSection + ' > div.s2member-pro-stripe-' + coTypeWithDashes + '-form-div').hide(), 568 $(billingAddressSection + ' > div.s2member-pro-stripe-' + coTypeWithDashes + '-form-div :input').attr(ariaFalse); 569 } 570 if(eventTrigger) $(submissionSection + ' button#s2member-pro-stripe-' + coTypeWithDashes + '-submit').focus(); 571 } 572 else if(!sourceToken/* Else there is no Billing Method supplied. */) 573 { 574 $(billingMethodSection).show(), // Show billing method section. 575 $(billingMethodSection + ' > div.s2member-pro-stripe-' + coTypeWithDashes + '-form-div').show(), 576 $(billingMethodSection + ' > div.s2member-pro-stripe-' + coTypeWithDashes + '-form-div :input').attr(ariaTrue); 577 578 $(billingAddressSection).hide(), // Hide billing address section. 579 $(billingAddressSection + ' > div.s2member-pro-stripe-' + coTypeWithDashes + '-form-div').hide(), 580 $(billingAddressSection + ' > div.s2member-pro-stripe-' + coTypeWithDashes + '-form-div :input').attr(ariaFalse); 581 } 582 }; 583 handleBillingMethod(); // Handle billing method immediately to deal with fields already filled in. 584 585 //!!! ^^^We don't use tokens anymore... 586 if(taxMayApply) 587 { 588 $(billingAddressSection).show(), // Show billing address section. 589 $(billingAddressSection + ' > div.s2member-pro-stripe-' + coTypeWithDashes + '-form-div').show(), 590 $(billingAddressSection + ' > div.s2member-pro-stripe-' + coTypeWithDashes + '-form-div :input').attr(ariaTrue); 591 } 592 else // There is no reason to collect tax information in this case. 593 { 594 $(billingAddressSection).hide(), // Hide billing address section. 595 $(billingAddressSection + ' > div.s2member-pro-stripe-' + coTypeWithDashes + '-form-div').hide(), 596 $(billingAddressSection + ' > div.s2member-pro-stripe-' + coTypeWithDashes + '-form-div :input').attr(ariaFalse); 597 } 598 599 //!!! "free" check to hide the billing method when 100% off coupons. 600 if($(submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-payment-not-required-or-not-possible').length) 601 { 602 var isFree = true; 603 $(billingMethodSection).hide(), // Hide billing method section. 604 $(billingMethodSection + ' > div').hide(), 605 $(billingMethodSection + ' > label').hide(); 606 607 $(billingAddressSection).hide(), // Hide billing address section. 608 $(billingAddressSection + ' > div.s2member-pro-stripe-' + coTypeWithDashes + '-form-div').hide(), 609 $(billingAddressSection + ' > div.s2member-pro-stripe-' + coTypeWithDashes + '-form-div :input').attr(ariaFalse); 610 } 611 612 $(sourceTokenButton).on('click', function() // Stripe integration. 613 { 614 var isBuyNow = $(submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-is-buy-now-amount-in-cents').length > 0, 615 validateZipCode = $(submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-should-validate-zipcode').val() == '1', 616 collectBillingAddress = $(submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-should-collect-billing-address').val() == '1', 617 collectShippingAddress = $(submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-should-collect-shipping-address').val() == '1', 618 acceptBitcoin = isBuyNow && $(submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-is-buy-now-bitcoin-accepted').length > 0, 619 isBuyNowAmountInCents = isBuyNow ? parseInt($.trim($(submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-is-buy-now-amount-in-cents').val())) : 0, 620 isBuyNowCurrency = isBuyNow ? $.trim($(submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-is-buy-now-currency').val()).toUpperCase() : '', 621 isBuyNowDesc = isBuyNow ? $.trim($(submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-is-buy-now-desc').val()) : '', 622 stripeImage = ''; 623 624 if(isBuyNow && (isNaN(isBuyNowAmountInCents) || isBuyNowAmountInCents <= 0)) 625 isBuyNow = false, acceptBitcoin = false, isBuyNowAmountInCents = 0, isBuyNowCurrency = '', isBuyNowDesc = ''; 626 627 var getSourceToken = StripeCheckout.configure 628 ({
629 image : stripeImage ? stripeImage : undefined, 630 locale : 'auto', // Based on visitor's country. 631 632 amount : isBuyNow ? isBuyNowAmountInCents : undefined, 633 currency : isBuyNow ? isBuyNowCurrency : undefined, 634 description: isBuyNow ? isBuyNowDesc : undefined, 635 bitcoin : isBuyNow && acceptBitcoin, 636 637 key : '', 638 allowRememberMe: '1' == '1', 639 panelLabel : 'Add', 640 zipCode : validateZipCode, billingAddress : collectBillingAddress, shippingAddress: collectShippingAddress, 641 email : $(registrationSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-email').val(), 642 643 token: function(token) // Callback handler. 644 { 645 $(sourceTokenInput).val(token.id), $(sourceTokenSummaryInput).val(buildSourceTokenTextSummary(token)), 646 $(sourceTokenSummary).html(ws_plugin__s2member_escHtml(buildSourceTokenTextSummary(token))), 647 handleBillingMethod(); // Adjust billing methods fields now also. 648 } 649 }); 650 getSourceToken.open(); // Open Stripe overlay. 651 }); 652 $coForm.on('submit', function(/* Form validation. */) 653 { 654 if($.inArray($(submissionNonceVerification).val(), ['option', 'apply-coupon']) === -1) 655 { 656 var context = this, label = '', error = '', errors = '', 657 $recaptchaResponse = $(captchaSection + ' input#recaptcha_response_field, '+captchaSection+' #g-recaptcha-response'), 658 $password1 = $(registrationSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-password1[aria-required="true"]'), 659 $password2 = $(registrationSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-password2'); 660 661 $(':input', context) 662 .each(function(/* Go through them all together. */) 663 { 664 var id = $.trim($(this).attr('id')).replace(/---[0-9]+$/g, ''/* Remove numeric suffixes. */); 665 if(id && (label = $.trim($('label[for="' + id.replace(/-(month|year)/, '') + '"]', context).first().children('span').first().text().replace(/[\r\n\t]+/g, ' ')))) 666 { 667 if(error = ws_plugin__s2member_validationErrors(label, this, context)) 668 errors += error + '\n\n'/* Collect errors. */; 669 } 670 }); 671 if((errors = $.trim(errors))) 672 { 673 alert('â Oops, you missed something: â' + '\n\n' + errors); 674 return false; // Error; cannot continue in this scenario. 675 } 676 else if($password1.length && $.trim($password1.val()) !== $.trim($password2.val())) 677 { 678 alert('â Oops, you missed something: â' + '\n\n' + 'Passwords do not match up. Please try again.'); 679 return false; // Error; cannot continue in this scenario. 680 } 681 else if($password1.length && $.trim($password1.val()).length < ws_plugin__s2member_passwordMinLength()) 682 { 683 alert('â Oops, you missed something: â' + '\n\n' + 'Password MUST be at least 8 characters. Please try again.'); 684 return false; 685 } 686 else if($password1.length && ws_plugin__s2member_passwordStrengthMeter($.trim($password1.val()), $.trim($password2.val()), true) < ws_plugin__s2member_passwordMinStrengthScore()) 687 { 688 alert('â Oops, you missed something: â' + '\n\n' + 'Password strength MUST be `good` or `strong` (i.e., use numbers, letters, and mixed caSe). Please try again.'); 689 return false; 690 } 691 else if($recaptchaResponse.length && !$recaptchaResponse.val()) 692 { 693 alert('â Oops, you missed something: â' + '\n\n' + 'Security Verification missing. Please try again.'); 694 return false; // Error; cannot continue in this scenario. 695 } 696 // $(optionsSelect).attr(disabled); // Not an option selection. 697 //!!! Bug fix. Don't disable, because that prevents it from being submitted. 698 } 699 $(couponApplyButton).attr(disabled), 700 $(submissionButton).attr(disabled), ws_plugin__s2member_animateProcessing($(submissionButton)); 701 return true; // Allow submission. 702 }); 703 })($coForm); 704 } 705 var buildSourceTokenTextSummary = function(token, args) 706 { 707 if(typeof token !== 'object') return ''; 708 // `args` contains billing/shipping address. 709
710 if(token.type === 'card' && token.card && token.card.brand && token.card.last4) 711 return token.card.brand + ': xxxx-xxxx-xxxx-' + token.card.last4; 712 713 if(token.type === 'alipay_account' && token.alipay_account && token.alipay_account.username) 714 return 'Alipay: ' + token.alipay_account.username; 715 716 if(token.type === 'bank_account' && token.bank_account && token.bank_account.bank_name && token.bank_account.last4) 717 return token.bank_account.bank_name + ': xxxx...' + token.bank_account.last4; 718 719 if(token.type === 'source_bitcoin' && token.bitcoin && token.bitcoin.address) 720 return 'Bitcoin: ' + token.bitcoin.address; 721 722 return 'Token: ' + token.id; 723 }; 724 /* 725 Jump to responses. 726 */ 727 $('div#s2member-pro-stripe-form-response') 728 .each(function() 729 { 730 scrollTo(0, $(this).offset().top - 100); 731 }); 732 733 // Stripe SCA update. 734 var form = document.getElementsByClassName('s2member-pro-stripe-form')[0]; 735 var isFree = ($('input#s2member-pro-stripe-sp-checkout-payment-not-required-or-not-possible').length || $('input#s2member-pro-stripe-checkout-payment-not-required-or-not-possible').length) ? true : false; 736 if (form && !isFree) { 737 var stripe = Stripe('', { 738 apiVersion: '2019-10-08', 739 }); 740 var elements = stripe.elements(); 741 var piSecret = jQuery('#s2member-pro-stripe-form-pi-secret').val(); 742 var setiSecret = jQuery('#s2member-pro-stripe-form-seti-secret').val(); 743 744 // Do we have a Setup Intent with status require_action? 745 if (setiSecret) { 746 stripe.handleCardSetup( 747 setiSecret 748 ).then(function(result) { 749 // Handle result.error or result.setupIntent 750 if (result.error) { 751 // Display result.error.message in UI. 752 var errorElement = document.getElementById('s2member-pro-stripe-form-card-errors'); 753 errorElement.textContent = result.error.message; 754 } else { 755 // The SetupIntent has successfully been authorized. 756 // Update Setup Intent hidden field with ID. 757 jQuery('#s2member-pro-stripe-form-seti-id').val(result.setupIntent.id); 758 759 // Make it more obvious that something is happening, and just wait... 760 jQuery('.s2member-pro-stripe-submit') 761 .prop('disabled', true) 762 .addClass('ws-plugin--s2member-animate-processing'); 763 jQuery(form).addClass('s2member-pro-stripe-form-disabled'); 764 jQuery('#s2member-pro-stripe-form-response') 765 .removeClass('s2member-pro-stripe-form-response-error') 766 .addClass('s2member-pro-stripe-form-response-info') 767 .text('Please wait. Don´t close or refresh the window. Processing...'); 768 769 // Submit the form 770 form.submit(); 771 } 772 }); 773 } 774 775 // Do we have a Payment Intent with status require_action? 776 if (piSecret) { 777 // If there's a subscription ID, it's a subscription 778 // then payment intent's confirmation_method will be set to "automatic", so use handleCardPayment 779 // else it's a single payment with confirmation_method set to "manual", so use handleCardAction. 780 if (jQuery('#s2member-pro-stripe-form-sub-id').val()) { 781 handleCardResult = stripe.handleCardPayment(piSecret); 782 } else { 783 handleCardResult = stripe.handleCardAction(piSecret); 784 } 785 786 handleCardResult.then(function(result) { 787 // Handle result.error or result.paymentIntent 788 if (result.error) { 789 // Display result.error.message in UI. 790 var errorElement = document.getElementById('s2member-pro-stripe-form-card-errors'); 791 errorElement.textContent = result.error.message; 792 } else { 793 // The PaymentIntent has successfully been authorized. 794 // Update Payment Intent hidden field with ID. 795 jQuery('#s2member-pro-stripe-form-pi-id').val(result.paymentIntent.id); 796 797 // Make it more obvious that something is happening, and just wait... 798 jQuery('.s2member-pro-stripe-submit') 799 .prop('disabled', true) 800 .addClass('ws-plugin--s2member-animate-processing'); 801 jQuery(form).addClass('s2member-pro-stripe-form-disabled'); 802 jQuery('#s2member-pro-stripe-form-response') 803 .removeClass('s2member-pro-stripe-form-response-error') 804 .addClass('s2member-pro-stripe-form-response-info') 805 .text('Please wait. Don´t close or refresh the window. Processing...'); 806 807 // Submit the form 808 form.submit(); 809 } 810 }); 811 } 812 813 // Options when creating an Element. 814 var style = { 815 base: { 816 fontSize: '17px', 817 color: '#333', 818 } 819 }; 820 var hideZip = '0' == 1 ? false : true; 821 822 // Create an instance of the card Element. 823 var cardElement = elements.create('card', { 824 style: style, 825 hidePostalCode: hideZip, 826 }); 827 828 // Add an instance of the card Element into the `card-element` div. 829 cardElement.mount('#s2member-pro-stripe-form-card-element'); 830 831 // Listen to change events on the card Element and display any errors. 832 cardElement.addEventListener('change', function(event) { 833 var displayError = document.getElementById('s2member-pro-stripe-form-card-errors'); 834 if (event.error) { 835 displayError.textContent = event.error.message; 836 } else { 837 displayError.textContent = ''; 838 } 839 }); 840 841 // Control form submit. 842 form.addEventListener('submit', function(event) { 843 event.preventDefault(); 844 845 var fullName = jQuery('.s2member-pro-stripe-first-name').val() + ' ' + jQuery('.s2member-pro-stripe-last-name').val(); 846 var emailAddress = jQuery('.s2member-pro-stripe-email').val(); 847 var addrStreet = jQuery('.s2member-pro-stripe-street').val(); 848 var addrCity = jQuery('.s2member-pro-stripe-city').val(); 849 var addrState = jQuery('.s2member-pro-stripe-state').val(); 850 var addrCountry = jQuery('.s2member-pro-stripe-country').val(); 851 var addrZip = jQuery('.s2member-pro-stripe-zip').val(); 852 var billAddr = { 853 line1: addrStreet, 854 city: addrCity, 855 state: addrState, 856 country: addrCountry, 857 postal_code: addrZip, 858 }; 859 860 // Create the Payment Method. 861 stripe.createPaymentMethod( 862 'card', 863 cardElement, 864 { 865 billing_details: { 866 email: emailAddress, 867 name: fullName, 868 address: addrState ? billAddr : null, 869 } 870 } 871 ).then(function(result) { 872 if (result.error) { 873 // Display result.error.message in UI. 874 jQuery('#s2member-pro-stripe-form-card-errors').text(result.error.message); 875 jQuery('.s2member-pro-stripe-submit') 876 .prop('disabled', false) 877 .removeClass('ws-plugin--s2member-animate-processing'); 878 } else { 879 // The PaymentMethod has successfully been created. 880 // Update Payment Method hidden field with ID. 881 jQuery('#s2member-pro-stripe-form-pm-id').val(result.paymentMethod.id); 882 883 // Submit the form 884 form.submit(); 885 } 886 }).catch(console.error.bind(console)); 887 }); 888 } 889 } 890 } 891 }); 892 893;window.ws_plugin__s2member_asset_health=window.ws_plugin__s2member_asset_health||{};window.ws_plugin__s2member_asset_health["dynamic_js"]="dynamic-s2member-o";
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.