PageSourceSearch

https://www.coasttocactus.com/wp-content/themes/altitude-pro/vrp/js/js.js?ver=7.0.5

js coasttocactus.com collected 2026-09-30 17:36:52 UTC 11,992 bytes, 317 lines download raw bytes

1(function ($, global, undefined) {
2    /* Handles */
3    $(function () {
4
5        $('.vrpshowing').change(function () {
6
7            var that = $(this);
8
9            if (that.val() == '') {
10                return;
11            }
12
13            location.search = VRP.queryString.formatQueryString(that.val());
14
15        });
16
17        $('.vrpsorter').change(function () {
18
19            var that = $(this);
20
21            if (that.val() == '') {
22                return;
23            }
24
25            location.search = VRP.queryString.formatQueryString(that.val());
26        });
27
28
29        $('.vrpsorter').change(function () {
30
31            var that = $(this);
32
33            if (that.val() == '') {
34                return;
35            }
36
37            location.search = VRP.queryString.formatQueryString(that.val());
38        });
39
40        $('.vrp-cd-pagination a').click(function (e) {
41
42            e.preventDefault();
43
44            var that = $(this),
45                parameters = that.attr('href');
46
47            if (that.hasClass('current') || that.hasClass('disabled')) {
48                return;
49            }
50
51            location.search = VRP.queryString.formatQueryString(parameters);
52
53        });
54
55        $('.vrp-thumbnail').hover(function (e) {
56
57            var that = $(this).parent(),
58                index = $('.vrp-item').index(that);
59
60            VRP.ui.overlay(that, index, e);
61
62        }, function (e) {
63
64            var that = $(this).parent(),
65                index = $('.vrp-item').index(that);
66
67            VRP.ui.overlay(that, index, e);
68
69        });
70
71        $('#vrp-list').click(function (e) {
72            e.preventDefault();
73            $('.list-grid-layout').attr('class', 'col-xs-12 list-grid-layout vpr-list-style');
74        });
75
76        $('#vrp-grid').click(function (e) {
77            e.preventDefault();
78            $('.list-grid-layout').attr('class', 'col-md-4 col-xs-6 col-sm-12 vpr-list-grid-layout vpr-grid-style');
79        });
80
81    });
82}(jQuery, window));
83var fav_count = '';
84jQuery(document).ready(function () {
85
86    // VrpUnitLinks
87    if (jQuery('.abe-unit-links').length > 0) {
88        if (jQuery('.abe-unit-links').length) {
89            jQuery('.abe-unit-links').select2();
90
91            jQuery('.abe-unit-links').change(function () {
92                window.location.href = jQuery(this).val();
93            });
94        }
95    }
96
97    // Price Range event trigger
98    // if (jQuery('#abeFromRange').length > 0) {
99    //     jQuery('#abeFromRange').on('change', function (e) {
100    //         jQuery('#abe-results-search').submit();
101    //     });
102    //
103    //     jQuery('#abeToRange').on('change', function (e) {
104    //         jQuery('#abe-results-search').submit();
105    //     });
106    // }
107
108    if (jQuery('input[name="search[arrival]"]').length > 0) {
109        var dates = jQuery('input[name="search[arrival]"]').datepicker({
110            beforeShow: customRange,
111            minDate: 2,
112            onSelect: function (selectedDate) {
113
114                var option = this.id == "arrival" ? "minDate" : "30",
115                    instance = jQuery(this).data("datepicker"),
116                    date = jQuery.datepicker.parseDate(
117                        instance.settings.dateFormat ||
118                        jQuery.datepicker._defaults.dateFormat,
119                        selectedDate, instance.settings);
120                dates.not(this).datepicker("option", option, date);
121            },
122            onClose: function () {
123                var departField = jQuery('input[name="search[departure]"]');
124                var nextDayDate = jQuery('input[name="search[arrival]"]').datepicker('getDate');
125                if (nextDayDate !== null) {
126                    nextDayDate.setDate(nextDayDate.getDate() + 7);
127                    departField.datepicker('setDate', nextDayDate);
128                    setTimeout(function () {
129                        departField.datepicker("show");
130                    }, 10);
131                }
132            }
133
134
135        });
136
137
138        jQuery('input[name="search[departure]"]').datepicker({
139            beforeShow: customRange,
140            onSelect: function () {
141                var arrivalDate = jQuery('input[name="search[arrival]"]').datepicker("getDate");
142                var departureDate = jQuery('input[name="search[departure]"]').datepicker("getDate");
143                var oneDay = 1000 * 60 * 60 * 24;
144                var difference = Math.ceil((arrivalDate.getTime() - departureDate.getTime()) / oneDay);
145                difference = -difference;
146
147                jQuery("#nights").val(difference);
148                jQuery("#tn").val(difference);
149            }
150        });
151    }
152    function customRange(a) {
153        var b = new Date();
154        var c = new Date(b.getFullYear(), b.getMonth(), b.getDate());
155        if (a.id == 'depart') {
156            if (jQuery('input[name="search[arrival]"]').datepicker('getDate') != null) {
157                c = jQuery('input[name="search[arrival]"]').datepicker('getDate');
158            }
159        }
160        return {
161            minDate: c
162        }
163    }
164
165    jQuery('.hasDatepicker').attr("autocomplete", "off").attr("readonly", "readonly");
166
167    jQuery("#bookmsg").hide();
168
169    if (jQuery("#unitsincomplex").length > 0) {
170        if (jQuery("#hassession").length > 0) {
171            jQuery.get(url_paths.site_url + "/?vrpjax=1&act=searchjax", jQuery("#jaxform").serialize(), function (data) {
172                jQuery("#unitsincomplex").hide().html(data).fadeIn();
173            });
174        } else {
175            jQuery.get(url_paths.site_url + "/?vrpjax=1&act=searchjax", jQuery("#jaxform2").serialize(), function (data) {
176                jQuery("#unitsincomplex").hide().html(data).fadeIn();
177            });
178        }
179        jQuery("#jaxform").submit(function () {
180            jQuery.get(url_paths.site_url + "/?vrpjax=1&act=searchjax", jQuery("#jaxform").serialize(), function (data) {
181                jQuery("#unitsincomplex").hide().html(data).slideDown(1000);
182            });
183            return false;
184        });
185
186        jQuery("#showallofthem").click(function () {
187            jQuery.get(url_paths.site_url + "/?vrpjax=1&act=searchjax", jQuery("#jaxform2").serialize(), function (data) {
188                jQuery("#unitsincomplex").hide().html(data).slideDown(1000);
189            });
190            return false;
191        });
192    }
193
194
195    /** Step3.php **/
196    jQuery("#country").on('change', function () {
197
198        var country = jQuery(this).find(":selected").val();
199        console.log(country);
200
201        if (country == 'CA' || country == 'US' || country == 'other') {
202            if (country == 'CA') {
203                jQuery("#abe-state-wrapper select").val('');
204                jQuery("#abe-province-wrapper").show();
205                jQuery("#abe-othercountry-wrapper,#abe-region-wrapper,#abe-state-wrapper").hide();
206                jQuery("#abe-province-wrapper").effect("highlight", {}, 2000);
207            }
208
209            if (country == 'US') {
210                jQuery("#abe-province-wrapper select,#abe-region-wrapper select").val('');
211                jQuery("#abe-state-wrapper").show();
212                jQuery("#abe-othercountry-wrapper,#abe-region-wrapper,#abe-province-wrapper").hide();
213                jQuery("#abe-state-wrapper").effect("highlight", {}, 2000);
214            }
215
216            if (country == 'other') {
217                jQuery("#abe-province-wrapper select,#abe-state-wrapper select").val('');
218                jQuery("#abe-province-wrapper,#abe-state-wrapper").hide();
219                jQuery("#abe-othercountry-wrapper,#abe-region-wrapper").show();
220                jQuery("#abe-othercountry-wrapper,#abe-region-wrapper").effect("highlight", {}, 2000);
221            }
222        } else {
223            jQuery("#abe-province-wrapper select,#abe-state-wrapper select, #abe-othercountry-wrapper select").val('');
224            jQuery("#abe-province-wrapper,#abe-state-wrapper,#abe-othercountry-wrapper").hide();
225            jQuery("#abe-region-wrapper").show();
226            jQuery("#abe-region-wrapper").effect("highlight", {}, 2000);
227        }
228
229    });
230
231    jQuery("#vrpbookform").submit(function () {
232
233        var bookform = jQuery(this);
234        grecaptcha.ready(function () {
235            grecaptcha.execute(url_paths.recaptcha_site_key, { action: 'booking' }).then(function (token) {
236                bookform.find(".g-recaptcha-response").val(token);
237
238                jQuery("#bookingbuttonvrp").hide();
239                jQuery("#vrploadinggif").show();
240                jQuery("#loadingicons").show();
241                jQuery("span.vrpmsg").remove();
242                jQuery(".badfields").removeClass("badfields");
243                jQuery("#comments").val(jQuery("#comments").val());
244                jQuery.post(url_paths.site_url + "/?vrpjax=1&act=processbooking", bookform.serialize(), function (data) {
245
246                    console.log(data);
247
248                    var obj = jQuery.parseJSON(data);
249                    if (typeof (obj.Error) !== 'undefined' && obj.Error.length != 0) {
250                        jQuery("#bookingbuttonvrp").show();
251                        jQuery("#vrploadinggif").hide();
252                        jQuery("#vrploadinggif").hide();
253                        alert(obj.Error);
254                    } else if (obj.Bad.length != 0) {
255                        jQuery("#bookingbuttonvrp").show();
256                        jQuery("#vrploadinggif").hide();
257                        jQuery("#vrploadinggif").hide();
258                        jQuery.each(obj.Bad, function (k, v) {
259                            jQuery("#" + k + "tr td:last").append('<span class="vrpmsg alert alert-error">' + v + '</span>');
260                            var oldcolor = jQuery("#" + k + "tr").css("color");
261                            jQuery("#" + k + "tr").addClass("badfields");
262                            jQuery("#" + k).change(function () {
263                                jQuery("#" + k + "tr").removeClass("badfields");
264                                jQuery("#" + k + "tr td span.vrpmsg").remove();
265                            });
266                        });
267                        jQuery("html, body").animate({
268                            scrollTop: 0
269                        }, "slow", function () { });
270                        alert("Please correct the errors with your reservation and try again.");
271
272                    } else {
273                        window.location = jQuery("#vrpbookform").attr("action");
274                    }
275
276                });
277            });
278        });
279        return false;
280    });
281
282    jQuery("#showContract").on('click', function (event) {
283        event.preventDefault();
284        jQuery('#theContract').show();
285    });
286
287    jQuery('#closeContract').on('click', function (event) {
288        event.preventDefault();
289        jQuery('#theContract').hide();
290    });
291
292
293    /** OTHER **/
294    jQuery(".dpinquiry").datepicker();
295
296    jQuery(".vrp-pagination li a,.dobutton").button();
297});
298
299const checkOffset = jQuery.datepicker._checkOffset;
300jQuery.extend(jQuery.datepicker, {
301    _checkOffset: function (inst, offset, isFixed) {
302        if (!isFixed) {
303            return checkOffset.apply(this, arguments);
304        } let isRTL = this._get(inst, "isRTL");
305        let obj = inst.input[0];        // copied from Datepicker._findPos (node_modules/jquery-ui/datepicker.js)
306        while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || jQuery.expr.filters.hidden(obj))) {
307            obj = obj[isRTL ? "previousSibling" : "nextSibling"];
308        } let rect = obj.getBoundingClientRect();        // copied from Datepicker._checkOffset
309        var viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : jQuery(document).scrollTop()),
310            dpHeight = inst.dpDiv.outerHeight(); return {
311                // added validation for when the date picker is displayed at the bottom
312                top: viewHeight < rect.top + rect.height + dpHeight ? rect.top - dpHeight : rect.top + rect.height,
313                left: rect.left
314            };
315    }
316});
317

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.