PageSourceSearch

https://www.drgideonsandler.com/rw_common/plugins/stacks/formsnap/assets/js/formsnap4.js?rwcache=781854313

js drgideonsandler.com collected 2026-10-08 01:29:37 UTC 10,563 bytes, 4 lines download raw bytes

1
2/*-- FormSnap JS Built on: Mon Aug 05 2024 14:42:51 GMT-0400 (Eastern Daylight Time) --*/
3({620:function(){document.addEventListener("alpine:init",(()=>{Alpine.magic("step",(e=>Array.prototype.indexOf.call(e.parentNode.children,e)+1)),Alpine.magic("now",(()=>(new Date).toLocaleTimeString())),Alpine.directive("value",((e,{expression:t},{effect:s})=>{s((()=>{let s=this.$store("formsnap").getValue(t);Alpine.mutateDom((()=>{e.textContent=s}))}))})),Alpine.store("formsnap",{items:[],getValue(e){console.debug(this.items),console.debug("getting value for item: "+e);const t=this.items.find((t=>t.name===e));return console.debug(t),t?t.value:void 0}}),Alpine.data("formsnap",(()=>({version:"4.0.0",timeout:15e3,stackid:"",dbg:!1,logo:"",url:"",page:"",reply_to_item:null,do_not_send:!1,recipients_to:null,from_name:null,from_email:null,csrf_token:"",recaptcha_token:"",use_turnstile:!1,turnstile_site_key:"",turnstile_token:"",captcha_code:"",rellikmaps:"",security_answer:"",preview:!1,persist:!1,processing:!1,email_template:"",receipt_template:"",persistedItems:JSON.parse(localStorage.getItem("persistedItems")||"[]"),step:1,theme:"blue",steps:[],formResults:"",currentStep:1,floating_label:!0,ready:!1,error_title:"Error!",error_message:"Oops! An Error Occurred",success_title:"Success!",success_message:"Message Sent Successfully!",processing_title:"Processing",processing_message:"Please be patient while we process your form submission.",file_too_big:"Maximum File Size Exceeded.",file_not_allowed:"File Type Not Allowed.",required_field_alert:"One or More Required Field(s) are Missing.",invalid_email:"Invalid Email.",ok_button:"OK",redirect_message:"Redirecting ...",invalid_login:"Invalid Login, please try again.",darkmode:{init(){const e=localStorage.getItem("appearance");this.on="dark"===e||!("appearance"in localStorage)&&window.matchMedia("(prefers-color-scheme: dark)").matches},on:!1,toggle(){this.on=!this.on,this.on?(document.body.classList.add("dark"),document.documentElement.classList.add("dark"),localStorage.setItem("appearance","dark")):(document.documentElement.classList.remove("dark"),document.body.classList.remove("dark"),localStorage.setItem("appearance","light"))}},init(){this.$nextTick((()=>{document.body.dataset.theme=this.theme,document.body.dataset.mode=this.darkmode.on?"dark":"light",this.$el.querySelectorAll("section[yd-form-step]").forEach(((e,t)=>{this.steps.push({id:t+1})})),this.use_turnstile&&"undefined"!=typeof turnstile&&turnstile.render("#yd-turnstile",{sitekey:this.turnstile_site_key,language:"en",theme:"light",callback:e=>{this.debug(`Turnstile Challenge Success: ${e}`),this.turnstile_token=`${e}`}}),this.persist&&Alpine.effect((()=>{const e=this.$store.formsnap.items;localStorage.setItem("persistedItems",JSON.stringify(e))})),this.ready=!0,this.verifyItemSettings()}))},debug(e){this.dbg&&window.console&&window.console.log&&window.console.log("[formsnap v."+this.version+"] "+e)},logError(e){window.console&&window.console.log&&e&&window.console.error("[formsnap v."+this.version+"] \n"+e.trim())},convertToCSV(e){return this.debug("input = "+e),this.isEmpty(e)?"":Array.isArray(e)?e.map((e=>e.toString())).join(", "):e.toString()},addItemToForm(e){let t=Alpine.closestDataStack(e)[0];this.debug("Adding "+t.name+" to items store.");let s=this.persistedItems.find((e=>e.name===t.name));s&&(this.debug("Found persisted value for "+s.name+" = "+s.value),"select"!=s.type&&"checkbox"!=s.type||(t.optionItems=s.optionItems,t.value=s.value),"text"!=s.type&&"input"!=s.item&&"radio"!=s.item&&"slider"!=s.item||(t.value=s.value)),this.$store.formsnap.items.push(t)},getValue(e){this.debug("getting value for item: "+e);try{return this.$store.formsnap.items.filter((t=>t.name===e))[0].value}catch(e){this.debug(e)}return null},get formStep(){return this.step++},get stepItems(){return this.debug("getting step items..."),this.steps>1?this.$store.formsnap.items:this.$store.formsnap.items.filter((e=>{if(this.debug("item.step = "+e.step),this.debug("currentStep = "+this.currentStep),e.step==this.currentStep)return e}))},showStep(e){this.debug("showStep "+this.currentStep);const t=e.id.split("-")[2];return this.currentStep==t&&(this.debug("currentStep = "+t),!0)},prevStep(e){this.currentStep>1&&(this.currentStep=this.currentStep-1)},nextStep(e){this.debug(this.stepItems),this.steps.length>1&&!this.validateStepItems()&&this.currentStep<this.steps.length&&(this.currentStep=this.currentStep+1)},validateStepItems(){var e=0;
3return this.stepItems.forEach((t=>{this.debug("validate step items - "+t.name+" = "+t.value+" "+t.valid),this.validate(t)||e++})),e},numbersOnly:function(e){const t=e.which?e.which:e.keyCode;if("."===e.key)return!0;t>31&&(t<48||t>57)&&(t<96||t>105)&&110!==t&&e.preventDefault()},processRules(e,t,s){let i=0;return s.forEach((e=>{let t=this.getValue(e.target);switch(e.cond){case"equals":e.val==t&&(this.debug(e.val+" == "+t),i++);break;case"notequals":e.val!==t&&(this.debug(e.val+" !== "+t),i++)}})),this.debug(i),"any"===t&&i>=1?(this.debug("matches any"),"show"===e?1:0):"all"===t&&i==s.length?(this.debug("matches all"),"show"===e?1:0):"show"===e?0:1},resetForm(){this.debug("resetForm called"),this.step=1,this.$store.formsnap.items.forEach((e=>{e.reset()})),this.use_turnstile&&turnstile.reset("#yd-turnstile")},async submitForm(e){this.processing=!0,this.debug("submitForm called");var t=this.validateStepItems();if(!t&&this.currentStep<this.steps.length&&(this.currentStep=this.currentStep+1),t)this.debug(t+" errors found"),this.$nextTick((()=>{this.scrollToFirstError()}));else{this.debug("submitOrder()"),this.processing=!0,this.showModal(this.processing_title,"processing",this.processing_message);const e=new FormData;let t=[];this.$store.formsnap.items.forEach((s=>{if(t.push({id:s.id,file:s.file?s.file:"",active:s.active,name:s.name,value:this.convertToCSV(s.value),item:s.item,type:s.type,required:s.required,label:s.label,save_to_mysql:s.save_to_mysql,save_to_google:s.save_to_google,field_name:s.field_name,file_save_as:s.file_save_as?s.file_save_as:""}),this.debug(s.item),"captcha"==s.item&&(this.captcha_code=s.value),"question"==s.item&&(this.security_answer=s.value),"file"==s.type)if(this.debug(s.value),"signature"==s.item){let t=this.dataURLtoFile(s.value,"signature.png");e.append("signature",t)}else{const t=document.getElementById(s.id).files;if(this.debug(s.name+" files = "+t),t.length>1)for(let i=0;i<t.length;i++)e.append(s.name+"[]",t[i]);else e.append(s.name,t[0])}}));let i=JSON.stringify({logo:this.logo,url:this.url,page:this.page,csrf_token:this.csrf_token,rellikmaps:this.rellikmaps,recaptcha_token:this.recaptcha_token,turnstile_token:this.turnstile_token,captcha_code:this.captcha_code,security_answer:this.security_answer,email_template:this.email_template,receipt_template:this.receipt_template,items:t});e.append("form",i),this.debug("sending data to server");try{await this.fetchWithTimeout(this.url,{method:"POST",timeout:this.timeout,body:e}).then((e=>e.json())).then((e=>{if("good"==e.result)this.processing=!1,this.resetForm(),e.redirect?(this.showModal(this.redirect_message,"processing",""),setTimeout((()=>window.location.href=e.redirect_url),1e4)):this.showModal(this.success_title,"success",this.success_message),this.persist&&localStorage.removeItem("persistedItems");else{if("question"in e){const t=this.$store.formsnap.items.filter((e=>"security_question"===e.name))[0];t.error=!e.question.result,t.msg_error=e.question.error}if("captcha"in e){const t=this.$store.formsnap.items.filter((e=>"captcha_code"===e.name))[0];t.error=!e.captcha.result,t.msg_error=e.captcha.error}this.showModal(e.msg,"error","",e.errors),this.$nextTick((()=>{this.scrollToFirstError()}))}}))}catch(e){var s;console.error(e),this.processing=!1,s="AbortError"===e.name?"The request exceeded the timeout limit of "+this.timeout+" milliseconds":this.msg_error,this.showModal("Fetch Error","error",s)}}},scrollToFirstError(){const e=document.querySelector(".yd-input-error");if(e){const t=e.offsetHeight;window.scrollTo({top:e.offsetTop-20-t,behavior:"smooth"})}},showModal(e,t,s,i=[]){this.$dispatch("modal",{title:e,icon:t,errors:i,content:s,button:"OK"})},validate(e){if(e.error=!1,e.errorMsg="",!e.active)return!0;this.debug("Validating "+e.name+" - "+e.item+"("+e.type+") value = '"+e.value+"'");const t=e.valid;return t||(this.debug(e.name+" not valid"),e.error=!0),t},verifyItemSettings(){if(!this.preview)return;let e=[];const t=/^[a-zA-Z0-9_]+$/;let s=new Set,i=[];this.do_not_send||(this.recipients_to||e.push("<b>Send To</b> is not set."),this.from_name||e.push("<b>From Name</b> is not set."),this.verifyEmailAddress(this.from_email)||e.push("<b>From Email</b>
3 is not set or is invalid format."),this.$store.formsnap.items.filter((e=>e.name===this.reply_to_item))[0]||e.push("<b>Reply-To Item</b> is not set or does not match any Form Items.")),this.$store.formsnap.items.forEach((r=>{let o=t.test(r.name);this.debug(r.name+" result = "+o),o||e.push("<b>"+r.name+"</b> is not a valid form name."),s.has(r.name)?(this.debug("adding item to duplicates: "+r.name),i.push(r.name)):(this.debug("adding item to uniqueValues: "+r.name),s.add(r.name))})),this.debug(i.length+" duplicates found"),i.length>0&&i.forEach((t=>{e.push("<b>${element}</b> is used more than once.")})),e.length>0&&this.showModal("Formsnap Alert","alert","Fix the Following before Publishing.",e)},phpAlert(e){this.showModal("Formsnap Server Alert","alert","FormSnap 4 Requires PHP Version <b>7.4</b> or better. The server this script is hosted on is using PHP Version <b>"+e+"</b><br><br>If in Preview Mode and seeing this error, then you will need to go to Project Settings > Advanced and set <b>PHP Version</b> to 7.4 or higher.")},dataURLtoFile(e,t){for(var s=e.split(","),i=s[0].match(/:(.*?);/)[1],r=atob(s[s.length-1]),o=r.length,n=new Uint8Array(o);o--;)n[o]=r.charCodeAt(o);return new File([n],t,{type:i})},async fetchWithTimeout(e,t={}){const{timeout:s=this.timeout}=t,i=new AbortController,r=setTimeout((()=>i.abort()),s),o=await fetch(e,{...t,signal:i.signal});return clearTimeout(r),o},verifyEmailAddress:e=>!!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e),isEmpty:e=>null==e||!("number"!=typeof e||!isNaN(e))||"boolean"!=typeof e&&"number"!=typeof e&&"bigint"!=typeof e&&("string"==typeof e?0===e.trim().length:Array.isArray(e)?0===e.length:"object"==typeof e&&0===Object.keys(e).length)})))}))}})[620]();
4/*-- Copyright 2024 Yabdab Inc. --*/

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.