PageSourceSearch

https://rainbowmountainperu.net/wp-content/themes/traveler/v2/js/sin-tour.js

js rainbowmountainperu.net collected 2026-10-08 20:23:11 UTC 23,735 bytes, 624 lines download raw bytes

1(function ($) {
2    'use strict';
3    var body = $('body');
4
5    $(document).ready(function () {
6        $('.stt-instagram-content').each(function () {
7            let t = $(this),
8                    number = t.data('number'),
9                    name = t.data('name');
10
11            var data = t.serializeArray();
12            data.push({
13                name: 'number',
14                value: number
15            }, {
16                name: 'name',
17                value: name
18            },
19                    {
20                        name: 'action',
21                        value: t.data('action')
22                    },
23                    );
24            $.post(st_params.ajax_url, data, function (respon) {
25                if (typeof respon == 'object') {
26                    if (respon.status === 1) {
27
28                        $('.stt-list-image', t).html(respon.html);
29                        $('.stt-list-image .owl-carousel', t).owlCarousel({
30                            loop: true,
31                            items: 5,
32                            responsiveClass: true,
33                            dots: false,
34                            nav: false,
35                            responsive: {
36                                0: {
37                                    items: 2,
38
39                                },
40                                767: {
41                                    items: 4,
42
43                                },
44                                1200: {
45                                    items: 5,
46
47                                }
48                            }
49                        });
50                    }
51                }
52            }, 'json');
53
54        });
55
56        setTimeout(function () {
57            $('.tour-slider-wrapper ').each(function () {
58                let t = $(this);
59                var owl = $('.owl-carousel', t).owlCarousel({
60                    center: true,
61                    items: 1,
62                    loop: true,
63                    autoplay: true,
64                    margin: 0,
65                });
66                $('.st-next', t).click(function (ev) {
67                    ev.preventDefault();
68                    owl.trigger('next.owl.carousel');
69                })
70                $('.st-pre', t).click(function (ev) {
71                    ev.preventDefault();
72                    owl.trigger('prev.owl.carousel');
73                })
74
75            });
76        }, 100);
77        $('.category-slider-wrapper').each(function () {
78            let t = $(this);
79            $('.owl-carousel', t).owlCarousel({
80                loop: true,
81                margin: 30,
82                items: 4,
83                responsiveClass: true,
84                dots: true,
85                nav: true,
86                responsive: {
87                    0: {
88                        items: 2,
89                        nav: false,
90                        margin: 15,
91                    },
92                    767: {
93                        items: 3,
94                        nav: true,
95                    },
96                    1200: {
97                        items: 4,
98                        nav: true,
99                    }
100                }
101            });
102
103        });
104
105
106
107        //----------- Description Tour-------------------------------
108
109        $('.st-description-more .stt-more').on('click', function () {
110
111            $('.st-description-more').hide();
112            $('.st-description-less').show();
113        });
114        $('.st-description-less .stt-less').on('click', function () {
115
116            $('.st-description-less').hide();
117            $('.st-description-more').show();
118        });
119        //----------- End Description Tour---------------------------
120        //----------- Content Comment--------------------------------
121        $('.comment-item').each(function () {
122            let that = this;
123            $('.st-comment-more .stt-more', that).on('click', function (e) {
124
125                $('.st-comment-less', that).show();
126                $('.st-comment-more', that).hide();
127            })
128        });
129        $('.comment-item').each(function () {
130            let that = this;
131            $('.st-comment-less .stt-less', that).on('click', function (e) {
132
133                $('.st-comment-more', that).show();
134                $('.st-comment-less', that).hide();
135            })
136        });
137
138        //----------- End Content Comment----------------------------
139        //--------------- Guest Name Inputs -------------------------
140
141        var adultNumber = $('.form-has-guest-name .adult_number');
142        var childrenNumber = $('.form-has-guest-name .child_number');
143        var infantNumber = $('.form-has-guest-name .infant_number');
144        var guestNameInput = $('.form-has-guest-name .guest_name_input');
145        adultNumber.on('change', triggerGuestInputChange);
146        childrenNumber.on('change', triggerGuestInputChange);
147        infantNumber.on('change', triggerGuestInputChange);
148
149        function triggerGuestInputChange(e) {
150            guestNameInput.trigger('guest-change', {
151                'adult': parseInt(adultNumber.val()),
152                'children': parseInt(childrenNumber.val()),
153                'infant': parseInt(infantNumber.val())
154            });
155        }
156        ;
157
158        guestNameInput.on('guest-change', function (e, number) {
159            var adult = number.adult;
160            var children = number.children;
161            var infant = number.infant;
162            var hideAdult = $(this).data('hide-adult');
163            var hideChildren = $(this).data('hide-children');
164            var hideInfant = $(this).data('hide-infant');
165            var controlWraps = $(this).find('.guest_name_control');
166            var controls = controlWraps.find('.control-item');
167            if (isNaN(infant))
168                infant = 0;
169            if (isNaN(children))
170                children = 0;
171
172            if (hideAdult == 'on') {
173                adult = 0;
174            }
175
176            if (typeof hideChildren == 'undefined' || hideChildren != 'on')
177                adult += children;
178            if (typeof hideInfant == 'undefined' || hideInfant != 'on')
179                adult += infant;
180
181            //adult-=1;// Only input guest >=2 name
182
183            if (adult <= 0) {
184                $(this).addClass('hidden');
185            } else {
186                // Append
187                for (var i = controls.length ? (controls.length) : 0; i < adult; i++)
188                {
189                    var div = $($('#guest_name_control_item').clone().html());
190                    var p = div.find('input').attr('placeholder');
191                    div.find('input').attr('placeholder', p.replace('%d', i + 1));
192
193                    controlWraps.append(div);
194                }
195
196                // Remove
197                controls.each(function () {
198                    if ($(this).index() > adult - 1)
199                    {
200                        $(this).remove();
201                    }
202                });
203
204                $(this).removeClass('hidden');
205            }
206        });
207
208        triggerGuestInputChange();
209        //------------------End Guest Name Inputs -------------------
210        $('.form-book-tour').each(function () {
211            var parent = $(this);
212            $('.dropdown', parent).click(function (e) {
213                var dropdown_menu = $('[aria-labelledby="' + $(this).attr('id') + '"]', parent);
214                $('.form-book--tour').find('.dropdown-menu').not(dropdown_menu).slideUp(50);
215                dropdown_menu.slideToggle(50);
216                if ($('.ovscroll').length) {
217                    $('.ovscroll').getNiceScroll().resize();
218                }
219            });
220            $('input[name="adult_number"]', parent).change(function () {
221
222                var adults = parseInt($(this).val());
223                var html = adults;
224                if (typeof adults == 'number') {
225                    if (adults < 1) {
226                        html = $('.render .adult', parent).data('text') + ' x ' + adults;
227                    } else {
228                        html = $('.render .adult', parent).data('text-multi') + ' x ' + adults;
229                    }
230                }
231                $('.render .adult', parent).html(html);
232            });
233            $('input[name="adult_number"]', parent).trigger('change');
234            $('input[name="child_number"]', parent).change(function () {
235
236                var children = parseInt($(this).val());
237                var html = children;
238                if (typeof children == 'number') {
239                    if (children < 1) {
240                        html = $('.render .children', parent).data('text') + ' x ' + children;
241                    } else {
242                        html = $('.render .children', parent).data('text-multi') + ' x ' + children;
243                    }
244                }
245                $('.render .children', parent).html(html);
246            });
247            $('input[name="child_number"]', parent).trigger('change');
248            $('input[name="infant_number"]', parent).change(function () {
249
250                var infant = parseInt($(this).val());
251                var html = infant;
252                if (typeof infant == 'number') {
253                    if (infant < 1) {
254                        html = $('.render .infant', parent).data('text') + ' x ' + infant;
255                    } else {
256                        html = $('.render .infant', parent).data('text-multi') + ' x ' + infant;
257                    }
258                }
259                $('.render .infant', parent).html(html);
260            });
261            $('input[name="infant_number"]', parent).trigger('change');
262        });
263        /*Scroll form book*/
264        var timeout_fixed_item;
265        $(window).on('resize', function () {
266            clearTimeout(timeout_fixed_item);
267            timeout_fixed_item = setTimeout(function () {
268                $('.st-tour-booking', body).each(function () {
269                    var t = $(this);
270                    var screen = t.data('screen');
271                    var width = t.width(),
272                            top = t.offset().top;
273                    $(window).scroll(function () {
274                        if ($(window).scrollTop() >= top && window.matchMedia('(min-width: ' + screen + ')').matches) {
275                            if (t.css('position') != 'fixed') {
276                                t.css({
277                                    width: width,
278                                    position: 'fixed',
279                                    top: 0 + $('#wpadminbar').height(),
280                                    'z-index': 9
281                                });
282                            }
283                            if ($('.stoped-scroll-section', body).length) {
284                                var room_position = $('.stoped-scroll-section', body).offset().top;
285                                if ($(window).scrollTop() + t.innerHe
285ight() >= room_position && t.css('position') == 'fixed') {
286                                    t.css({
287                                        width: width,
288                                        position: 'fixed',
289                                        top: room_position - $(window).scrollTop() - t.innerHeight(),
290                                        'z-index': 9
291                                    });
292                                } else {
293                                    t.css({
294                                        width: width,
295                                        position: 'fixed',
296                                        top: 0 + $('#wpadminbar').height(),
297                                        'z-index': 9
298                                    });
299                                }
300                            }
301                        } else {
302                            t.css({
303                                position: '',
304                                top: '',
305                                width: 'auto',
306                                'z-index': ''
307                            })
308                        }
309                    });
310                });
311                $('.hotel-target-book-mobile', body).each(function () {
312                    var t = $(this);
313                    $(window).scroll(function () {
314                        if ($(window).scrollTop() >= 50 && window.matchMedia('(max-width: 991px)').matches) {
315                            t.css('display', 'flex');
316                        } else {
317                            t.css('display', 'none');
318                        }
319                    });
320                });
321            }, 1000);
322        }).resize();
323        
324
325
326
327
328        /*get height content testionial*/
329        $('.st-testimonial-solo-slider', '.st-solo-testimonial-wrapper').each(function () {
330            var parent = $(this);
331            var height_content = $('.content', parent).innerHeight();
332            var margin_top = $('.content', parent).position();
333            var top = parseInt(height_content) + parseInt(margin_top.top);
334            $('.owl-dots', parent).css("top", top);
335        });
336        /*popup login mobile*/
337        $('.toggle-menu--user').click(function (ev) {
338            ev.preventDefault();
339            $('#st-login-form').modal('toggle');
340            $('#st-login-form').modal('show');
341        });
342        $('.back-menu--login').click(function (ev) {
343            ev.preventDefault();
344            toggleBody($('.header-login--mobile'));
345            $('.header-login--mobile').toggleClass('open');
346        });
347        $('.toggle-menu', '.header').click(function (ev) {
348            ev.preventDefault();
349            toggleBody($('.st-list-mobile'));
350            $('.st-list-mobile').toggleClass('open');
351        });
352        $('.back-menu', '.header').click(function (ev) {
353            ev.preventDefault();
354            toggleBody($('.st-list-mobile'));
355            $('.st-list-mobile').toggleClass('open');
356        });
357        function toggleBody(el) {
358            if (el.hasClass('open')) {
359                body.css({
360                    'overflow': ''
361                });
362            } else {
363                body.css({
364                    'overflow': 'hidden'
365                });
366            }
367        }
368        body.click(function (ev) {
369            if ($(ev.target).is('#st-main-menu')) {
370
371                $('.st-list-mobile').toggleClass('open');
372            }
373        });
374        /**/
375
376        $(document).on('click', '.solo-load-more-blog', function () {
377            updateQueryStringParam('ppp', $('#solo_load_more_blog').val());
378            location.reload();
379        });
380        $(document).on('change', '.search--blog-solo #cat', function () {
381            var $form = $(this).closest('form');
382            $form.submit();
383        });
384        /*Slide blog about us*/
385
386      
387       
388        /*Slider blog 7*/
389        $(window).resize(function(){
390            $('.st-solo-blog-list').find('.style7').each(function () {
391                let t = $(this);
392                t.removeClass('row');
393                t.addClass('owl-carousel');
394                t.owlCarousel({
395                    loop: false,
396                    responsiveClass: true,
397                    nav: false,
398                    margin: 30,
399                    responsive: {
400                        0: {
401                            items: 1,
402                            nav: false,
403                            dots: true,
404                        },
405                        768: {
406                            items: 2,
407                        },
408                        992: {
409                            items: 3,
410                            dots:false,
411                        },
412                        1200: {
413                            items: 3,
414                        }
415                    }
416                });
417            });
418        });
419        /*end*/
420        /*Slide list image about us*/
421      
422        var image_aboutus = undefined;
423        $(window).on('resize',function(){
424            if (window.matchMedia("(max-width:767px)").matches) {
425                $('.st-aboutus-solo').find('.slide-item').each(function () {
426                    let t = $(this);
427                    t.addClass('owl-carousel');
428                    let options = {
429                        loop: false,
430                        responsiveClass: true,
431                        dots: true,
432                        nav: false,
433                        margin: 15,
434                        stagePadding: 40,
435                        responsive: {
436                            0: {
437                                items: 1,
438                                nav: false,
439
440                            },
441                            576: {
442                                items: 1,
443                            },
444                            767: {
445                                items: 1,
446                            }
447                        }
448                    };
449                    if(typeof image_aboutus == 'undefined'){
450                        let owl = $('.owl-carousel').owlCarousel(options);
451                        image_aboutus = t.data('owl.carousel');
452                    }else{
453                        let owl = $('.owl-carousel').owlCarousel(options);
454                        image_aboutus = t.data('owl.carousel');
455                    }
456                   
457                });
458            }else{
459                $('.slide-item').removeClass('owl-carousel');
460                if(typeof image_aboutus == 'object'){
461                    image_aboutus.destroy();
462                }
463                
464            }
465        }).resize();
466        /*end*/
467
468       
469        /*Slider Service single*/
470        $('.st-list-tour--slide').each(function(){
471              $(this).owlCarousel({
472                  loop: false,
473                  items: 3,
474                  margin: 30,
475                  responsiveClass: true,
476                  dots: false,
477                  nav: false,
478                  responsive: {
479                      0: {
480                          items: 1,
481                          margin: 15,
482                          dots: true,
483                      },
484                      768: {
485                          items: 2,
486                          margin: 30,
487                          dots:true,
488                      },
489                      992: {
490                          items: 3,
491                          margin: 30,
492                          dots:false
493                      },
494                      1200: {
495                          items: 3,
496                      }
497                  }
498              });
499         });;
500        /*end*/
501        /*Slide tour destination*/
502        $('.st-solo-list-location').find('.list-destination--layout9').each(function () {
503            let t = $(this);
504            t.addClass('owl-carousel');
505            t.removeClass('row');
506            // $('.normal-item', t).removeClass('has-matchHeight');
507            $('.slider-item', t).removeClass('normal-item');
508            var owl = $('.owl-carousel').owlCarousel({
509                loop: false,
510                responsiveClass: true,
511                dots: false,
512                nav: false,
513                margin: 30,
514                responsive: {
515                    0: {
516                        items: 1,
517                        nav: false,
518                        dots: true,
519                        margin: 15,
520                        stagePadding: 40,
521                    },
522                    768: {
523                        items: 3,
524                    },
525                    992:{
526                        items:4,
527                    },
528                    1200: {
529                        items: 4,
530                    }
531                }
532            });
533        });
534        /*end*/
535        $('.form-slelect-2','.form-icon-fa').select2({
536        });
537        $(window).on('resize', function () {
538            $('.st-tour-content.style7').find('.st-tour-booking').each(function(){
539                var t = $(this);
540                var screen = t.data('screen');
541                var width = t.width(),
542                top = t.offset().top;
543                $(window).scroll(function(){
544                    if ($(window).scrollTop() >= top && window.matchMedia('(min-width: ' + screen + ')').matches) {
545                        t.addClass('box-shadow-croll');
546                    }
547                    else{
548                        t.removeClass('box-shadow-croll');
549                    }
550                });
551            });
552        }).resize();
553    });
554})(jQuery);
555
556function setHeight(container, item) {
557    jQuery(container).each(function () {
558        // Cache the highest
559        var highestBox = 0;
560        // Select and loop the elements you want to equalise
561        jQuery(item, this).each(function () {
562            // If this box is higher than the cached highest then store it
563            var itemH = jQuery(this).height();
564            if (itemH > highestBox) {
565                highestBox = itemH;
566            }
567        });
568        // Set the height of all those children to whichever was highest 
569        jQuery(item, this).height(highestBox);
570    });
571}
572let base = this;
573if (!Number.prototype.getDecimals) {
574    Number.prototype.getDecimals = function () {
575        var num = this,
576            match = ('' + num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
577        if (!match) {
578            return 0;
579        }
580        return Math.max(0, (match[1] ? match[1].length : 0) - (match[2] ? +match[2] : 0));
581    }
582}
583jQuery(document.body).on('click', '.caculator-item .fa-plus, .caculator-item .fa-minus', function ($) {
584    var $qty = jQuery(this).parent().find('.extra-service-select'),
585        currentVal = parseFloat($qty.val()),
586        max = parseFloat($qty.attr('max')),
587        min = parseFloat($qty.attr('min')),
588        step = parseInt($qty.attr('step'));
589
590    // Format values
591    if (!currentVal || currentVal === '' || currentVal === 'NaN') currentVal = 0;
592    if (max === '' || max === 'NaN') max = '';
593    if (min === '' || min === 'NaN') min = 0;
594    if (step === 'any' || step === '' || step === undefined || parseFloat(step) === 'NaN') step = 1;
595
596    // Change the value
597    if (jQuery(this).is('.fa-plus')) {
598        if (max && (currentVal >= max)) {
599            $qty.val(max);
600        } else {
601            $qty.val((currentVal + parseFloat(step)).toFixed(step.getDecimals()));
602        }
603    } else {
604        if (min && (currentVal <= min)) {
605            $qty.val(min);
606        } else if (currentVal > 0) {
607            $qty.val((currentVal - parseFloat(step)).toFixed(step.getDecimals()));
608        }
609    }
610
611    // Trigger change event
612    $qty.trigger('change');
613    $qty.trigger('tour-booking-form');
614});
615
616function form_package_extra( event ) {
617    var target = $( event.target );
618    if (!target.closest("#dropdown-more-extra").length) {
619        $('ul#dropdown-more-extra').removeClass("dropdown-menu extras collapse in");
620        $('ul#dropdown-more-extra').addClass("dropdown-menu extras collapse");
621        $('ul#dropdown-more-extra').attr("aria-expanded",false);
622    }
623}
624jQuery( "body" ).click( form_package_extra );

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.