1(function( $ ) { 2 'use strict'; 3 4 /** 5 * All of the code for your public-facing JavaScript source 6 * should reside in this file. 7 * 8 * Note: It has been assumed you will write jQuery code here, so the 9 * $ function reference has been prepared for usage within the scope 10 * of this function. 11 * 12 * This enables you to define handlers, for when the DOM is ready: 13 * 14 * $(function() { 15 * 16 * }); 17 * 18 * When the window is loaded: 19 * 20 * $( window ).load(function() { 21 * 22 * }); 23 * 24 * ...and/or other possibilities. 25 * 26 * Ideally, it is not considered best practise to attach more than a 27 * single DOM-ready or window-load handler for a particular page. 28 * Although scripts in the WordPress core, Plugins and Themes may be 29 * practising this, we should strive to set a better example in our own work. 30 */ 31 32 jQuery( document ).ready(function() { 33 if (document.getElementsByClassName('captcha-field').length > 0) { 34 35 // Function to handle reCAPTCHA and form submission 36 function handleRecaptcha(form, e) { 37 if (typeof grecaptcha === 'undefined' || typeof grecaptcha.execute !== 'function') { 38 // If grecaptcha is not defined or not fully loaded, submit the form normally 39 return true; 40 } 41 42 e.preventDefault(); 43 grecaptcha.ready(function() { 44 grecaptcha.execute(ccf_settings.captcha_key, {action: 'submit'}) 45 .then(function(token) { 46 let captchaField = form.querySelector('.captcha-field'); 47 if (captchaField) { 48 captchaField.value = token; 49 form.submit(); 50 } else { 51 form.submit(); // Submit anyway if captcha field is not found 52 } 53 }) 54 .catch(function(error) { 55 console.error('reCAPTCHA execution failed:', error); 56 form.submit(); // Submit the form even if reCAPTCHA fails 57 }); 58 }); 59 return false; 60 } 61 62 // Get all forms on the page 63 var forms = document.querySelectorAll('.vmg-contact-form'); 64 65 forms.forEach(function(form) { 66 form.addEventListener('submit', function(e) { 67 return handleRecaptcha(form, e); 68 }); 69 }); 70 } 71 72 if( jQuery( '.wp-block-contact-form .datepicker').length > 0 ) { 73 jQuery('.datepicker').datepicker({ 74 dateFormat: 'mm/dd/yy', // Set the date format as needed 75 changeMonth: true, // Allow the month to be changed directly 76 changeYear: true // Allow the year to be changed directly 77 }); 78 jQuery('#tour_date').datepicker('setDate', 'today'); 79 jQuery('#Date_Requested, #tour_date').datepicker("option", "minDate", 0); // Enable only future dates 80 81 if( jQuery( '#gf_end_date').length > 0 ) { 82 var minDate = new Date(); 83 minDate.setDate(minDate.getDate() + 30); // Set the start of the range to 30 days from now 84 85 var maxDate = new Date(minDate); 86 maxDate.setFullYear(maxDate.getFullYear() + 1 ); // Set the end of the range to 12 months from the minDate 87 88 jQuery('#gf_end_date').datepicker('option', 'minDate', minDate); 89 jQuery('#gf_end_date').datepicker('option', 'maxDate', maxDate); 90 jQuery('#gf_end_date').datepicker('setDate', minDate); 91 92 jQuery('.datepicker').each(function() { 93 var $this = jQuery(this); 94 if($.datepicker._getInst($this[0])) { 95 $this.keydown(function(e) { 96 return false; // Prevent keydown events 97 }); 98 } 99 }); 100 } 101 } 102 103 // Load autofill data for the user profile or auto-fill the form. 104 if ( typeof vsConfig !== 'undefined' && vsConfig.isLogin && ! vsConfig.isUpdated ) { 105 $.ajax({ 106 type: 'POST', 107 url: vsConfig.ajaxUrl, 108 data: { 109 action: 'vs_get_customer_info', 110 nonce: vsConfig.ajax_nonce, 111 }, 112 success: function (response) { 113 if ( response.success && response.data.id ) { 114 $('.wp-block-contact-form .general-freeze #gf_state').val(response.data.primaryAddress.state ? response.data.primaryAddress.state : ''); 115 $('.wp-block-contact-form .general-freeze #gf_zip').val(response.data.primaryAddress.postalCode ? response.data.primaryAddress.postalCode : ''); 116 } 117 } 118 }); 119 } 120 121 // Form condtional logic handle. 122 function evaluateCondition(field, value, operator, actualValue) { 123 const expectedValue = value; 124 125 // Handle if actualValue is an array (checkbox group) 126 if (Array.isArray(actualValue)) { 127 switch (operator) { 128 case 'is': 129 return actualValue.includes(expectedValue); 130 case 'isnot': 131 return !actualValue.includes(expectedValue); 132 // These may not make sense for checkboxes: 133 case 'greaterthan': 134 case 'lessthan': 135 return false; // Or handle based on count if needed 136 default: 137 return false;
138 } 139 } else { 140 // Normalize actualValue to string for safe comparison 141 const actual = actualValue !== undefined ? actualValue.toString() : ''; 142 switch (operator) { 143 case 'is': 144 return actual == expectedValue; 145 case 'is_not': 146 return actual != expectedValue; 147 case 'greaterthan': 148 return parseFloat(actual) > parseFloat(expectedValue); 149 case 'lessthan': 150 return parseFloat(actual) < parseFloat(expectedValue); 151 default: 152 return false; 153 } 154 } 155 } 156 157 function toggleConditionalFields() { 158 $('[data-conditional-field]').each(function () { 159 var $conditionalField = $(this); 160 var targetFieldName = $conditionalField.data('conditional-field'); 161 var expectedValue = $conditionalField.data('conditional-value'); 162 var operator = $conditionalField.data('conditional-operator') || 'is'; 163 164 let $targetInputs = $('[name="' + targetFieldName + '"], [name="' + targetFieldName + '[]"]'); 165 let actualValue = ''; 166 167 if ($targetInputs.length > 1) { 168 let type = $targetInputs.first().attr('type'); 169 if (type === 'checkbox' || type === 'radio') { 170 if ( $targetInputs.filter(':checked').length ){ 171 actualValue = $targetInputs.filter(':checked').map(function () { 172 return this.value; 173 }).get(); // Returns array 174 } 175 } 176 } else { 177 actualValue = $targetInputs.val(); 178 } 179 180 if ( undefined === actualValue || evaluateCondition(targetFieldName, expectedValue, operator, actualValue)) { 181 $conditionalField.show(); 182 } else { 183 $conditionalField.hide(); 184 } 185 186 }); 187 } 188 189 // Initial check 190 toggleConditionalFields(); 191 192 // Trigger condition checks on change 193 $('[name]').on('change', function () { 194 toggleConditionalFields(); 195 }); 196 197 }); 198 199})( jQuery ); 200 201if (jQuery('select[multiple]').length > 0 && ccf_settings && ccf_settings.select2_css && ccf_settings.select2_js ) { 202 203 // Load Select2 CSS 204 var link = document.createElement('link'); 205 link.rel = 'stylesheet'; 206 link.type = 'text/css'; 207 link.href = ccf_settings.select2_css; 208 document.head.appendChild(link); 209 210 // Load Select2 JS 211 jQuery.getScript(ccf_settings.select2_js, function() { 212 // Load select2Sortable JS after Select2 JS is loaded 213 jQuery('select[multiple]').each(function() { 214 var placeholder = jQuery(this).siblings('label').text(); // Get the text of the associated label 215 placeholder = placeholder.replace('*', ''); // Remove the asterisk 216 jQuery(this).select2({ 217 placeholder: placeholder // Set the placeholder 218 }).on("select2:select", function (evt) { 219 var id = evt.params.data.id; 220 var element = jQuery(this).children("option[value="+id+"]"); 221 moveElementToEndOfParent(element); 222 jQuery(this).trigger("change"); 223 }); 224 }); 225 }); 226 227 moveElementToEndOfParent = function(element) { 228 var parent = element.parent(); 229 element.detach(); 230 parent.append(element); 231 }; 232} 233; 234/** 235 * Form Setup. 236 * 237 * @package Custom_Contact_Form 238 */ 239var $ = jQuery; 240var postID = $( '#post_ID' ).val(); 241var formObj = formObj; 242 243function HandleBrowseClick(fileinput) { 244 var browse = $( '#' + fileinput ).parents( '.field-group' ).find( '.form-control' ).attr( 'id' ); 245 var fileinputDom = document.getElementById( browse ); 246 fileinputDom.click(); 247} 248 249function Handlechange(fileinput) { 250 var textinput = $( '#' + fileinput ).parents( '.file-upload-wrap' ).find( '.filename' ).attr( 'id' ); 251 var textinputDom = document.getElementById( textinput ); 252 var fileinputDom = document.getElementById( fileinput ); 253 console.log( textinputDom ); 254 255 // Get only the filename. 256 const filename = fileinputDom.value.split( '\\' ).pop(); 257 textinputDom.value = filename; 258} 259; 260/*! This file is auto-generated */ 261"use strict";var wp;(wp||={}).hooks=(()=>{var v=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var w=(e,n)=>{for(var s in n)v(e,s,{get:n[s],enumerable:!0})},D=(e,n,s,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of g(n))!I.call(e,t)&&t!==s&&v(e,t,{get:()=>n[t],enumerable:!(r=S(n,t))||r.enumerable});return e};var T=e=>D(v({},"__esModule",{value:!0}),e);var le={};w(le,{actions:()=>ae,addAction:()=>J,addFilter:()=>K,applyFilters:()=>N,applyFiltersAsync:()=>ee,createHooks:()=>F,currentAction:()=>te,currentFilter:()=>re,defaultHooks:()=>b,didAction:()=>ie,didFilter:()=>se,doAction:()=>X,doActionAsync:()=>Y,doingAction:()=>ne,doingFilter:()=>oe,filters:()=>ce,hasAction:()=>P,hasFilter:()=>Q,removeAction:()=>L,removeAllActions:()=>U,removeAllFilters:()=>W,removeFilter:()=>M});function z(e){return typeof e!="string"||e===""?(console.error("The namespace must be a non-empty string."),!1):/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(e)?!0:(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)}var m=z;function E(e){return typeof e!="string"||e===""?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(e)?(console.error("The hook name cannot begin with `__`."),!1):/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(e)?!0:(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)}var f=E;function Z(e,n){return function(r,t,a,i=10){let c=e[n];if(!f(r)||!m(t))return;if(typeof a!="function"){console.error("The hook callback must be a function.");return}if(typeof i!="number"){console.error("If specified, the hook priority must be a number.");return}let l={callback:a,priority:i,namespace:t};if(c[r]){let o=c[r].handlers,d;for(d=o.length;d>0&&!(i>=o[d-1].priority);d--);d===o.length?o[d]=l:o.splice(d,0,l),c.__current.forEach(h=>{h.name===r&&h.currentIndex>=d&&h.currentIndex++})}else c[r]={handlers:[l],runs:0};r!=="hookAdded"&&e.doAction("hookAdded",r,t,a,i)}}var H=Z;function C(e,n,s=!1){return function(t,a){let i=e[n];if(!f(t)||!s&&!m(a))return;if(!i[t])return 0;let c=0;if(s)c=i[t].handlers.length,i[t]={runs:i[t].runs,handlers:[]};else{let l=i[t].handlers;for(let o=l.length-1;o>=0;o--)l[o].namespace===a&&(l.splice(o,1),c++,i.__current.forEach(d=>{d.name===t&&d.currentIndex>=o&&d.currentIndex--}))}return t!=="hookRemoved"&&e.doAction("hookRemoved",t,a),c}}var p=C;function O(e,n){return function(r,t){let a=e[n];return typeof t<"u"?r in a&&a[r].handlers.some(i=>i.namespace===t):r in a}}var _=O;function j(e,n,s,r){return function(a,...i){let c=e[n];c[a]||(c[a]={handlers:[],runs:0}),c[a].runs++;let l=c[a].handlers;if(!l||!l.length)return s?i[0]:void 0;let o={name:a,currentIndex:0};async function d(){try{c.__current.add(o);let u=s?i[0]:void 0;for(;o.currentIndex<l.length;
261)u=await l[o.currentIndex].callback.apply(null,i),s&&(i[0]=u),o.currentIndex++;return s?u:void 0}finally{c.__current.delete(o)}}function h(){try{c.__current.add(o);let u=s?i[0]:void 0;for(;o.currentIndex<l.length;)u=l[o.currentIndex].callback.apply(null,i),s&&(i[0]=u),o.currentIndex++;return s?u:void 0}finally{c.__current.delete(o)}}return(r?d:h)()}}var A=j;function $(e,n){return function(){let r=e[n];return Array.from(r.__current).at(-1)?.name??null}}var y=$;function V(e,n){return function(r){let t=e[n];return typeof r>"u"?t.__current.size>0:Array.from(t.__current).some(a=>a.name===r)}}var k=V;function q(e,n){return function(r){let t=e[n];if(f(r))return t[r]&&t[r].runs?t[r].runs:0}}var x=q;var B=class{actions;filters;addAction;addFilter;removeAction;removeFilter;hasAction;hasFilter;removeAllActions;removeAllFilters;doAction;doActionAsync;applyFilters;applyFiltersAsync;currentAction;currentFilter;doingAction;doingFilter;didAction;didFilter;constructor(){this.actions=Object.create(null),this.actions.__current=new Set,this.filters=Object.create(null),this.filters.__current=new Set,this.addAction=H(this,"actions"),this.addFilter=H(this,"filters"),this.removeAction=p(this,"actions"),this.removeFilter=p(this,"filters"),this.hasAction=_(this,"actions"),this.hasFilter=_(this,"filters"),this.removeAllActions=p(this,"actions",!0),this.removeAllFilters=p(this,"filters",!0),this.doAction=A(this,"actions",!1,!1),this.doActionAsync=A(this,"actions",!1,!0),this.applyFilters=A(this,"filters",!0,!1),this.applyFiltersAsync=A(this,"filters",!0,!0),this.currentAction=y(this,"actions"),this.currentFilter=y(this,"filters"),this.doingAction=k(this,"actions"),this.doingFilter=k(this,"filters"),this.didAction=x(this,"actions"),this.didFilter=x(this,"filters")}};function G(){return new B}var F=G;var b=F(),{addAction:J,addFilter:K,removeAction:L,removeFilter:M,hasAction:P,hasFilter:Q,removeAllActions:U,removeAllFilters:W,doAction:X,doActionAsync:Y,applyFilters:N,applyFiltersAsync:ee,currentAction:te,currentFilter:re,doingAction:ne,doingFilter:oe,didAction:ie,didFilter:se,actions:ae,filters:ce}=b;return T(le);})(); 262;
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.