PageSourceSearch

https://secret-zagreb.com/wp-content/plugins/mikado-tours/assets/js/tours.js?ver=7.1.2

js secret-zagreb.com collected 2026-09-25 04:18:05 UTC 37,805 bytes, 1,041 lines download raw bytes

1(function($) {
2    'use strict';
3
4    var destinations = {};
5    if(typeof mkdf !== 'undefined'){
6        mkdf.modules.destinations = destinations;
7    }
8    
9    destinations.mkdfOnDocumentReady = mkdfOnDocumentReady;
10    destinations.mkdfOnWindowLoad = mkdfOnWindowLoad;
11    destinations.mkdfOnWindowResize = mkdfOnWindowResize;
12    destinations.mkdfOnWindowScroll = mkdfOnWindowScroll;
13
14    $(document).ready(mkdfOnDocumentReady);
15    $(window).on('load', mkdfOnWindowLoad);
16    $(window).resize(mkdfOnWindowResize);
17    $(window).scroll(mkdfOnWindowScroll);
18
19    /*
20     All functions to be called on $(document).ready() should be in this function
21     */
22    function mkdfOnDocumentReady() {
23	    destinationShortcodeSearchFilters().fieldsHelper.init();
24	    initDestinationMasonryCarousel();
25    }
26
27    /*
28     All functions to be called on $(window).load() should be in this function
29     */
30    function mkdfOnWindowLoad() {
31    }
32
33    /*
34     All functions to be called on $(window).resize() should be in this function
35     */
36    function mkdfOnWindowResize() {
37    }
38
39    /*
40     All functions to be called on $(window).scroll() should be in this function
41     */
42    function mkdfOnWindowScroll() {
43    }
44
45    function themeInstalled() {
46        return typeof mkdf !== 'undefined';
47    }
48    
49    function destinationShortcodeSearchFilters() {
50        var $searchForms = $('.mkdf-tours-filter-holder.mkdf-tours-filter-horizontal form');
51        
52        var fieldsHelper = function() {
53            
54            var initDestinationSearch = function() {
55                var destinations = typeof mkdfToursSearchData !== 'undefined' ? mkdfToursSearchData.destinations : [];
56                
57                var destinations = new Bloodhound({
58                    datumTokenizer: Bloodhound.tokenizers.whitespace,
59                    queryTokenizer: Bloodhound.tokenizers.whitespace,
60                    local: destinations
61                });
62                
63                $searchForms.find('.mkdf-tours-destination-search').typeahead({
64                        hint: true,
65                        highlight: true,
66                        minLength: 1
67                    },
68                    {
69                        name: 'destinations',
70                        source: destinations
71                    });
72            };
73            
74            return {
75                init: function() {
76                    initDestinationSearch();
77                }
78            }
79        }();
80        
81        return {
82            fieldsHelper: fieldsHelper
83        }
84    }
85
86    function initDestinationMasonryCarousel(){
87    	var destinationCarousels = $('.mkdf-tours-destination-masonry-carousel');
88
89    	if (destinationCarousels.length){
90    		destinationCarousels.each(function(){
91    			var thisCarousel = $(this),
92    				carouselMain = thisCarousel.find('.mkdf-tdm-carousel'),
93	                slideItemsNumber = carouselMain.find('> div').length,
94    				carouselWidth = thisCarousel.find('.mkdf-tours-row-inner-holder').width(),
95    				items = thisCarousel.find('.mkdf-tdm-item-holder'),
96    				numberOfParts = carouselMain.data('number-of-items'),
97    				numberOfItems = numberOfParts,
98    				autoplay = true,
99    				loop = true,
100    				navigation = true,
101    				pagination = false,
102    				mouseDrag = true,
103    				touchDrag = true,
104    				pullDrag = true;
105    				
106    			if (items.length) {
107    				items.each(function(e){
108    					var thisItem = $(this),
109    						thisItemWidth = 0;
110
111    					if (numberOfParts == 4){    						
112
113							if (mkdf.windowWidth <= 1280) {
114								if ((e + 1)%4 == 0){
115									thisItemWidth = carouselWidth/4;
116								} else if ((e + 1)%2 == 0){
117									thisItemWidth = carouselWidth/2;
118								} else {
119									thisItemWidth = carouselWidth/4;
120								}
121							} else {
122								if ((e + 1)%4 == 0){
123									thisItemWidth = carouselWidth/5;
124								} else if ((e + 1)%2 == 0){
125									thisItemWidth = carouselWidth/5 * 2;
126								} else {
127									thisItemWidth = carouselWidth/5;
128								}
129							}
130    					} else {
131    						if ((e + 1)%2 == 0){
132								thisItemWidth = carouselWidth/2;
133							} else {
134								thisItemWidth = carouselWidth/4;
135							}
136						}
137
138						if (mkdf.windowWidth <= 768) {
139							thisItemWidth = carouselWidth;
140						}
141
142						thisItem.css('width', Math.round(thisItemWidth));
143    				});
144    			}
145
146	            if (carouselMain.data('enable-pagination') === 'yes') {
147		            pagination = true;
148	            }
149	            
150
151	            //static layout
152                if (slideItemsNumber <= numberOfItems) {
153    	            loop       = false;
154    	            autoplay   = false;
155    	            navigation = false;
156    	            pagination = false;
157    	            mouseDrag = false;
158    	            touchDrag = false;
159    	            pullDrag = false;
160                }
161
162	            var sliderWidth = function(slider){
163	            	var items = slider.find('.owl-item'),
164	            		sliderWidth = 0;
165
166	            	items.each(function(){
167	            		var thisItem = $(this);
168
169	            		sliderWidth += Math.ceil(thisItem.width());
170	            	});
171
172	            	if (sliderWidth != 0) {
173		            	slider.find('.owl-stage').css('width', sliderWidth); //because of the chrome partial pixels
174	            	}
175	            }
176
177	            carouselMain.owlCarousel({
178		            items: numberOfItems,
179		            loop: loop,
180		            autoplay: autoplay,
181		            autoplayHoverPause: true,
182		            autoplayTimeout: 5000,
183		            smartSpeed: 600,
184		            margin: 0,
185		            stagePadding: 0,
186		            center: false,
187		            autoWidth: true,
188		            mouseDrag: mouseDrag,
189		            touchDrag: touchDrag,
190		            pullDrag: pullDrag,
191		            dots: pagination,
192		            nav: true,
193		            navText: [
194			            '<span class="mkdf-prev-icon lnr lnr-chevron-left"></span>',
195			            '<span class="mkdf-next-icon lnr lnr-chevron-right"></span>'
196		            ],
197		            onInitialize: function () {
198			            carouselMain.css('visibility', 'visible');
199		            },
200		            onInitialized: function () {
201			            sliderWidth(carouselMain);
202		            },
203		            onDrag: function (e) {
204			            if (mkdf.body.hasClass('mkdf-smooth-page-transitions-fadeout')) {
205				            var sliderIsMoving = e.isTrigger > 0;
206				
207				            if (sliderIsMoving) {
208					            carouselMain.addClass('mkdf-slider-is-moving');
209				            }
210			            }
211		            },
212		            onDragged: function () {
213			            if (mkdf.body.hasClass('mkdf-smooth-page-transitions-fadeout') && carouselMain.hasClass('mkdf-slider-is-moving')) {
214				
215				            setTimeout(function () {
216					            carouselMain.removeClass('mkdf-slider-is-moving');
217				            }, 500);
218			            }
219		            }
220                });
221
222    		});
223    	}
224    }
225    
226    return destinations;
227})(jQuery);
228
229(function($) {
230    'use strict';
231
232    var tours = {};
233
234    if(typeof mkdf !== 'undefined'){
235        mkdf.modules.tours = tours;
236    }
237    
238    tours.mkdfOnDocumentReady = mkdfOnDocumentReady;
239    tours.mkdfOnWindowLoad = mkdfOnWindowLoad;
240    tours.mkdfOnWindowResize = mkdfOnWindowResize;
241    tours.mkdfOnWindowScroll = mkdfOnWindowScroll;
242
243    tours.mkdfInitTourItemTabs = mkdfInitTourItemTabs;
244    tours.mkdfTourTabsMapTrigger = mkdfTourTabsMapTrigger;
245    tours.mkdfTourReviewsInit = mkdfTourReviewsInit;
246    tours.mkdfToursScrollDown = mkdfToursScrollDown;
247
248    tours.mkdfToursRevealAnimation = mkdfToursRevealAnimation;
249
250    $(document).ready(mkdfOnDocumentReady);
251    $(window).on('load', mkdfOnWindowLoad);
252    $(window).resize(mkdfOnWindowResize);
253    $(window).scroll(mkdfOnWindowScroll);
254
255    /*
256     All functions to be called on $(document).ready() should be in this function
257     */
258    function mkdfOnDocumentReady() {
259       mkdfInitTourItemTabs();
260        
261        if(typeof mkdf !== 'undefined' ){
262            //if theme is installed, trigger google map loading on location tab on single pages
263            mkdfTourTabsMapTrigger();
264        }
265    
266        mkdfTourGalleryMasonry();
267	    mkdfTrigerTourGalleryMasonry();
268	    
269        mkdfTourReviewsInit();
270
271        searchTours().fieldsHelper.init();
272        searchTours().handleSearch.init();
273
274        mkdfToursRevealAnimation();
275
276        mkdfToursTitleFullHeight();
277    }
278
279    /*
280     All functions to be called on $(window).load() should be in this function
281     */
282    function mkdfOnWindowLoad() {
283        mkdfToursScrollDown();
284    }
285
286    /*
287     All functions to be called on $(window).resize() should be in this function
288     */
289    function mkdfOnWindowResize() {
290	    mkdfTourGalleryMasonry();
291        mkdfToursTitleFullHeight();
292    }
293
294    /*
295     All functions to be called on $(window).scroll() should be in this function
296     */
297    function mkdfOnWindowScroll() {
298
299    }
300
301    function themeInstalled() {
302        return typeof mkdf !== 'undefined';
303    }
304	
305    /**
306     * Init Resize Tours Gallery Items
307     */
308    function mkdfResizeToursGalleryItems(size,container){
309        if(container.hasClass('mkdf-tours-gallery-images-fixed')) {
310            var padding = parseInt(container.find('.mkdf-tour-gallery-item').css('padding-left')),
311                defaultMasonryItem = container.find('.mkdf-tgi-masonry-default'),
312                largeWidthMasonryItem = container.find('.mkdf-tgi-masonry-large-width'),
313                largeHeightMasonryItem = container.find('.mkdf-tgi-masonry-large-height'),
314                largeWidthHeightMasonryItem = container.find('.mkdf-tgi-masonry-large-width-height');
315                
316            if (mkdf.windowWidth > 680) {
317                defaultMasonryItem.css('height', size - 2 * padding);
318                largeHeightMasonryItem.css('height', Math.round(2 * size) - 2 * padding);
319                largeWidthHeightMasonryItem.css('height', Math.round(2 * size) - 2 * padding);
320                largeWidthMasonryItem.css('height', size - 2 * padding);
321            } else {
322                defaultMasonryItem.css('height', size);
323                largeHeightMasonryItem.css('height', size * 2);
324                largeWidthHeightMasonryItem.css('height', size);
325                largeWidthMasonryItem.css('height', Math.round(size / 2));
326            }
327        }
328    }
329
330	function mkdfTourGalleryMasonry(){
331		var masonryList = $('.mkdf-tour-masonry-gallery-holder .mkdf-tour-masonry-gallery');
332		
333		if(masonryList.length){
334			masonryList.each(function(){
335				var thisMasonry = $(this),
336					thisMasonrySize = thisMasonry.find('.mkdf-tour-grid-sizer').width();
337				
338                mkdfResizeToursGalleryItems(thisMasonrySize, thisMasonry);
339
340				thisMasonry.waitForImages(function() {
341					thisMasonry.isotope({
342						layoutMode: 'packery',
343						itemSelector: '.mkdf-tour-gallery-item',
344						percentPosition: true,
345						packery: {
346							gutter: '.mkdf-tour-grid-gutter',
347							columnWidth: '.mkdf-tour-grid-sizer'
348						}
349					});
350					
351					thisMasonry.css('opacity', '1');
352				});
353			});
354		}
355	}
356	
357	function mkdfTrigerTourGalleryMasonry(){
358		var holder = $('.mkdf-tour-item-single-holder');
359		var tourNavItems = holder.find('.mkdf-single-tour-nav-holder ul li a');
360		tourNavItems.on('click', function(){
361			var thisNavItem  = $(this);
362			var thisNavItemId = thisNavItem.attr('href');
363			
364			if(thisNavItemId === 'tour-item-gallery-id'){
365				mkdfTourGalleryMasonry();
366			}
367		});
368	}
369
370    function mkdfInitTourItemTabs(){
371        var holder = $('.mkdf-tour-item-single-holder');
372        var tourNavItems = holder.find('.mkdf-tour-tabs-nav li a');
373        var tourSectionsItems  = holder.find('.mkdf-tour-item-section');
374        tourNavItems.first().parent().addClass('mkdf-active-item');
375
376        tourNavItems.on('click', function(e){
377        	e.preventDefault();
378            tourNavItems.parent().removeClass('mkdf-active-item');
379
380            var thisNavItem  = $(this);
381            var thisNavItemId = thisNavItem.attr('href');
382            thisNavItem.parent().addClass('mkdf-active-item');
383
384            if( tourSectionsItems.length ){
385                tourSectionsItems.each(function(){
386
387                    var thisSectionItem = $(this);
388                    if(thisSectionItem.attr('id') === thisNavItemId){
389                        thisSectionItem.show();
390                        if(thisNavItemId === 'tour-item-location-id'){
391                              mkdfToursReInitGoogleMap();
392                        }
393                    }else{
394                        thisSectionItem.hide();
395                    }
396                });
397            }
398        });
399    }
400    
401    function mkdfTourTabsMapTrigger(){
402        var holder = $('.mkdf-tour-item-single-holder');
403        var tourNavItems = holder.find('.mkdf-single-tour-nav-holder ul li a');
404        tourNavItems.on('click', function(){
405            var thisNavItem  = $(this);
406            var thisNavItemId = thisNavItem.attr('href');
407
408            if(thisNavItemId === 'tour-item-location-id'){
409                mkdfToursReInitGoogleMap();
410            }
411        });
412    }
413    
414    function mkdfToursReInitGoogleMap(){
415
416        if(typeof mkdf !== 'undefined' && typeof mkdf !== '' ){
417            mkdf.modules.googleMap.mkdfShowGoogleMap();
418        }
419    }
420
421    function mkdfTourReviewsInit() {
422        var reviewWrappers = $('.mkdf-tour-reviews-input-wrapper');
423        if (reviewWrappers.length) {
424
425            var emptyStarClass = 'icon_star_alt',
426                fullStarClass = 'icon_star';
427            
428            var setCriteriaCommands = function(criteriaHolder) {
429                criteriaHolder.find('.mkdf-tour-reviews-star-holder')
430                .mouseenter(function () {
431                    $(this).add($(this).prevAll()).find('.mkdf-tour-reviews-star').removeClass(emptyStarClass).addClass(fullStarClass);
432                    $(this).nextAll().find('.mkdf-tour-reviews-star').removeClass(fullStarClass).addClass(emptyStarClass);
433                })
434                .on('click', function() {
435                    criteriaHolder.find('.mkdf-tour-reviews-hidden-input').val($(this).index()+1);
436                });
437
438                criteriaHolder.find('.mkdf-tour-reviews-rating-holder')
439                .mouseleave(function() {
440                    var inputValue = criteriaHolder.find('.mkdf-tour-reviews-hidden-input').val();
441                    inputValue = inputValue === "" ? 0 : parseInt(inputValue,10);
442                    $(this).find('.mkdf-tour-reviews-star-holder').each(function(i) {
443                        $(this).find('.mkdf-tour-reviews-star').removeClass((i < inputValue) ? emptyStarClass : fullStarClass).addClass((i < inputValue) ? fullStarClass : emptyStarClass);
444                    });
445                }).trigger('mouseleave');
446            };
447            
448            reviewWrappers.each(function() {
449
450                var reviewWrapper = $(this);
451                var criteriaHolders = reviewWrapper.find('.mkdf-tour-reviews-criteria-h
451older');
452
453                criteriaHolders.each(function() {
454                    setCriteriaCommands($(this));
455                });
456            });
457        }
458    }
459
460    function searchTours() {
461        var $searchForms = $('.mkdf-tours-search-main-filters-holder form');
462        
463        var fieldsHelper = function() {
464            var initRangeSlider = function() {
465                var $rangeSliders = $searchForms.find('.mkdf-tours-range-input');
466                var $priceRange = $searchForms.find('.mkdf-tours-price-range-field');
467                var $minPrice = $searchForms.find('[name="min_price"]');
468                var $maxPrice = $searchForms.find('[name="max_price"]');
469                var minValue = $priceRange.data('min-price');
470                var maxValue = $priceRange.data('max-price');
471                var chosenMinValue = $priceRange.data('chosen-min-price');
472                var chosenMaxValue = $priceRange.data('chosen-max-price');
473                
474                if($rangeSliders.length) {
475                    $rangeSliders.each(function() {
476                        var thisSlider = this;
477                        
478                        var slider = noUiSlider.create(thisSlider, {
479                            start: [chosenMinValue, chosenMaxValue],
480                            connect: true,
481                            step: 1,
482                            range: {
483                                'min': [ minValue ],
484                                'max': [ maxValue ]
485                            },
486                            format: {
487                                to: function(value) {
488                                    return Math.floor(value);
489                                },
490                                from: function(value) {
491                                    return value;
492                                }
493                            }
494                        });
495                        
496                        slider.on('update', function(values) {
497                            var firstValue = values[0];
498                            var secondValue = values[1];
499                            var currencySymbol = $priceRange.data('currency-symbol');
500                            var currencySymbolPosition = $priceRange.data('currency-symbol-position');
501                            
502                            var firstPrice = currencySymbolPosition === 'left' ? currencySymbol + firstValue : firstValue + currencySymbol;
503                            var secondPrice = currencySymbolPosition === 'left' ? currencySymbol + secondValue : firstValue + secondValue;
504                            
505                            $priceRange.val(firstPrice + ' - ' + secondPrice);
506                            
507                            $minPrice.val(firstValue);
508                            $maxPrice.val(secondValue);
509                        });
510                    });
511                }
512            };
513            
514            var initKeywordSearch = function() {
515                var tours = typeof mkdfToursSearchData !== 'undefined' ? mkdfToursSearchData.tours : [];
516                
517                var tours = new Bloodhound({
518                    datumTokenizer: Bloodhound.tokenizers.whitespace,
519                    queryTokenizer: Bloodhound.tokenizers.whitespace,
520                    local: tours
521                });
522                
523                $searchForms.find('.mkdf-tours-keyword-search').typeahead({
524                        hint: true,
525                        highlight: true,
526                        minLength: 1
527                    },
528                    {
529                        name: 'tours',
530                        source: tours
531                    });
532            };
533            
534            var initDestinationSearch = function() {
535                var destinations = typeof mkdfToursSearchData !== 'undefined' ? mkdfToursSearchData.destinations : [];
536                
537                var destinations = new Bloodhound({
538                    datumTokenizer: Bloodhound.tokenizers.whitespace,
539                    queryTokenizer: Bloodhound.tokenizers.whitespace,
540                    local: destinations
541                });
542                
543                $searchForms.find('.mkdf-tours-destination-search').typeahead({
544                        hint: true,
545                        highlight: true,
546                        minLength: 1
547                    },
548                    {
549                        name: 'destinations',
550                        source: destinations
551                    });
552            };
553            
554            var initSelectPlaceholder = function() {
555                var $selects = $('.mkdf-tours-select-placeholder');
556                
557                var changeState = function($select) {
558                    var selectVal = $select.val();
559                    
560                    if(selectVal === '') {
561                        $select.addClass('mkdf-tours-select-default-option');
562                    } else {
563                        $select.removeClass('mkdf-tours-select-default-option');
564                    }
565                };
566                
567                if($selects.length) {
568                    $selects.each(function() {
569                        var $select = $(this);
570                        
571                        changeState($(this));
572                        
573                        $select.on('change', function() {
574                            changeState($(this));
575                        });
576                    })
577                }
578            };
579            
580            return {
581                init: function() {
582                    initRangeSlider();
583                    initKeywordSearch();
584                    initDestinationSearch();
585                    initSelectPlaceholder();
586                }
587            }
588        }();
589        
590        var handleSearch = function() {
591            var rewriteURL = function(queryString) {
592                //init variables
593                var currentPage = '';
594                
595                //does current url has query string
596                if (location.href.match(/\?.*/) && document.referrer) {
597                    //get clean current url
598                    currentPage = location.href.replace(/\?.*/, '');
599                }
600
601                //rewrite url with current page and new url string
602                window.history.replaceState({page: currentPage + '?' + queryString}, '', currentPage + '?' + queryString);
603            };
604            
605            var sendRequest = function($form, changeLabel, resetPagination, animate) {
606                var $submitButton = $form.find('input[type="submit"]');
607                var $searchContent = $('.mkdf-tours-search-content');
608                var $searchPageContent = $('.mkdf-tours-search-page-holder');
609                var searchInProgress = false;
610
611                changeLabel = typeof changeLabel !== 'undefined' ? changeLabel : true;
612                resetPagination = typeof resetPagination !== 'undefined' ? resetPagination : true;
613                animate = typeof animate !== 'undefined' ? animate : false;
614                
615                var searchingLabel = $submitButton.data('searching-label');
616                var originalLabel = $submitButton.val();
617                
618                if(!searchInProgress) {
619                    if(changeLabel) {
620                        $submitButton.val(searchingLabel);
621                    }
622                    
623                    if(resetPagination) {
624                        $form.find('[name="tour_page"]').val(1);
625                    }
626                    
627                    searchInProgress = true;
628                    $searchContent.addClass('mkdf-tours-searching');
629                    
630                    var data = {
631                        action: 'tours_search_handle_form_submission'
632                    };
633                    
634                    data.fields = $form.serialize();
635                    
636                    $.ajax({
637                        type: 'GET',
638                        url: mkdfGlobalVars.vars.mkdfAjaxUrl,
639                        dataType: 'json',
640                        data: data,
641                        success: function(response) {
642                            if(changeLabel) {
643                                $submitButton.val(originalLabel);
644                            }
645                            
646                            $searchContent.removeClass('mkdf-tours-searching');
647                            searchInProgress = false;
648                            
649                            $searchContent.find('.mkdf-tours-row .mkdf-tours-row-inner-holder').html(response.html);
650                            rewriteURL(response.url);
651                            
652                            $('.mkdf-tours-search-pagination').remove();
653                            
654                            $searchContent.append(response.paginationHTML);
655                            
656                            if(animate) {
657                                $('html, body').animate({scrollTop: $searchPageContent.offset().top - 80}, 700);
658                            }
659                            mkdfToursRevealAnimation();
660                        }
661                    });
662                }
663            };
664            
665            var formHandler = function($form) {
666                
667                if($('body').hasClass('post-type-archive-tour-item')) {
668                    $form.on('submit', function(e) {
669                        e.preventDefault();
670                        e.stopPropagation();
671                        
672                        sendRequest($form);
673                    });
674                }
675            };
676            
677            var handleOrderBy = function($searchForms) {
678                var $orderingItems = $('.mkdf-search-ordering-item');
679                var $orderByField = $searchForms.find('[name="order_by"]');
680                var $orderTypeField = $searchForms.find('[name="order_type"]');
681                
682                if($orderingItems.length) {
683                    $orderingItems.on('click', function(e) {
684                        e.preventDefault();
685                        e.stopPropagation();
686                        
687                        var $thisItem = $(this);
688                        
689                        $orderingItems.removeClass('mkdf-search-ordering-item-active');
690                        $thisItem.addClass('mkdf-search-ordering-item-active');
691                        
692                        var orderBy = $thisItem.data('order-by');
693                        var orderType = $thisItem.data('order-type');
694                        
695                        if(typeof orderBy !== 'undefined' && typeof orderType !== 'undefined') {
696                            $orderByField.val(orderBy);
697                            $orderTypeField.val(orderType);
698                        }
699                        
700                        sendRequest($searchForms, false, false);
701                    });
702                }
703            };
704            
705            var handleViewType = function($searchForms) {
706                var $viewTypeItems = $('.mkdf-tours-search-view-item');
707                var $typeField = $searchForms.find('[name="view_type"]');
708                
709                if($viewTypeItems.length) {
710                    $viewTypeItems.on('click', function(e) {
711                        e.preventDefault();
712                        e.stopPropagation();
713                        
714                        var $thisView = $(this);
715                        
716                        $viewTypeItems.removeClass('mkdf-tours-search-view-item-active');
717                        $thisView.addClass('mkdf-tours-search-view-item-active');
718                        
719                        var viewType = $thisView.data('type');
720                        
721                        if(typeof viewType !== 'undefined') {
722                            $typeField.val(viewType);
723                        }
724                        
725                        sendRequest($searchForms, false, false);
726                    });
727                }
728            };
729            
730            var handlePagination = function($searchForms) {
731                var $paginationHolder = $('.mkdf-tours-search-pagination');
732                var $pageField = $searchForms.find('[name="tour_page"]');
733                
734                if($paginationHolder.length) {
735                    $(document).on('click', '.mkdf-tours-search-pagination li', function(e) {
736                        e.preventDefault();
737                        e.stopPropagation();
738                        
739                        var $thisItem = $(this);
740                        
741                        var page = $thisItem.data('tour-page');
742                        
743                        if(typeof page !== 'undefined') {
744                            $pageField.val(page);
745                        }
746                        
747                        sendRequest($searchForms, true, false, true);
748                    });
749                }
750            }
751            
752            return {
753                init: function() {
754                    formHandler($searchForms);
755                    handleOrderBy($searchForms);
756                    handleViewType($searchForms);
757                    handlePagination($searchForms);
758                }
759            }
760        }();
761        
762        return {
763            fieldsHelper: fieldsHelper,
764            handleSearch: handleSearch
765        }
766    }
767
768    /*
769    * Tours Reveal animation
770    */
771    function mkdfToursRevealAnimation() {
772        var toursRevealItems = $('.mkdf-tours-revealing-item');
773
774        if (toursRevealItems.length) {
775            toursRevealItems.each(function(){
776                var toursRevealItem = $(this),
777                    contentHolder = toursRevealItem.find('.mkdf-tours-revealing-item-content-holder'),
778                    excerpt = contentHolder.find('.mkdf-tours-revealing-item-excerpt'),
779                    deltaY = Math.ceil(excerpt.height());
780
781                contentHolder.css('transform','translate3d(0,'+deltaY+'px,0)');
782
783                toursRevealItem.mouseenter(function(){
784                    contentHolder.css('transform','translate3d(0,0,0)');
785                });
786
787                toursRevealItem.mouseleave(function(){
788                    deltaY = Math.ceil(excerpt.height());
789                    contentHolder.css('transform','translate3d(0,'+deltaY+'px,0)');
790                });
791            });
792        }
793    }
794
795    function mkdfToursTitleFullHeight() {
796    	var titleArea = $('.mkdf-tours-single-title'),
797    		content = $('.mkdf-wrapper-inner > .mkdf-content'),
798    		titleAreaHeight;
799
800    	if (titleArea.length) {
801    		titleAreaHeight = mkdf.windowHeight;
802
803    		titleAreaHeight -= content.offset().top;
804
805    		titleArea.css('height',titleAreaHeight);
806    	}
807    }
808
809    function mkdfToursScrollDown() {
810        var scrollDown = $('.mkdf-tours-single-scroll-down');
811
812        if (scrollDown.length) {
813            var toursSingle = $('.mkdf-tour-item-single-holder'),
814                auxCoeff = 0,
815                fixedHeader = $('.mkdf-fixed-wrapper'),
816                stickyHeader = $('.mkdf-sticky-header');
817
818            if (!mkdf.htmlEl.hasClass('touch')) {
819                if (fixedHeader.length) {
820                    auxCoeff = fixedHeader.height();
821                } else if (stickyHeader.length) {
822                    auxCoeff = stickyHeader.height();
823                }
824            }
825
826            scrollDown.on('click', function() {
827                $('html, body').animate({
828                    scrollTop: toursSingle.offset().top - auxCoeff
829                }, 1000, 'easeInOutExpo');
830            });
831        }
832    }
833    
834    return tours;
835})(jQuery);
836
837(function($) {
838    'use strict';
839
840    var tourShortcodes = {};
841    if(typeof mkdf !== 'undefined'){
842        mkdf.modules.tourShortcodes = tourShortcodes;
843    }
844    
845    tourShortcodes.mkdfOnDocumentReady = mkdfOnDocumentReady;
846    tourShortcodes.mkdfOnWindowLoad = mkdfOnWindowLoad;
847    tourShortcodes.mkdfOnWindowResize = mkdfOnWindowResize;
848    tourShortcodes.mkdfOnWindowScroll = mkdfOnWindowScroll;
849
850    tourShortcodes.toursList = toursList;
851
852    $(document).ready(mkdfOnDocumentReady);
853    $(window).on('load', mkdfOnWindowLoad);
854    $(window).resize(mkdfOnWindowResize);
855    $(window).scroll(mkdfOnWindowScroll);
856
857    /*
858     All functions to be called on $(document).ready() should be in this function
859     */
860    function mkdfOnDocumentReady() {
861    }
862
863    /*
864     All functions to be called on $(window).load() should be in this function
865     */
866    function mkdfOnWindowLoad() {
867        toursList().init();
868    }
869
870    /*
871     All functions to be called on $(window).resize() should be in this function
872     */
873    function mkdfOnWindowResize() {
874    }
875
876    /*
877     All functions to be called on $(window).scroll() should be in this function
878     */
879    function mkdfOnWindowScroll() {
880    }
881
882    function themeInstalled() {
883        return typeof mkdf !== 'undefined';
884    }
885
886    function toursList() {
887        var listItem = $('.mkdf-tours-list-holder'),
888            listObject;
889
890        var initList = function(listHolder) {
891            listHolder.animate({opacity: 1});
892
893            listObject = listHolder.isotope({
894                percentPosition: true,
895                itemSelector: '.mkdf-tours-row-item',
896                transitionDuration: '0.4s',
897                isInitLayout: true,
898                hiddenStyle: {
899                    opacity: 0
900                },
901                visibleStyle: {
902                    opacity: 1
903                },
904                masonry: {
905                    columnWidth: '.mkdf-tours-list-grid-sizer'
906                }
907            });
908
909            if(themeInstalled()) {
910                mkdf.modules.common.mkdfInitParallax();
911            }
912        };
913
914        var initFilter = function(listFeed) {
915            var filters = listFeed.find('.mkdf-tour-list-filter-item');
916
917            filters.on('click', function(e) {
918                e.preventDefault();
919                e.stopPropagation();
920
921                var currentFilter = $(this);
922                var type = currentFilter.data('type');
923
924                filters.removeClass('mkdf-tour-list-current-filter');
925                currentFilter.addClass('mkdf-tour-list-current-filter');
926
927                type = typeof type === 'undefined' ? '*' : '.' + type;
928
929                listFeed.find('.mkdf-tours-list-holder-inner').isotope({
930                    filter: type
931                });
932            });
933        };
934
935        var resetFilter = function(listFeed) {
936            var filters = listFeed.find('.mkdf-tour-list-filter-item');
937
938            filters.removeClass('mkdf-tour-list-current-filter');
939            filters.eq(0).addClass('mkdf-tour-list-current-filter');
940
941            listFeed.find('.mkdf-tours-list-holder-inner').isotope({
942                filter: '*'
943            });
944        };
945
946        var initPagination = function(listObject) {
947            var paginationDataHolder = listObject.find('.mkdf-tours-list-pagination-data');
948            var itemsHolder = listObject.find('.mkdf-tours-list-holder-inner');
949
950            var fetchData = function(callback) {
951                var data = {
952                    action: 'mkdf_tours_list_ajax_pagination',
953                    fields: paginationDataHolder.find('input').serialize()
954                };
955
956                $.ajax({
957                    url: mkdfGlobalVars.vars.mkdfAjaxUrl,
958                    data: data,
959                    dataType: 'json',
960                    type: 'POST',
961                    success: function(response) {
962                        if(response.havePosts) {
963                            paginationDataHolder.find('[name="next_page"]').val(response.nextPage);
964                        }
965
966                        if(themeInstalled()) {
967                            mkdf.modules.common.mkdfInitParallax();
968                        }
969
970                        callback.call(this, response);
971                    }
972                });
973            };
974            
975            var loadMorePagination = function() {
976                var loadMoreButton = listObject.find('.mkdf-tours-load-more-button');
977                var paginationHolder = listObject.find('.mkdf-tours-pagination-holder');
978                var loadingInProgress = false;
979
980                if(loadMoreButton.length) {
981                    loadMoreButton.on('click', function(e) {
982                        e.preventDefault();
983                        e.stopPropagation();
984
985                        var loadingLabel = loadMoreButton.data('loading-label');
986                        var originalText = loadMoreButton.text();
987                        
988                        loadMoreButton.text(loadingLabel);
989                        resetFilter(listObject);
990
991                        if(!loadingInProgress) {
992                            loadingInProgress = true;
993
994                            fetchData(function(response) {
995                                if(response.havePosts === true) {
996                                    loadMoreButton.text(originalText);
997
998                                    var responseHTML = $(response.html);
999
1000                                    itemsHolder.append(responseHTML);
1001
1002                                    itemsHolder.waitForImages(function() {
1003                                        itemsHolder.isotope('appended', responseHTML).isotope('reloadItems');
1004                                        mkdf.modules.tours.mkdfToursRevealAnimation();
1005                                    });
1006
1007                                    if (response.maxPage < response.nextPage) {
1008	                                    loadMoreButton.remove();
1009                                    }
1010                                } else {
1011                                    loadMoreButton.remove();
1012
1013                                    paginationHolder.html(response.message);
1014                                }
1015
1016                                loadingInProgress = false;
1017                            });
1018                        }
1019
1020                    });
1021                }
1022            };
1023
1024            loadMorePagination();
1025        };
1026
1027        return {
1028            init: function() {
1029                if(listItem.length && typeof $.fn.isotope !== 'undefined') {
1030                    listItem.each(function() {
1031                        initList($(this).find('.mkdf-tours-list-holder-inner'));
1032                        initFilter($(this));
1033                        initPagination($(this));
1034                    });
1035                }
1036            }
1037        }
1038    }
1039    
1040    return tourShortcodes;
1041})(jQuery);

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.