PageSourceSearch

https://www.wetandwildcuracao.com/assets/frontend/wetnwild/js/defaults/spincommon.js?v=1

js wetandwildcuracao.com collected 2026-10-08 10:27:00 UTC 19,604 bytes, 545 lines download raw bytes

1/**
2 * Spin Common JS
3 * Refactored by Alvin Bakker for Spin Internet Media
4 * Copyright 2017
5 */
6
7/*******************************************************************************************************************
8 * Globals
9 ********************************************************************************************************************/
10
11var moveLeft;
12var moveRight;
13
14var google;
15var map;
16
17var timeout = null;
18var hash = window.location.hash;
19
20var Common;
21Common = {
22
23    /*******************************************************************************************************************
24     * Init actions
25     ********************************************************************************************************************/
26
27    init: function(headerHeight) {
28        Common.bindUIActions();
29        Common.setCoprightYear();
30        Common.onResize();
31
32        if($("#pinto_items").length) {
33            Common.initPinto(300, 20, 20);
34        }
35
36        if($(".background-video").length) {
37            Common.initYTvideo();
38        }
39
40        if($(".i6slideuphighlights").length) {
41            Common.initSlideUp();
42        }
43
44        if($(".form-group.date input").length) {
45            $(".form-group.date input").datepicker({
46                format: 'dd-mm-yyyy',
47                autoclose: true
48            });
49        }
50
51        if($(".form-group.availability-date input").length) {
52            var tdate = new Date();
53            tdate.setDate(tdate.getDate()-1);
54            $(".form-group.availability-date input").datepicker({
55                format: 'dd-mm-yyyy',
56                autoclose: true,
57                daysOfWeekDisabled: av_disabled_week_days,
58                startDate: tdate,
59                beforeShowDay:function(Date){
60                    var current = Date.toJSON().substring(0,10);
61                    if (av_disabled_days.indexOf(current) > -1) {
62                        return false;
63                    }
64                }
65            });
66        }
67
68        if($(".home.scroll-fixed .header-container").length) {
69            Common.setFixedHeader();
70        }
71
72        if($(".h5slidervirtualtour").length) {
73            Common.initSlider();
74        }
75
76        if($(".cycle-slideshow").length) {
77            Common.initSlideShow();
78        }
79
80        // if($(".tab_content").length) {
81        //     Common.initTabs();
82        // }
83
84        if($(".h5slidervirtualtour ul li").length) {
85            Common.initSliderUl();
86        }
87
88        if($('.h7multirowslider').length){
89            Common.slideNavHeight();
90            Common.multiRowSlider();
91        }
92
93        if($('.f3video').length){
94            Common.videoHeight();
95        }
96
97        $(window).resize(function() {
98            Common.onResize();
99        });
100
101        if(hash) {
102            if (hash.indexOf("el-") >= 0) {
103                setTimeout(function () {
104                    $("html, body").animate({
105                        scrollTop: $(hash).offset().top + headerHeight,
106                    }, 1000);
107                }, 1000);
108            }
109        }
110
111        $("a").each(function(ev) {
112            if($(this).attr('href') && !$(this).parent().parent().hasClass('breadcrumb') && !$(this).parent().parent().hasClass('spinbox') && !$(this).parent().hasClass('spinbox')){
113                if($(this).attr('href').indexOf('http://') >= 0 && !$(this).hasClass("no-outbound")) {
114                    $(this).attr('onclick', 'trackOutboundLink("'+$(this).attr('href')+'"); return false;').attr('target', '_blank');
115                }
116                else if($(this).attr('href').indexOf('https://') >= 0 && !$(this).hasClass("no-outbound")) {
117                    $(this).attr('onclick', 'trackOutboundLink("'+$(this).attr('href')+'"); return false;').attr('target', '_blank');
118                }
119            }
120        });
121
122        $(".o2photovideogrid .bgimage, .f3videofullheight .bgimage").delay(1000).fadeOut(500);
123        $(".spinbox a, .spinbox a.spinbox-video").spinBox({scrolling: true});
124        $(".spinicon").spinIcon();
125
126        $(".y3twocolumnsfullheight .col-2").niceScroll({
127            cursorborder: '5px solid #00739A',
128            zindex: 9999,
129            cursorborderradius: '10px',
130            cursorcolor: '#00739A',
131            //background: '#f1f1f1',
132            cursoropacitymin: 1,
133            horizrailenabled: false,
134            autohidemode: false
135        });
136
137        $("body").addClass('loaded');
138        $(".o1photovideogallery .item:odd").addClass('right');
139
140
141    },
142
143    /*******************************************************************************************************************
144    * Functions
145    ********************************************************************************************************************/
146
147    setCoprightYear: function() {
148        var today = new Date;
149        var year = today.getFullYear();
150        $(".copyright-text").html($(".copyright-text").html().replace('YEAR', year));
151    },
152
153    setFixedHeader: function() {
154        var headerFixed = $(".home.scroll-fixed  .header-container").offset().top;
155        $(window).scroll(function () {
156            var fixed = $(".home.scroll-fixed  .header-container");
157            var scroll = $(window).scrollTop();
158            if (scroll >= headerFixed) {
159                fixed.addClass('fixed');
160            } else {
161                fixed.removeClass('fixed');
162            }
163        });
164    },
165
166    escapeRegExp: function(str) {
167        return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
168    },
169
170    initMobileMenu: function(vars) {
171        var menu = $("#menu").mmenu(vars);
172        var icon = $("#m-icon");
173        var API = menu.data('mmenu');
174        icon.on('click', function() {
175            API.open();
176        });
177        API.bind('opened', function() {
178            setTimeout(function() {
179                icon.addClass('is-active');
180            }, 100);
181        });
182        API.bind('closed', function() {
183            setTimeout(function() {
184                icon.removeClass('is-active');
185            }, 100);
186        });
187        $(document).on('click', ".html.mm-right.mm-opening .mm-slideout", function(){
188            icon.removeClass('is-active');
189        });
190    },
191
192    initYTvideo: function() {
193        $(".background-video").each(function(e) {
194            var id = $(this).attr('id');
195            var videoid = $(this).data('videoid');
196            $("#"+id).YTPlayer({
197                fitToBackground: false,
198                videoId: videoid,
199                pauseOnScroll: false,
200                callback: function() {
201                    var player = $("#"+id).data('ytPlayer').player;
202                    if($("#pinto_items").length) {
203                        setTimeout(function(){
204                            Common.initPinto();
205                        }, 2000);
206                    }
207                }
208            });
209        });
210    },
211
212    initPinto: function(itemWidth, gapX, gapY) {
213        var pinto_items = $("#pinto_items").pinto();
214        pinto_items.pinto({
215            itemWidth: itemWidth,
216            gapX: gapX,
217            gapY: gapY
218        });
219    },
220
221    initTabs: function() {
222        $(".tab_content").hide();
223        $(".tab_content:first").show();
224        $("ul.tabs li:not(:first)").removeClass('active');
225        $("ul.tabs li").last().addClass('tab_last');
226    },
227
228    initSlideShow: function() {
229        var progress = $("#progress");
230        var slideshow = $(".h2slider .cycle-slideshow");
231        slideshow.on( 'cycle-initialized cycle-before', function(e, opts) {
232            progress.stop(true).css('width', 0);
233        });
234        slideshow.on( 'cycle-initialized cycle-after', function(e, opts) {
235            if (!slideshow.is('.cycle-paused') ) {
236                progress.animate({ width: '100%' }, opts.timeout, 'linear' );
237            }
238        });
239        slideshow.on( 'cycle-paused', function(e, opts) {
240            progress.stop();
241        });
242        slideshow.on( 'cycle-resumed', function(e, opts, timeoutRemaining) {
243            progress.animate({width: '100%'}, timeoutRemaining, 'linear' );
244        });
245        if($(".h2slider .cycle-slideshow").length) {
246            $(".cycle-slideshow").on('cycle-before', function (opts) {
247                var slideshow = $(this);
248                var img = slideshow.find(".banner-background").css('background-image');
249                slideshow.css('background-image', img);
250            });
251        }
252    },
253
254    initSlideUp: function() {
255        $(".i6slideuphighlights .highlight").each(function(index) {
256            $(this).attr('class', 'highlight id_' + (index + 1));
257            $(".i6slideuphighlights .descr").each(function(index) {
258                $(this).attr('class', 'descr id_' + (index + 1));
259            });
260            var highlight_id = 'id_' + (index + 1);
261            $(".i6slideuphighlights .descr." + highlight_id).hover(function() {
262                $(".i6slideuphighlights .highlight." + highlight_id + " .image .inner").stop(true).slideToggle(400);
263            });
264        });
265    },
266
267    initSlider: function() {
268        var scrollPoint = $(".h5slidervirtualtour");
269        var topOfOthDiv = scrollPoint.offset().top;
270        $(window).scroll(function() {
271            if($(window).scrollTop() > topOfOthDiv) {
272                $(".header-container .slide-in-cta").addClass('show');
273            } else if($(window).scrollTop() < topOfOthDiv) {
274                $(".header-container .slide-in-cta").removeClass('show');
275            }
276        });
277    },
278
279    initSliderUl: function() {
280        var tourWrap = $(".h5slidervirtualtour");
281        var tour = $("ul", tourWrap);
282        var tourWidth = 0;
283        $("li", tour).each(function(){
284            tourWidth += $(this).outerWidth();
285        });
286        tour.css('width', tourWidth);
287        if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
288            $(".prevtour", tourWrap).bind('touchstart',function(){
289                Common.slideLeft($(this),5);
290            }).bind('touchend',function(){
291                clearTimeout(moveLeft);
292            });
293            $(".nexttour", tourWrap).bind('touchstart',function(){
294                Common.slideRight($(this),5);
295            }).bind('touchend',function(){
296                clearTimeout(moveRight);
297            });
298        } else {
299            $(".prevtour", tourWrap).mouseenter(function() {
300                Common.slideLeft($(this),50);
301            }).mouseleave(function() {
302                clearTimeout(moveLeft);
303            }).mousedown(function() {
304                Common.slideLeft($(this),15);
305            }).mouseup(function( ){
306                clearTimeout(moveLeft);
307            });
308            $(".nexttour", tourWrap).mouseenter(function() {
309                Common.slideRight($(this),50);
310            }).mouseleave(function() {
311                clearTimeout(moveRight);
312            }).mousedown(function() {
313                Common.slideRight($(this),15);
314            }).mouseup(function() {
315                clearTimeout(moveRight);
316            });
317        }
318    },
319
320    initLightbox: function() {
321        if($(".lb-box").length > 0) {
322            var H = $(".lb-box").outerHeight(true);
323            var screenH = $(window).height();
324            var docH = $("html").height();
325            var offset = 0;
326            if(screenH > H) {
327                offset = (screenH/2) - (H/2);
328            }
329            $(".lb-overlay").css({height:docH});
330            $(".lb-wrapper").css({marginTop:offset});
331            $(".lb-box").on('click', ".close, .btnclose", function(e) {
332                e.preventDefault();
333                $(".lb-box,.lb-overlay").fadeOut(200);
334            });
335            $(".lb-overlay").on('click', function() {
336                $(".lb-box, .lb-overlay").fadeOut(200);
337            });
338        }
339    },
340
341    slideLeft: function(element, speed, fnCallback) {
342        var tourWrap = $(".h5slidervirtualtour");
343        var tour = $("ul", tourWrap);
344        tour.stop(true,true).animate({'marginLeft': "+=10px"},50,function(){
345            var firstItem = tour.children().first();
346            var lastItem = tour.children().last();
347            var tourMarginLeft = parseInt(tour.css('marginLeft').replace('px',''));
348            var firstItemWidth = firstItem.outerWidth();
349            if(tourMarginLeft >= 0) {
350                lastItem.prependTo(tour);
351                tour.css('marginLeft', '-='+ firstItemWidth + 'px');
352            }
353        });
354        moveLeft = setTimeout(function(){
355            Common.slideLeft(element,speed);
356        }, speed );
357    },
358
359    slideRight: function(element, speed, fnCallback) {
360        var tourWrap = $(".h5slidervirtualtour");
361        var tour = $("ul", tourWrap);
362        tour.stop(true,true).animate({'marginLeft': "-=10px"},50,function(){
363            var firstItem = tour.children().first();
364            var tourMarginLeft = parseInt(tour.css('marginLeft').replace('px',''));
365            var firstItemWidth = firstItem.outerWidth();
366            if((tourMarginLeft + firstItemWidth) < 0) {
367                firstItem.appendTo(tour);
368                tour.css('marginLeft', '+='+ firstItemWidth + 'px');
369            }
370            if (typeof fnCallback == 'function') {
371                fnCallback.call(this, true);
372            }
373        });
374        moveRight = setTimeout(function(){
375            slideRight(element,speed);
376        }, speed );
377    },
378
379    slideHeight: function() {
380        $(".h2slider.fullheight, .h2slider.fullheight .item").height(windowHeight);
381    },
382
383    headerImageHeight: function() {
384        $(".b4headerimage.fullheight, .b4headerimage.fullheight .bg-image").height(windowHeight);
385    },
386
387    randomImageHeight: function() {
388        $(".b5randomimages.fullheight, .b5randomimages.fullheight .bg-image").height(windowHeight);
389    },
390
391    videoHeight: function() {
392        $(".f3video").height(windowHeight);
393    },
394
395    slideNavHeight: function() {
396        $(window).load(function() {
397            var sliderHeight = $('.h7multirowslider .item').height();
398            $('.slide-nav-container').css('height', sliderHeight);
399        });
400    },
401
402    multiRowSlider: function() {
403        $(window).load(function () {
404            // set position for lightbox container
405            var lightBox = $('.lighbox-container');
406            var lbOverlay = $('.lightbox-overlay');
407            var lightBoxHeight = lightBox.height();
408            lightBox.css('margin-top', -lightBoxHeight / 2);
409
410            // open item on click
411            $('.h7multirowslider .slide-item a').on('click', function (e) {
412                e.preventDefault();
413                lbOverlay.fadeIn(500);
414                var aID = $(this).attr('href');
415                $(aID).delay(300).fadeIn(500);
416                $('html').addClass('noscroll');
417
418                // custom scrollbar
419                $('.h7multirowslider .desktop .desc-inner').niceScroll({
420                    cursorborder: '0px solid #ccc',
421                    cursorborderradius: '3px',
422                    cursorcolor: '#ccc',
423                    cursoropacitymin: 0.1,
424                    background: '#f1f1f1',
425                    autohidemode: false,
426                    horizrailenabled: false
427                });
428
429                $('html').mouseover(function () {
430                    $('.h7multirowslider .desktop .desc-inner').getNiceScroll().resize();
431                });
432            });
433
434            // close item
435            lbOverlay.add('.lighbox-container .fa-times').on('click', function () {
436                lbOverlay.delay(100).fadeOut(500);
437                lightBox.fadeOut(500);
438                $('html').removeClass('noscroll');
439            });
440        });
441    },
442
443    setHeightToRatio: function(element) {
444        if (element) {
445            element.each(function(){
446                var ratio = $(this).attr('data-ratio');
447                if(ratio) {
448                    var part = ratio.split(':');
449                    var w = parseInt(part[0]);
450                    var h = parseInt(part[1]);
451                    var srcW = $(this).width();
452                    $(this).height((srcW / w) * h);
453                }
454            });
455        }
456    },
457
458    twocolumnHeight: function() {
459        var H = $(window).height() - 118;
460        var J = $(window).height() - 198;
461        $(".y3twocolumnsfullheight, .y3twocolumnsfullheight .item").height(H);
462        $(".y3twocolumnsfullheight .col-1, .y3twocolumnsfullheight .col-2").height(J);
463    },
464
465    onResize: function() {
466        Common.setHeightToRatio($(".video iframe"));
467        Common.setHeightToRatio($(".googlemaps .map"));
468        if ($(".magazine").length ) {
469            $(".magazine .item").zoom({on: 'click'});
470            $(".magazine").on('mouseenter', ".item", function () {
471                $(this).find(".overlay").stop(true, true).fadeIn(100);
472            }).on('mouseleave', ".item", function () {
473                $(this).find('.overlay').fadeOut(500);
474            });
475        }
476        Common.initLightbox();
477        Common.videoHeight();
478        Common.twocolumnHeight();
479        Common.slideNavHeight();
480        Common.slideHeight();
481        Common.headerImageHeight();
482        Common.randomImageHeight();
483    },
484
485    /*******************************************************************************************************************
486     * Listeners
487     ********************************************************************************************************************/
488
489    bindUIActions: function () {
490
491        $(document).on('click', ".n3facebookpostfeeds .item .video", function(e) {
492            var video = $(this).parents(".item").find(".fb-video");
493            video.show(100).trigger('play').addClass('active');
494            $(this).parents('.item').find(".video-lightbox").show(100);
495        });
496
497        $(document).on('click', ".video-lightbox", function(e) {
498            $(".video-lightbox").hide(100);
499            $(".fb-video.active").trigger('pause').removeClass('active').hide();
500        });
501
502        $(document).on('click', ".icons ul li.search-icon", function(e) {
503            $(".search-container").stop(true, true).slideToggle(500);
504            $(this).toggleClass('open');
505        });
506
507        $(document).on('click', "ul.tabs li", function(e) {
508            $(".tab_content").hide();
509            var activeTab = $(this).attr('rel');
510            $("#"+activeTab).fadeIn();
511            $("ul.tabs li").removeClass('active');
512            $(this).addClass('active');
513            $(".tab_drawer_heading").removeClass('d_active');
514            $(".tab_drawer_heading[rel^='"+activeTab+"']").addClass('d_active');
515        });
516
517        $(document).on('click', ".tab_drawer_heading", function(e) {
518            $(".tab_content").hide();
519            var d_activeTab = $(this).attr('rel');
520            $("#"+d_activeTab).fadeIn();
521            $(".tab_drawer_heading").removeClass('d_active');
522            $(this).addClass('d_active');
523            $("ul.tabs li").removeClass('active');
524            $("ul.tabs li[rel^='"+d_activeTab+"']").addClass('active');
525        });
526
527
528
529        $(document).on('click', ".subdropdown-title", function() {
530            var ul = $(".leftcol .subnav");
531            if (ul.hasClass('open')) {
532                ul.slideUp(400, function() {
533                    ul.removeClass('open').css('display', '');
534                });
535            }
536            else {
537                ul.slideDown(400, function() {
538                    ul.addClass('open').css('display', '');
539                });
540            }
541        });
542
543    }
544
545};

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.