Warning: Private methods cannot be final as they are never overridden by other classes in /home/rooftop_admin/rooftopinstitute.org/hokhokzaap/wp-includes/class-wp-session-tokens.php on line 69
(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-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);
var 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;
jQuery(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"weak"};window.ws_plugin__s2member_passwordMinStrengthLabel=function(){return"`weak`, `good`, or `strong`"};window.ws_plugin__s2member_passwordMinStrengthScore=function(){return parseInt("10")};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.length0);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(/^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/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"']/.test(f=String(f))){f=f.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 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-plugin--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()).length1||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");e.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 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='';var h='';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('
")}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)};A(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 0)
{
// Setup the pro-forms only after we managed to load stripe's JS.
$.ajax({cache: true, dataType: 'script', url: 'https://js.stripe.com/v3/'});
var stripeCheck = function() {
if(window.Stripe) // Stripe available?
clearInterval(stripeCheckInterval),
setupProForms();
},
stripeCheckInterval = setInterval(stripeCheck, 100);
var setupProForms = function()
{
/*
Initializations.
*/
var preloadAjaxLoader, // Loading image.
$clForm, $upForm, $rgForm, $spForm, $coForm,
ariaTrue = {'aria-required': 'true'}, ariaFalse = {'aria-required': 'false'},
ariaFalseDis = {'aria-required': 'false', 'disabled': 'disabled'},
disabled = {'disabled': 'disabled'},
taxMayApply = true, calculateTax, cTaxDelay, cTaxTimeout, cTaxReq, cTaxLocation, ajaxTaxDiv,
optionsSection, optionsSelect, descSection, couponSection, couponApplyButton, registrationSection, customFieldsSection,
billingMethodSection, handleBillingMethod, sourceTokenButton, sourceTokenSummary, sourceTokenInput, sourceTokenSummaryInput, billingAddressSection, captchaSection,
submissionSection, submissionButton, submissionNonceVerification;
preloadAjaxLoader = new Image(), preloadAjaxLoader.src = 'https://www.rooftopinstitute.org/hokhokzaap/wp-content/plugins/s2member/src/images/ajax-loader.gif';
/*
Check for more than a single form on this page.
*/
if($('form.s2member-pro-stripe-cancellation-form').length > 1
|| $('form.s2member-pro-stripe-registration-form').length > 1 || $('form.s2member-pro-stripe-update-form').length > 1
|| $('form.s2member-pro-stripe-sp-checkout-form').length > 1 || $('form.s2member-pro-stripe-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.');
}
/*
Cancellation form handler.
*/
if(($clForm = $('form#s2member-pro-stripe-cancellation-form')).length === 1)
{
captchaSection = 'div#s2member-pro-stripe-cancellation-form-captcha-section',
submissionSection = 'div#s2member-pro-stripe-cancellation-form-submission-section',
submissionButton = submissionSection + ' button#s2member-pro-stripe-cancellation-submit';
$(submissionButton).removeAttr('disabled'),
ws_plugin__s2member_animateProcessing($(submissionButton), 'reset');
$clForm.on('submit', function(/* Form validation. */)
{
var context = this, label = '', error = '', errors = '',
$recaptchaResponse = $(captchaSection + ' input#recaptcha_response_field, '+captchaSection+' #g-recaptcha-response');
$(':input', context)
.each(function(/* Go through them all together. */)
{
var id = $.trim($(this).attr('id')).replace(/---[0-9]+$/g, ''/* Remove numeric suffixes. */);
if(id && (label = $.trim($('label[for="' + id + '"]', context).first().children('span').first().text().replace(/[\r\n\t]+/g, ' '))))
{
if(error = ws_plugin__s2member_validationErrors(label, this, context))
errors += error + '\n\n'/* Collect errors. */;
}
});
if((errors = $.trim(errors)))
{
alert('— Oops, you missed something: —' + '\n\n' + errors);
return false; // Error; cannot continue in this scenario.
}
else if($recaptchaResponse.length && !$recaptchaResponse.val())
{
alert('— Oops, you missed something: —' + '\n\n' + 'Security Verification missing. Please try again.');
return false; // Error; cannot continue in this scenario.
}
$(submissionButton).attr(disabled),
ws_plugin__s2member_animateProcessing($(submissionButton));
return true; // Allow submission.
});
}
/*
Registration form handler.
*/
else if(($rgForm = $('form#s2member-pro-stripe-registration-form')).length === 1)
{
optionsSection = 'div#s2member-pro-stripe-registration-form-options-section',
optionsSelect = optionsSection + ' select#s2member-pro-stripe-registration-options',
descSection = 'div#s2member-pro-stripe-registration-form-description-section',
registrationSection = 'div#s2member-pro-stripe-registration-form-registration-section',
captchaSection = 'div#s2member-pro-stripe-registration-form-captcha-section',
submissionSection = 'div#s2member-pro-stripe-registration-form-submission-section',
submissionButton = submissionSection + ' button#s2member-pro-stripe-registration-submit',
submissionNonceVerification = submissionSection + ' input#s2member-pro-stripe-registration-nonce';
$(submissionButton).removeAttr('disabled'),
ws_plugin__s2member_animateProcessing($(submissionButton), 'reset');
if(!$(optionsSelect + ' option').length)
$(optionsSection).hide(), $(descSection).show();
else $(optionsSection).show(), $(descSection).hide(),
$(optionsSelect).on('change', function(/* Handle checkout option changes. */)
{
$(submissionNonceVerification).val('option'),
$rgForm.attr('action', $rgForm.attr('action').replace(/#.*$/, '') + '#s2p-form'),
$rgForm.submit(); // Submit form with a new checkout option.
});
if($(submissionSection + ' input#s2member-pro-stripe-registration-names-not-required-or-not-possible').length)
{
$(registrationSection + ' > div#s2member-pro-stripe-registration-form-first-name-div').hide(),
$(registrationSection + ' > div#s2member-pro-stripe-registration-form-first-name-div :input').attr(ariaFalseDis);
$(registrationSection + ' > div#s2member-pro-stripe-registration-form-last-name-div').hide(),
$(registrationSection + ' > div#s2member-pro-stripe-registration-form-last-name-div :input').attr(ariaFalseDis);
}
if($(submissionSection + ' input#s2member-pro-stripe-registration-password-not-required-or-not-possible').length)
{
$(registrationSection + ' > div#s2member-pro-stripe-registration-form-password-div').hide(),
$(registrationSection + ' > div#s2member-pro-stripe-registration-form-password-div :input').attr(ariaFalseDis);
}
$(registrationSection + ' > div#s2member-pro-stripe-registration-form-password-div :input').on('keyup initialize.s2', function()
{
ws_plugin__s2member_passwordStrength(
$(registrationSection + ' input#s2member-pro-stripe-registration-username'),
$(registrationSection + ' input#s2member-pro-stripe-registration-password1'),
$(registrationSection + ' input#s2member-pro-stripe-registration-password2'),
$(registrationSection + ' div#s2member-pro-stripe-registration-form-password-strength')
);
}).trigger('initialize.s2');
$rgForm.on('submit', function(/* Form validation. */)
{
if($.inArray($(submissionNonceVerification).val(), ['option']) === -1)
{
var context = this, label = '', error = '', errors = '',
$recaptchaResponse = $(captchaSection + ' input#recaptcha_response_field, '+captchaSection+' #g-recaptcha-response'),
$password1 = $(registrationSection + ' input#s2member-pro-stripe-registration-password1[aria-required="true"]'),
$password2 = $(registrationSection + ' input#s2member-pro-stripe-registration-password2');
$(':input', context)
.each(function(/* Go through them all together. */)
{
var id = $.trim($(this).attr('id')).replace(/---[0-9]+$/g, ''/* Remove numeric suffixes. */);
if(id && (label = $.trim($('label[for="' + id + '"]', context).first().children('span').first().text().replace(/[\r\n\t]+/g, ' '))))
{
if(error = ws_plugin__s2member_validationErrors(label, this, context))
errors += error + '\n\n'/* Collect errors. */;
}
});
if((errors = $.trim(errors)))
{
alert('— Oops, you missed something: —' + '\n\n' + errors);
return false; // Error; cannot continue in this scenario.
}
else if($password1.length && $.trim($password1.val()) !== $.trim($password2.val()))
{
alert('— Oops, you missed something: —' + '\n\n' + 'Passwords do not match up. Please try again.');
return false; // Error; cannot continue in this scenario.
}
else if($password1.length && $.trim($password1.val()).length < ws_plugin__s2member_passwordMinLength())
{
alert('— Oops, you missed something: —' + '\n\n' + 'Password MUST be at least 8 characters. Please try again.');
return false;
}
else if($password1.length && ws_plugin__s2member_passwordStrengthMeter($.trim($password1.val()), $.trim($password2.val()), true) < ws_plugin__s2member_passwordMinStrengthScore())
{
alert('— Oops, you missed something: —' + '\n\n' + 'Password strength MUST be `weak`, `good`, or `strong`. Please try again.');
return false;
}
else if($recaptchaResponse.length && !$recaptchaResponse.val())
{
alert('— Oops, you missed something: —' + '\n\n' + 'Security Verification missing. Please try again.');
return false; // Error; cannot continue in this scenario.
}
// $(optionsSelect).attr(disabled); // Not an option selection.
// Bug fix. Don't disable, because that prevents it from being submitted.
}
$(submissionButton).attr(disabled),
ws_plugin__s2member_animateProcessing($(submissionButton));
return true; // Allow submission.
});
}
/*
Update form handler.
*/
else if(($upForm = $('form#s2member-pro-stripe-update-form')).length === 1)
{
billingMethodSection = 'div#s2member-pro-stripe-update-form-billing-method-section',
sourceTokenButton = billingMethodSection + ' button#s2member-pro-stripe-update-form-source-token-button',
sourceTokenSummary = billingMethodSection + ' div#s2member-pro-stripe-update-form-source-token-summary',
billingAddressSection = 'div#s2member-pro-stripe-update-form-billing-address-section',
captchaSection = 'div#s2member-pro-stripe-update-form-captcha-section',
submissionSection = 'div#s2member-pro-stripe-update-form-submission-section',
sourceTokenInput = submissionSection + ' input[name="' + ws_plugin__s2member_escjQAttr('s2member_pro_stripe_update[source_token]') + '"]',
sourceTokenSummaryInput = submissionSection + ' input[name="' + ws_plugin__s2member_escjQAttr('s2member_pro_stripe_update[source_token_summary]') + '"]',
submissionButton = submissionSection + ' button#s2member-pro-stripe-update-submit';
$(submissionButton).removeAttr('disabled'),
ws_plugin__s2member_animateProcessing($(submissionButton), 'reset');
handleBillingMethod = function(eventTrigger /* eventTrigger is passed by jQuery for DOM events. */)
{
var sourceToken = $(sourceTokenInput).val(/* Source token from Stripe. */);
if(sourceToken/* They have now supplied a source token? */)
{
$(billingMethodSection).show(), // Show billing method section.
$(billingMethodSection + ' > div.s2member-pro-stripe-update-form-div').show(),
$(billingMethodSection + ' > div.s2member-pro-stripe-update-form-div :input').attr(ariaTrue);
if(taxMayApply/* If tax may apply, we need to collect a tax location. */)
{
$(billingAddressSection).show(), // Show billing address section.
$(billingAddressSection + ' > div.s2member-pro-stripe-update-form-div').show(),
$(billingAddressSection + ' > div.s2member-pro-stripe-update-form-div :input').attr(ariaTrue);
}
else // There is no reason to collect tax information in this case.
{
$(billingAddressSection).hide(), // Hide billing address section.
$(billingAddressSection + ' > div.s2member-pro-stripe-update-form-div').hide(),
$(billingAddressSection + ' > div.s2member-pro-stripe-update-form-div :input').attr(ariaFalse);
}
if(eventTrigger) $(submissionSection + ' button#s2member-pro-stripe-update-submit').focus();
}
else if(!sourceToken/* Else there is no Billing Method supplied. */)
{
$(billingMethodSection).show(), // Show billing method section.
$(billingMethodSection + ' > div.s2member-pro-stripe-update-form-div').show(),
$(billingMethodSection + ' > div.s2member-pro-stripe-update-form-div :input').attr(ariaTrue);
$(billingAddressSection).hide(), // Hide billing address section.
$(billingAddressSection + ' > div.s2member-pro-stripe-update-form-div').hide(),
$(billingAddressSection + ' > div.s2member-pro-stripe-update-form-div :input').attr(ariaFalse);
}
};
handleBillingMethod(); // Handle billing method immediately to deal with fields already filled in.
$(sourceTokenButton).on('click', function() // Stripe integration.
{
var validateZipCode = $(submissionSection + ' input#s2member-pro-stripe-update-should-validate-zipcode').val() == '1',
collectBillingAddress = $(submissionSection + ' input#s2member-pro-stripe-update-should-collect-billing-address').val() == '1',
collectShippingAddress = $(submissionSection + ' input#s2member-pro-stripe-update-should-collect-shipping-address').val() == '1',
stripeImage = '';
var getSourceToken = StripeCheckout.configure
({
bitcoin: false, // Accept Bitcoin as a funding source in this instance?
image : stripeImage ? stripeImage : undefined,
locale : 'auto', // Based on visitor's country.
key : '',
allowRememberMe: '1' == '1',
panelLabel : 'Add',
zipCode : validateZipCode, billingAddress : collectBillingAddress, shippingAddress: collectShippingAddress,
email : typeof S2MEMBER_CURRENT_USER_EMAIL === 'string' ? S2MEMBER_CURRENT_USER_EMAIL : '',
token: function(token) // Callback handler.
{
$(sourceTokenInput).val(token.id), $(sourceTokenSummaryInput).val(buildSourceTokenTextSummary(token)),
$(sourceTokenSummary).html(ws_plugin__s2member_escHtml(buildSourceTokenTextSummary(token))),
handleBillingMethod(); // Adjust billing methods fields now also.
}
});
getSourceToken.open(); // Open Stripe overlay.
});
$upForm.on('submit', function(/* Form validation. */)
{
var context = this, label = '', error = '', errors = '',
$recaptchaResponse = $(captchaSection + ' input#recaptcha_response_field, '+captchaSection+' #g-recaptcha-response');
//!!! if(!$(sourceTokenInput).val())
// {
// alert('No Billing Method; please try again.');
// return false; // Error; cannot continue in this scenario.
// }
$(':input', context)
.each(function(/* Go through them all together. */)
{
var id = $.trim($(this).attr('id')).replace(/---[0-9]+$/g, ''/* Remove numeric suffixes. */);
if(id && (label = $.trim($('label[for="' + id.replace(/-(month|year)/, '') + '"]', context).first().children('span').first().text().replace(/[\r\n\t]+/g, ' '))))
{
if(error = ws_plugin__s2member_validationErrors(label, this, context))
errors += error + '\n\n'/* Collect errors. */;
}
});
if((errors = $.trim(errors)))
{
alert('— Oops, you missed something: —' + '\n\n' + errors);
return false; // Error; cannot continue in this scenario.
}
else if($recaptchaResponse.length && !$recaptchaResponse.val())
{
alert('— Oops, you missed something: —' + '\n\n' + 'Security Verification missing. Please try again.');
return false; // Error; cannot continue in this scenario.
}
$(submissionButton).attr(disabled),
ws_plugin__s2member_animateProcessing($(submissionButton));
return true; // Allow submission.
});
}
/*
Handles both types of checkout forms.
*/
else if(($coForm = $('form#s2member-pro-stripe-sp-checkout-form')).length === 1 || ($coForm = $('form#s2member-pro-stripe-checkout-form')).length === 1)
{
(function($coForm)// Handles both types of checkout forms; i.e., Specific Post/Page and also Checkout/Modification forms.
{
var coTypeWithDashes = $coForm[0].id.replace(/^s2member\-pro\-stripe\-/, '').replace(/\-form$/, ''),
coTypeWithUnderscores = coTypeWithDashes.replace(/[^a-z0-9]/gi, '_'); // e.g., `sp_checkout`.
optionsSection = 'div#s2member-pro-stripe-' + coTypeWithDashes + '-form-options-section',
optionsSelect = optionsSection + ' select#s2member-pro-stripe-' + coTypeWithDashes + '-options',
descSection = 'div#s2member-pro-stripe-' + coTypeWithDashes + '-form-description-section',
couponSection = 'div#s2member-pro-stripe-' + coTypeWithDashes + '-form-coupon-section',
couponApplyButton = couponSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-coupon-apply',
registrationSection = 'div#s2member-pro-stripe-' + coTypeWithDashes + '-form-registration-section',
customFieldsSection = 'div#s2member-pro-stripe-' + coTypeWithDashes + '-form-custom-fields-section',
billingMethodSection = 'div#s2member-pro-stripe-form-billing-method-section',
sourceTokenButton = billingMethodSection + ' button#s2member-pro-stripe-' + coTypeWithDashes + '-form-source-token-button',
sourceTokenSummary = billingMethodSection + ' div#s2member-pro-stripe-' + coTypeWithDashes + '-form-source-token-summary',
billingAddressSection = 'div#s2member-pro-stripe-' + coTypeWithDashes + '-form-billing-address-section',
ajaxTaxDiv = billingAddressSection + ' > div#s2member-pro-stripe-' + coTypeWithDashes + '-form-ajax-tax-div',
captchaSection = 'div#s2member-pro-stripe-' + coTypeWithDashes + '-form-captcha-section',
submissionSection = 'div#s2member-pro-stripe-' + coTypeWithDashes + '-form-submission-section',
sourceTokenInput = submissionSection + ' input[name="' + ws_plugin__s2member_escjQAttr('s2member_pro_stripe_' + coTypeWithUnderscores + '[source_token]') + '"]',
sourceTokenSummaryInput = submissionSection + ' input[name="' + ws_plugin__s2member_escjQAttr('s2member_pro_stripe_' + coTypeWithUnderscores + '[source_token_summary]') + '"]',
submissionNonceVerification = submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-nonce',
submissionButton = submissionSection + ' button#s2member-pro-stripe-' + coTypeWithDashes + '-submit';
/*
Reset button states; in case of a back button.
*/
$(optionsSelect).removeAttr('disabled'), $(couponApplyButton).removeAttr('disabled'),
$(submissionButton).removeAttr('disabled'), ws_plugin__s2member_animateProcessing($(submissionButton), 'reset');
/*
Handle checkout options. Does this form have checkout options?
*/
if(!$(optionsSelect + ' option').length)
$(optionsSection).hide(), $(descSection).show();
else $(optionsSection).show(), $(descSection).hide(),
$(optionsSelect).on('change', function(/* Handle checkout option changes. */)
{
$(submissionNonceVerification).val('option'),
$coForm.attr('action', $coForm.attr('action').replace(/#.*$/, '') + '#s2p-form'),
$coForm.submit(); // Submit form with a new checkout option.
});
/*
Handle the coupon code section. Enabled on this form?
*/
if($(submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-coupons-not-required-or-not-possible').length)
$(couponSection).hide(); // Not accepting coupons on this particular form.
else $(couponSection).show(), $(couponApplyButton).on('click', function(/* Submit coupon code upon clicking apply button. */)
{
$(submissionNonceVerification).val('apply-coupon'),
$coForm.attr('action', $coForm.attr('action').replace(/#.*$/, '') + '#s2p-form'),
$coForm.submit(); // Submit form with hash positioning.
});
/*
Handle a user that is already logged into their account.
*/
if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN/* User is already logged in? */)
{
$(registrationSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-first-name')
.each(function()
{
var $this = $(this), val = $this.val();
if(!val) $this.val(S2MEMBER_CURRENT_USER_FIRST_NAME);
});
$(registrationSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-last-name')
.each(function()
{
var $this = $(this), val = $this.val();
if(!val) $this.val(S2MEMBER_CURRENT_USER_LAST_NAME);
});
$(registrationSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-email').val(S2MEMBER_CURRENT_USER_EMAIL).attr(ariaFalseDis),
$(registrationSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-username').val(S2MEMBER_CURRENT_USER_LOGIN).attr(ariaFalseDis);
if(coTypeWithDashes === 'sp-checkout') // Specific Post/Page Access requires an email address.
$(registrationSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-email').attr(ariaTrue).removeAttr('disabled');
$(registrationSection + ' > div#s2member-pro-stripe-' + coTypeWithDashes + '-form-password-div').hide(),
$(registrationSection + ' > div#s2member-pro-stripe-' + coTypeWithDashes + '-form-password-div :input').attr(ariaFalseDis);
if($.trim($(registrationSection + ' > div#s2member-pro-stripe-' + coTypeWithDashes + '-form-registration-section-title').html()) === '帳號資料 Create Profile')
$(registrationSection + ' > div#s2member-pro-stripe-' + coTypeWithDashes + '-form-registration-section-title').html('Your Profile');
$(customFieldsSection).hide(), $(customFieldsSection + ' :input').attr(ariaFalseDis);
}
/*
Handle the password input field in various scenarios.
*/
if($(submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-password-not-required-or-not-possible').length)
{
$(registrationSection + ' > div#s2member-pro-stripe-' + coTypeWithDashes + '-form-password-div').hide(),
$(registrationSection + ' > div#s2member-pro-stripe-' + coTypeWithDashes + '-form-password-div :input').attr(ariaFalseDis);
}
else $(registrationSection + ' > div#s2member-pro-stripe-' + coTypeWithDashes + '-form-password-div :input').on('keyup initialize.s2', function()
{
ws_plugin__s2member_passwordStrength(
$(registrationSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-username'),
$(registrationSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-password1'),
$(registrationSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-password2'),
$(registrationSection + ' div#s2member-pro-stripe-' + coTypeWithDashes + '-form-password-strength')
);
}).trigger('initialize.s2');
/*
Handle tax calulations via tax-related input fields.
*/
if($(submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-tax-not-required-or-not-possible').length)
$(ajaxTaxDiv).hide(), taxMayApply = false; // Tax does NOT even apply.
else // We need to setup a few handlers.
{
cTaxDelay = function(eventTrigger)
{
setTimeout(function(){ calculateTax(eventTrigger); }, 10);
};
calculateTax = function(eventTrigger) // Calculates tax.
{
if(!taxMayApply) return; // Not applicable.
if(eventTrigger && eventTrigger.interval && document.activeElement
&& document.activeElement.id === 's2member-pro-stripe-' + coTypeWithDashes + '-country')
return; // Nothing to do in this special case.
var attr = $(submissionSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-attr').val(),
state = $.trim($(billingAddressSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-state').val()),
country = $.trim($(billingAddressSection + ' select#s2member-pro-stripe-' + coTypeWithDashes + '-country').val()),
zip = $.trim($(billingAddressSection + ' input#s2member-pro-stripe-' + coTypeWithDashes + '-zip').val()),
thisTaxLocation = state + '|' + country + '|' + zip, // Three part location.
isBitcoin = $.trim($(sourceTokenInput).val()).indexOf('btcrcv_') === 0;
if(state && country && zip && thisTaxLocation && !isBitcoin && (!cTaxLocation || cTaxLocation !== thisTaxLocation))
{
clearTimeout(cTaxTimeout), cTaxTimeout = 0,
cTaxLocation = thisTaxLocation; // Set current location.
if(cTaxReq) cTaxReq.abort(); // Abort any existing connections.
var verifier = 'ZGVmNTAyMDAzMDFhMGUzZmEwYzRjNDgzYTMwMDRlMjQxNzZhYmI4NjE0NTBhNTU3ZWRjZDRkNDFiZjM1NmJkMTdmOWZkODZhNjdlM2NmZWQzODA2NWQ1ZmM3ODg1MzkyMWFjMzExNDNlNWQ5YTRmMmMwOGNlNmM5MzkxZWNlZGU5OGEzYTA0Y2UxN2Q5NzM4ZGJmZjBkYTBmMzdmZDU4NzJlMDk3ZjFmMGE5M2U1MDQ0Yjg3YjRhMTU3ZmUyMzgyZTk4OWNmOWNmMzBkN2Q5OTQ0NmY4YTIzY2QwYTU4ZWI1NWViMzQxZmM5Njg4OGFkMTE1Mzdk',
calculating = '
calculating sales tax...
',
ajaxTaxHandler = function(/* Create a new cTaxTimeout with a one second delay. */)
{
cTaxReq = $.post('https://www.rooftopinstitute.org/hokhokzaap/wp-admin/admin-ajax.php',
{
'action' : 'ws_plugin__s2member_pro_stripe_ajax_tax',
'ws_plugin__s2member_pro_stripe_ajax_tax' : verifier,
'ws_plugin__s2member_pro_stripe_ajax_tax_vars[attr]' : attr,
'ws_plugin__s2member_pro_stripe_ajax_tax_vars[state]' : state,
'ws_plugin__s2member_pro_stripe_ajax_tax_vars[country]': country,
'ws_plugin__s2member_pro_stripe_ajax_tax_vars[zip]' : zip
},
function(response, textStatus)
{
clearTimeout(cTaxTimeout), cTaxTimeout = 0;
if(typeof response === 'object' && response.hasOwnProperty('tax'))
/* 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. */
$(ajaxTaxDiv).html('