PageSourceSearch

https://www.magnum.my/assets/theme/js/script.js

js magnum.my collected 2026-10-07 08:24:54 UTC 48,815 bytes, 1,241 lines download raw bytes

1(function($) {
2
3    var isBuilder = $('html').hasClass('is-builder');
4
5    $.extend($.easing, {
6        easeInOutCubic: function(x, t, b, c, d) {
7            if ((t /= d / 2) < 1) return c / 2 * t * t * t + b;
8            return c / 2 * ((t -= 2) * t * t + 2) + b;
9        }
10    });
11
12    $.fn.outerFind = function(selector) {
13        return this.find(selector).addBack(selector);
14    };
15
16    $.fn.footerReveal = function() {
17        var $this = $(this);
18        var $prev = $this.prev();
19        var $win = $(window);
20
21        function initReveal() {
22            if ($this.outerHeight() <= $win.outerHeight()) {
23                $this.css({
24                    'z-index': -999,
25                    position: 'fixed',
26                    bottom: 0
27                });
28
29                $this.css({
30                    'width': $prev.outerWidth()
31                });
32
33                $prev.css({
34                    'margin-bottom': $this.outerHeight()
35                });
36            } else {
37                $this.css({
38                    'z-index': '',
39                    position: '',
40                    bottom: ''
41                });
42
43                $this.css({
44                    'width': ''
45                });
46
47                $prev.css({
48                    'margin-bottom': ''
49                });
50            }
51        }
52
53        initReveal();
54
55        $win.on('load resize', function() {
56            initReveal();
57        });
58
59        return this;
60    };
61
62    (function($, sr) {
63        // debouncing function from John Hann
64        // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
65        var debounce = function(func, threshold, execAsap) {
66            var timeout;
67
68            return function debounced() {
69                var obj = this,
70                    args = arguments;
71
72                function delayed() {
73                    if (!execAsap) func.apply(obj, args);
74                    timeout = null;
75                }
76
77                if (timeout) clearTimeout(timeout);
78                else if (execAsap) func.apply(obj, args);
79
80                timeout = setTimeout(delayed, threshold || 100);
81            };
82        };
83        // smartresize
84        jQuery.fn[sr] = function(fn) {
85            return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr);
86        };
87
88    })(jQuery, 'smartresize');
89
90    (function() {
91
92        var scrollbarWidth = 0,
93            originalMargin, touchHandler = function(event) {
94                event.preventDefault();
95            };
96
97        function getScrollbarWidth() {
98            if (scrollbarWidth) return scrollbarWidth;
99            var scrollDiv = document.createElement('div');
100            $.each({
101                top: '-9999px',
102                width: '50px',
103                height: '50px',
104                overflow: 'scroll',
105                position: 'absolute'
106            }, function(property, value) {
107                scrollDiv.style[property] = value;
108            });
109            $('body').append(scrollDiv);
110            scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
111            $('body')[0].removeChild(scrollDiv);
112            return scrollbarWidth;
113        }
114
115    })();
116
117    $.isMobile = function(type) {
118        var reg = [];
119        var any = {
120            blackberry: 'BlackBerry',
121            android: 'Android',
122            windows: 'IEMobile',
123            opera: 'Opera Mini',
124            ios: 'iPhone|iPad|iPod'
125        };
126        type = 'undefined' == $.type(type) ? '*' : type.toLowerCase();
127        if ('*' == type) reg = $.map(any, function(v) {
128            return v;
129        });
130        else if (type in any) reg.push(any[type]);
131        return !!(reg.length && navigator.userAgent.match(new RegExp(reg.join('|'), 'i')));
132    };
133
134    var isSupportViewportUnits = (function() {
135        // modernizr implementation
136        var $elem = $('<div style="height: 50vh; position: absolute; top: -1000px; left: -1000px;">').appendTo('body');
137        var elem = $elem[0];
138        var height = parseInt(window.innerHeight / 2, 10);
139        var compStyle = parseInt((window.getComputedStyle ? getComputedStyle(elem, null) : elem.currentStyle)['height'], 10);
140        $elem.remove();
141        return compStyle == height;
142    }());
143
144    $(function() {
145
146        $('html').addClass($.isMobile() ? 'mobile' : 'desktop');
147
148        // .mbr-navbar--sticky
149        $(window).scroll(function() {
150            $('.mbr-navbar--sticky').each(function() {
151                var method = $(window).scrollTop() > 10 ? 'addClass' : 'removeClass';
152                $(this)[method]('mbr-navbar--stuck')
153                    .not('.mbr-navbar--open')[method]('mbr-navbar--short');
154            });
155        });
156
157        if ($.isMobile() && navigator.userAgent.match(/Chrome/i)) { // simple fix for Chrome's scrolling
158            (function(width, height) {
159                var deviceSize = [width, width];
160                deviceSize[height > width ? 0 : 1] = height;
161                $(window).smartresize(function() {
162                    var windowHeight = $(window).height();
163                    if ($.inArray(windowHeight, deviceSize) < 0)
164                        windowHeight = deviceSize[$(window).width() > windowHeight ? 1 : 0];
165                    $('.mbr-section--full-height').css('height', windowHeight + 'px');
166                });
167            })($(window).width(), $(window).height());
168        } else if (!isSupportViewportUnits) { // fallback for .mbr-section--full-height
169            $(window).smartresize(function() {
170                $('.mbr-section--full-height').css('height', $(window).height() + 'px');
171            });
172            $(document).on('add.cards', function(event) {
173                if ($('html').hasClass('mbr-site-loaded') && $(event.target).outerFind('.mbr-section--full-height').length)
174                    $(window).resize();
175            });
176        }
177
178        // .mbr-section--16by9 (16 by 9 blocks autoheight)
179        function calculate16by9() {
180            $(this).css('height', $(this).parent().width() * 9 / 16);
181        }
182        $(window).smartresize(function() {
183            $('.mbr-section--16by9').each(calculate16by9);
184        });
185        $(document).on('add.cards changeParameter.cards', function(event) {
186            var enabled = $(event.target).outerFind('.mbr-section--16by9');
187            if (enabled.length) {
188                enabled
189                    .attr('data-16by9', 'true')
190                    .each(calculate16by9);
191            } else {
192                $(event.target).outerFind('[data-16by9]')
193                    .css('height', '')
194                    .removeAttr('data-16by9');
195            }
196        });
197
198        // .mbr-parallax-background
199        function initParallax(card) {
200            setTimeout(function() {
201                $(card).outerFind('.mbr-parallax-background')
202                    .jarallax({
203                        speed: 0.6
204                    })
205                    .css('position', 'relative');
206            }, 0);
207        }
208
209       
210
211        function destroyParallax(card) {
212            $(card).jarallax('destroy').css('position', '');
213        }
214
215        if ($.fn.jarallax && !$.isMobile()) {
216            $(window).on('update.parallax', function(event) {
217                setTimeout(function() {
218                    var $jarallax = $('.mbr-parallax-background');
219
220                    $jarallax.jarallax('coverImage');
221                    $jarallax.jarallax('clipContainer');
222                    $jarallax.jarallax('onScroll');
223                }, 0);
224            });
225
226            if (isBuilder) {
227                $(document).on('add.cards', function(event) {
228                    initParallax(event.target);
229                    $(window).trigger('update.parallax');
230                });
231
232                $(document).on('changeParameter.cards', function(event, paramName, value, key) {
233                    if (paramName === 'bg') {
234                        destroyParallax(event.target);
235
236                        switch (key) {
237                            case 'type':
238                                if (value.parallax === true) {
239                                    initParallax(event.target);
240                                }
241                                break;
242                            case 'value':
243                                if (value.type === 'image' && value.parallax === true) {
244                                    initParallax(event.target);
245                                }
246                                break;
247                            case 'parallax':
248                                if (value.parallax === true) {
249                                    initParallax(event.target);
250                                }
251                        }
252                    }
253
254                    $(window).trigger('update.parallax');
255                });
256            } else {
257                initParallax(document.body);
258            }
259
260            // for Tabs
261            $(window).on('shown.bs.tab', function(e) {
262                $(window).trigger('update.parallax');
263            });
264        }
265
266        // .mbr-fixed-top
267        var fixedTopTimeout, scrollTimeout, prevScrollTop = 0,
268            fixedTop = null,
269            isDesktop = !$.isMobile();
270        $(window).scroll(function() {
271            if (scrollTimeout) clearTimeout(scrollTimeout);
272            var scrollTop = $(window).scrollTop();
273            var scrollUp = scrollTop <= prevScrollTop || isDesktop;
274            prevScrollTop = scrollTop;
275            if (fixedTop) {
276                var fixed = scrollTop > fixedTop.breakPoint;
277                if (scrollUp) {
278                    if (fixed != fixedTop.fixed) {
279                        if (isDesktop) {
280                            fixedTop.fixed = fixed;
281                            $(fixedTop.elm).toggleClass('is-fixed');
282                        } else {
283                            scrollTimeout = setTimeout(function() {
284                                fixedTop.fixed = fixed;
285                                $(fixedTop.elm).toggleClass('is-fixed');
286                            }, 40);
287                        }
288                    }
289                } else {
290                    fixedTop.fixed = false;
291                    $(fixedTop.elm).removeClass('is-fixed');
292                }
293            }
294        });
295        $(document).on('add.cards delete.cards', function(event) {
296            if (fixedTopTimeout) clearTimeout(fixedTopTimeout);
297            fixedTopTimeout = setTimeout(function() {
298                if (fixedTop) {
299                    fixedTop.fixed = false;
300                    $(fixedTop.elm).removeClass('is-fixed');
301                }
302                $('.mbr-fixed-top:first').each(function() {
303                    fixedTop = {
304                        breakPoint: $(this).offset().top + $(this).height() * 3,
305                        fixed: false,
306                        elm: this
307                    };
308                    $(window).scroll();
309                });
310            }, 650);
311        });
312
313        // embedded videos
314        $(window).smartresize(function() {
315            $('.mbr-embedded-video').each(function() {
316                $(this).height(
317                    $(this).width() *
318                    parseInt($(this).attr('height') || 315) /
319                    parseInt($(this).attr('width') || 560)
320                );
321            });
322        });
323        $(document).on('add.cards', function(event) {
324            if ($('html').hasClass('mbr-site-loaded') && $(event.target).outerFind('iframe').length)
325                $(window).resize();
326        });
327
328        // background video
329        function videoParser(card) {
330            $(card).outerFind('[data-bg-video]').each(function() {
331                var videoURL = $(this).attr('data-bg-video');
332                var parsedUrl = videoURL.match(/(http:\/\/|https:\/\/|)?(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(&\S+)?/);
333
334                var $img = $('<div class="mbr-background-video-preview">')
335                    .hide()
336                    .css({
337                        backgroundSize: 'cover',
338                        backgroundPosition: 'center'
339                    });
340                $('> *:eq(0)', this).before($img);
341
342                // youtube or vimeo
343                if (parsedUrl && (/youtube/g.test(parsedUrl[3]) || /vimeo/g.test(parsedUrl[3]))) {
344                    // youtube
345                    if (parsedUrl && /youtube/g.test(parsedUrl[3])) {
346                        var previewURL = 'http' + ('https:' === location.protocol ? 's' : '') + ':';
347                        previewURL += '//img.youtube.com/vi/' + parsedUrl[6] + '/maxresdefault.jpg';
348
349                        $('<img>').on('load', function() {
350                            if (120 === (this.naturalWidth || this.width)) {
351                                // selection of preview in the best quality
352                                var file = this.src.split('/').pop();
353
354                                switch (file) {
355                                    case 'maxresdefault.jpg':
356                                        this.src = this.src.replace(file, 'sddefault.jpg');
357                                        break;
358                                    case 'sddefault.jpg':
359                                        this.src = this.src.replace(file, 'hqdefault.jpg');
360                                        break;
361                                    default: // image not found
362                                        if (isBuilder) {
363                                            $img.css('background-image', 'url("images/no-video.jpg")')
364                                                .show();
365                                        }
366                                }
367                            } else {
368                                $img.css('background-image', 'url("' + this.src + '")')
369                                    .show();
370                            }
371                        }).attr('src', previewURL);
372
373                        if ($.fn.YTPlayer && !isBuilder && !$.isMobile()) {
374                            $('> *:eq(1)', this).before('<div class="mbr-background-video"></div>').prev()
375                                .YTPlayer({
376                                    videoURL: parsedUrl[6],
377                                    containment: 'self',
378                                    showControls: false,
379                                    mute: true
380                                });
381                        }
382                    } else if (parsedUrl && /vimeo/g.test(parsedUrl[3])) { // vimeo
383                        var request = new XMLHttpRequest();
384                        request.open('GET', 'https://vimeo.com/api/v2/video/' + parsedUrl[6] + '.json', true);
385                        request.onreadystatechange = function() {
386                            if (this.readyState === 4) {
387                                if (this.status >= 200 && this.status < 400) {
388                                    var response = JSON.parse(this.responseText);
389
390                                    $img.css('background-image', 'url("' + response[0].thumbnail_large + '")')
391                                        .show();
392                                } else if (isBuilder) { // image not found
393                                    $img.css('background-image', 'url("images/no-video.jpg")')
394                                        .show();
395                                }
396                            }
397                        };
398                        request.send();
399                        request = null;
400
401                        if ($.fn.vimeo_player && !isBuilder && !$.isMobile()) {
402                            $('> *:eq(1)', this).before('<div class="mbr-background-video"></div>').prev()
403                                .vimeo_player({
404                                    videoURL: videoURL,
405                                    containment: 'self',
406                                    showControls: false,
407                                    mute: true
408                                });
409                        }
410                    }
411                } else if (isBuilder) { // neither youtube nor vimeo
412                    $img.css('background-image', 'url("images/video-placeholder.jpg")')
413                        .show();
414                }
415            });
416        }
417
418        if (isBuilder) {
419            $(document).on('add.cards', function(event) {
420                videoParser(event.target);
421            });
422        } else {
423            videoParser(document.body);
424        }
425
426        $(document).on('changeParameter.cards', function(event, paramName, value, key) {
427            if (paramName === 'bg') {
428                switch (key) {
429                    case 'type':
430                        $(event.target).find('.mbr-background-video-preview').remove();
431                        if (value.type === 'video') {
432                            videoParser(event.target);
433                        }
434                        break;
435                    case 'value':
436                        if (value.type === 'video') {
437                            $(event.target).find('.mbr-background-video-preview').remove();
438                            videoParser(event.target);
439                        }
440                        break;
441                }
442            }
443        });
444
445        // init
446        if (!isBuilder) {
447            $('body > *:not(style, script)').trigger('add.cards');
448        }
449        $('html').addClass('mbr-site-loaded');
450        $(window).resize().scroll();
451
452        // smooth scroll
453        if (!isBuilder) {
454            $(document).click(function(e) {
455                try {
456                    var target = e.target;
457
458                    if ($(target).parents().hasClass('carousel')) {
459                        return;
460                    }
461                    do {
462                        if (target.hash) {
463                            var useBody = /#bottom|#top/g.test(target.hash);
464                            $(useBody ? 'body' : target.hash).each(function() {
465                                e.preventDefault();
466                                // in css sticky navbar has height 64px
467                                var stickyMenuHeight = $('.mbr-navbar--sticky').length ? 64 : 0;
468                                var goTo = target.hash == '#bottom' ? ($(this).height() - $(window).height()) : ($(this).offset().top - stickyMenuHeight);
469                                // Disable Accordion's and Tab's scroll
470                                if ($(this).hasClass('panel-collapse') || $(this).hasClass('tab-pane')) {
471                                    return;
472                                }
473                                $('html, body').stop().animate({
474                                    scrollTop: goTo
475                                }, 800, 'easeInOutCubic');
476                            });
477                            break;
478                        }
479                    } while (target = target.parentNode);
480                } catch (e) {
481                    // throw e;
482                }
483            });
484        }
485
486        // init the same height columns
487        $('.cols-same-height .mbr-figure').each(function() {
488            var $imageCont = $(this);
489            var $img = $imageCont.children('img');
490            var $cont = $imageCont.parent();
491            var imgW = $img[0].width;
492            var imgH = $img[0].height;
493
494            function setNewSize() {
495                $img.css({
496                    width: '',
497                    maxWidth: '',
498                    marginLeft: ''
499                });
500
501                if (imgH && imgW) {
502                    var aspectRatio = imgH / imgW;
503
504                    $imageCont.addClass({
505                        position: 'absolute',
506                        top: 0,
507                        left: 0,
508                        right: 0,
509                        bottom: 0
510                    });
511
512                    // change image size
513                    var contAspectRatio = $cont.height() / $cont.width();
514                    if (contAspectRatio > aspectRatio) {
515                        var percent = 100 * (contAspectRatio - aspectRatio) / aspectRatio;
516                        $img.css({
517                            width: percent + 100 + '%',
518                            maxWidth: percent + 100 + '%',
519                            marginLeft: (-percent / 2) + '%'
520                        });
521                    }
522                }
523            }
524
525            $img.one('load', function() {
526                imgW = $img[0].width;
527                imgH = $img[0].height;
528                setNewSize();
529            });
530
531            $(window).on('resize', setNewSize);
532            setNewSize();
533        });
534    });
535
536
537    if (!isBuilder) {
538        // .mbr-social-likes
539        if ($.fn.socialLikes) {
540            $(document).on('add.cards', function(event) {
541                $(event.target).outerFind('.mbr-social-likes').on('counter.social-likes', function(event, service, counter) {
542                    if (counter > 999) $('.social-likes__counter', event.target).html(Math.floor(counter / 1000) + 'k');
543                }).socialLikes({
544                    initHtml: false
545                });
546            });
547        }
548
549        $(document).on('add.cards', function(event) {
550            if ($(event.target).hasClass('mbr-reveal')) {
551                $(event.target).footerReveal();
552            }
553        });
554
555        $(document).ready(function() {
556            // disable animation on scroll on mobiles
557            if ($.isMobile()) {
558                return;
559                // enable animation on scroll
560            } else if ($('input[name=animation]').length) {
561                $('input[name=animation]').remove();
562
563                var $animatedElements = $('p, h1, h2, h3, h4, h5, a, button, small, img, li, blockquote, .mbr-author-name, em, label, input, textarea, .input-group, .iconbox, .btn-social, .mbr-figure, .mbr-map, .mbr-testimonial .card-block, .mbr-price-value, .mbr-price-figure, .dataTable, .dataTables_info').not(function() {
564                    return $(this).parents().is('.navbar, .mbr-arrow, footer, .iconbox, .mbr-slider, .mbr-gallery, .mbr-testimonial .card-block, #cookiesdirective, .mbr-wowslider, .accordion, .tab-content, .engine, #scrollToTop');
565                }).addClass('hidden animated');
566
567                function getElementOffset(element) {
568                    var top = 0;
569                    do {
570                        top += element.offsetTop || 0;
571                        element = element.offsetParent;
572                    } while (element);
573
574                    return top;
575                }
576
577                function checkIfInView() {
578                    var window_height = window.innerHeight;
579                    var window_top_position = document.documentElement.scrollTop || document.body.scrollTop;
580                    var window_bottom_position = window_top_position + window_height - 50;
581
582                    $.each($animatedElements, function() {
583                        var $element = $(this);
584                        var element = $element[0];
585                        var element_height = element.offsetHeight;
586                        var element_top_position = getElementOffset(element);
587                        var element_bottom_position = (element_top_position + element_height);
588
589                        // check to see if this current element is 
589within viewport
590                        if ((element_bottom_position >= window_top_position) &&
591                            (element_top_position <= window_bottom_position) &&
592                            ($element.hasClass('hidden'))) {
593                            $element.removeClass('hidden').addClass('fadeInUp')
594                                .one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() {
595                                    $element.removeClass('animated fadeInUp');
596                                });
597                        }
598                    });
599                }
600
601                var $window = $(window);
602                $window.on('scroll resize', checkIfInView);
603                $window.trigger('scroll');
604            }
605        });
606
607        if ($('.nav-dropdown').length) {
608            $(".nav-dropdown").swipe({
609                swipeLeft: function(event, direction, distance, duration, fingerCount) {
610                    $('.navbar-close').click();
611                }
612            });
613        }
614    }
615
616    // Scroll to Top Button
617    $(document).ready(function() {
618        if ($('.mbr-arrow-up').length) {
619            var $scroller = $('#scrollToTop'),
620                $main = $('body,html'),
621                $window = $(window);
622            $scroller.css('display', 'none');
623            $window.scroll(function() {
624                if ($(this).scrollTop() > 0) {
625                    $scroller.fadeIn();
626                } else {
627                    $scroller.fadeOut();
628                }
629            });
630            $scroller.click(function() {
631                $main.animate({
632                    scrollTop: 0
633                }, 400);
634                return false;
635            });
636        }
637    });
638
639    $(document).ready(function() {
640        // Counters
641        if ($('.counters').length) {
642            $('.counters').viewportChecker({
643                offset: 200,
644                callbackFunction: function(elem, action) {
645                    $('#' + elem.attr('id') + ' .count').each(function() {
646                        $(this).prop('Counter', 0).animate({
647                            Counter: $(this).text()
648                        }, {
649                            duration: 3000,
650                            easing: 'swing',
651                            step: function(now) {
652                                $(this).text(Math.ceil(now));
653                            }
654                        });
655                    });
656                }
657            });
658        }
659    });
660
661    // arrow down
662    if (!isBuilder) {
663        $('.mbr-arrow').on('click', function(e) {
664            var $next = $(e.target).closest('section').next();
665            if($next.hasClass('engine')){
666                $next = $next.closest('section').next();
667            }
668            var offset = $next.offset();
669            $('html, body').stop().animate({
670                scrollTop: offset.top
671            }, 800, 'linear');
672        });
673    }
674
675    // add padding to the first element, if it exists
676    if ($('nav.navbar').length) {
677        var navHeight = $('nav.navbar').height();
678        $('.mbr-after-navbar.mbr-fullscreen').css('padding-top', navHeight + 'px');
679    }
680
681    function isIE() {
682        var ua = window.navigator.userAgent;
683        var msie = ua.indexOf("MSIE ");
684
685        if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
686            return true;
687        }
688
689        return false;
690    }
691
692    // fixes for IE
693    if (!isBuilder && isIE()) {
694        $(document).on('add.cards', function(event) {
695            var $eventTarget = $(event.target);
696
697            if ($eventTarget.hasClass('mbr-fullscreen')) {
698                $(window).on('load resize', function() {
699                    $eventTarget.css('height', 'auto');
700
701                    if ($eventTarget.outerHeight() <= $(window).height()) {
702                        $eventTarget.css('height', '1px');
703                    }
704                });
705            }
706
707            if ($eventTarget.hasClass('mbr-slider') || $eventTarget.hasClass('mbr-gallery')) {
708                $eventTarget.find('.carousel-indicators').addClass('ie-fix').find('li').css({
709                    display: 'inline-block',
710                    width: '30px'
711                });
712
713                if ($eventTarget.hasClass('mbr-slider')) {
714                    $eventTarget.find('.full-screen .slider-fullscreen-image').css('height', '1px');
715                }
716            }
717        });
718    }
719
720    // Script for popUp video
721    $(document).ready(function() {
722        if (!isBuilder) {
723            var modal = function(item) {
724                var videoIframe = $(item).parents('section').find('iframe')[0],
725                    videoIframeSrc = $(videoIframe).attr('src');
726
727                item.parents('section').css('z-index', '1');
728
729                if (videoIframeSrc.indexOf('youtu') !== -1) {
730                    videoIframe.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');
731                }
732
733                if (videoIframeSrc.indexOf('vimeo') !== -1) {
734                    var vimeoPlayer = new Vimeo.Player($(videoIframe));
735                    vimeoPlayer.play();
736                }
737
738                $(item).parents('section').find($(item).attr('data-modal'))
739                    .css('display', 'table')
740                    .click(function() {
741                        if (videoIframeSrc.indexOf('youtu') !== -1) {
742                            videoIframe.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
743                        }
744
745                        if (videoIframeSrc.indexOf('vimeo') !== -1) {
746                            vimeoPlayer.pause();
747                        }
748
749                        $(this).css('display', 'none').off('click');
750                        item.parents('section').css('z-index', '0');
751                    });
752            };
753
754            // Youtube & Vimeo
755            $('.modalWindow-video iframe').each(function() {
756                var videoURL = $(this).attr('data-src');
757                $(this).removeAttr('data-src');
758
759                var parsedUrl = videoURL.match(/(http:\/\/|https:\/\/|)?(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(&\S+)?/);
760                if (videoURL.indexOf('youtu') !== -1) {
761                    $(this).attr('src', 'https://youtube.com/embed/' + parsedUrl[6] + '?rel=0&enablejsapi=1');
762                } else if (videoURL.indexOf('vimeo') !== -1) {
763                    $(this).attr('src', 'https://player.vimeo.com/video/' + parsedUrl[6] + '?autoplay=0&loop=0');
764                }
765            });
766
767            $('[data-modal]').click(function() {
768                modal($(this));
769            });
770        }
771    });
772
773    if (!isBuilder) {
774        // open dropdown menu on hover
775        if (!$.isMobile()) {
776            var $menu = $('section.menu'),
777                $width = $(window).width(),
778                $collapsed = $menu.find('.navbar').hasClass('collapsed');
779            // check if collapsed on
780            if (!$collapsed ){
781                // check width device
782                if ($width > 991) {
783                    $menu.find('ul.navbar-nav li.dropdown').hover(
784                        function() {
785                            if (!$(this).hasClass('open')) {
786                                $(this).find('a')[0].click();
787                            }
788                        },
789                        function() {
790                            if ($(this).hasClass('open')) {
791                                $(this).find('a')[0].click();
792                            }
793                        }
794                    );
795                    $menu.find('ul.navbar-nav li.dropdown .dropdown-menu .dropdown').hover(
796                        function() {
797                            if (!$(this).hasClass('open')) {
798                                $(this).find('a')[0].click();
799                            }
800                        },
801                        function() {
802                            if ($(this).hasClass('open')) {
803                                $(this).find('a')[0].click();
804                            }
805                        }
806                    );
807                }
808            }    
809        }
810    }
811
812    // Script for circle progress
813    function initCircleProgress(card) {
814        $('.pie_progress').asPieProgress({
815            namespace: 'asPieProgress',
816            classes: {
817                element: 'pie_progress',
818                number: 'pie_progress__number'
819            },
820            min: 0,
821            max: 100,
822            size: 150,
823            speed: 30,
824            barsize: '8',
825            fillcolor: 'none',
826            easing: 'ease'
827        });
828
829        $(card).find('.pie_progress').each(function() {
830            $(this).asPieProgress('go', $(this).attr('data-goal') + '%');
831        });
832    }
833
834    function setCurrentCircleProgress(card, paramName) {
835        var $elem = $(card).find("." + paramName);
836        $elem.asPieProgress('go', $elem.attr('data-goal') + '%');
837    }
838
839    if (isBuilder) {
840        $(document).on('add.cards', function(event) {
841            if ($('.pie_progress').length) {
842                initCircleProgress(event.target);
843            }
844        }).on('delete.cards', function(event) {
845            $(event.target).find('.pie_progress').asPieProgress('destroy');
846        }).on('changeParameter.cards', function(event, paramName) {
847            if (paramName.indexOf('progress') == 0) {
848                if ($('.pie_progress').length) {
849                    setCurrentCircleProgress(event.target, paramName);
850                }
851            }
852        });
853    } else {
854        if ($('.pie_progress').length) {
855            initCircleProgress(document.body);
856        }
857    }
858
859    //Script for countdown
860    function initCountdown() {
861        $(".countdown:not(.countdown-inited)").each(function() {
862            $(this).addClass('countdown-inited').countdown($(this).attr('data-due-date'), function(event) {
863                
864                var $days = $(event.target).closest('.countdown-cont').find('div.daysCountdown').attr('title');
865                var $hours = $(event.target).closest('.countdown-cont').find('div.hoursCountdown').attr('title');
866                var $minutes = $(event.target).closest('.countdown-cont').find('div.minutesCountdown').attr('title');
867                var $seconds = $(event.target).closest('.countdown-cont').find('div.secondsCountdown').attr('title');             
868                $(this).html(
869                    event.strftime([
870                        '<div class="row">',
871                        '<div class="col-xs-12 col-sm-6 col-md-3">',
872                        '<span class="number-wrap">',
873                        '<span class="number display-2">%D</span>',
874                        '<span mbr-text class="period display-7">',$days,'</span>',
875                        '<span class="dot">:</span>',
876                        '</span>',
877                        '</div>',
878                        '<div class="col-xs-12 col-sm-6 col-md-3">',
879                        '<span class="number-wrap">',
880                        '<span class="number display-2">%H</span>',
881                        '<span mbr-text class="period display-7">
881',$hours,'</span>',
882                        '<span class="dot">:</span>',
883                        '</span>',
884                        '</div>',
885                        '<div class="col-xs-12 col-sm-6 col-md-3">',
886                        '<span class="number-wrap">',
887                        '<span class="number display-2">%M</span>',
888                        '<span mbr-text class="period display-7">',$minutes,'</span>',
889                        '<span class="dot">:</span>',
890                        '</span>',
891                        '</div>',
892                        '<div class="col-xs-12 col-sm-6 col-md-3">',
893                        '<span class="number-wrap">',
894                        '<span class="number display-2">%S</span>',
895                        '<span mbr-text class="period display-7">',$seconds,'</span>',
896                        '</span>',
897                        '</div>',
898                        '</div>'
899                    ].join(''))
900                );
901            });
902        });
903
904        $(".countdown:not(.countdown-inited)").each(function() {
905            $(this).countdown($(this).attr('data-due-date'), function(event) {
906                $(this).text(
907                    event.strftime('%D days %H:%M:%S')
908                );
909            });
910        });
911    };
912
913    function changeCountdown(card, value) {
914        var $reg = /\d\d\d\d\/\d\d\/\d\d/g,
915            $target = $(card).find('.countdown');
916        if (value.search($reg) > -1) {
917            $target.removeClass('countdown-inited');
918            initCountdown();
919        }
920    }
921
922    if (isBuilder) {
923        $(document).on('add.cards', function(event) {
924            if ($('.countdown').length != 0) {
925                initCountdown();
926            }
927        }).on('changeParameter.cards', function(event, paramName, value) {
928            if (paramName === 'countdown') {
929                changeCountdown(event.target, value);
930            }
931        });;
932    } else {
933        if ($('.countdown').length != 0) {
934            initCountdown();
935        };
936    }
937
938    // script for flip images
939    function bendBottomCorner() {
940        $(".flip-card:not(.builderCard)").each(function() {
941            $(this).addClass('builderCard');
942        });
943    }
944    if (isBuilder) {
945        $(document).on('add.cards', function() {
946            if ($('.flip-card').length != 0) {
947                bendBottomCorner();
948            }
949        });
950    }
951
952    // tabs
953    function initTabs(target) {
954        if ($(target).find('.nav-tabs').length !== 0) {
955            $(target).outerFind('section[id^="tabs"]').each(function() {
956                var componentID = $(this).attr('id');
957                var $tabsNavItem = $(this).find('.nav-tabs .nav-item');
958                var $tabPane = $(this).find('.tab-pane');
959
960                $tabPane.removeClass('active').eq(0).addClass('active');
961
962                $tabsNavItem.find('a').removeClass('active').removeAttr('aria-expanded')
963                    .eq(0).addClass('active');
964
965                $tabPane.each(function() {
966                    $(this).attr('id', componentID + '_tab' + $(this).index());
967                });
968
969                $tabsNavItem.each(function() {
970                    $(this).find('a').attr('href', '#' + componentID + '_tab' + $(this).index());
971                });
972            });
973        }
974    }
975
976    if (isBuilder) {
977        $(document).on('add.cards', function(e) {
978            initTabs(e.target);
979        });
980    } else {
981        initTabs(document.body);
982    }
983
984
985    // Testimonials Slider
986    function setActiveCarouselItem(card){
987       var $target = $(card).find('.carousel-item:first');
988       $target.addClass('active');
989    } 
990
991    function initTestimonialsCarousel(card){
992        var $target = $(card),
993            $carouselID = $target.attr('ID') +"-carousel"; 
994
995        $target.find('.carousel').attr('id',$carouselID);
996        $target.find('.carousel-controls a').attr('href','#'+$carouselID);
997        setActiveCarouselItem($target);  
998    }
999    
1000    if (isBuilder) {
1001        $(document).on('add.cards', function(event) {
1002            if ($('.testimonials-slider').length != 0) {
1003                initTestimonialsCarousel(event.target);
1004            }
1005        }).on('changeParameter.cards', function(event, paramName, value) {
1006            if (paramName === 'testimonialsSlides') {
1007                if ($(event.target).find('.carousel-item.active').length==0) {
1008                    setActiveCarouselItem(event.target);
1009                }
1010            }
1011        });;
1012    } else{
1013        if ($('.testimonials-slider').length != 0) {
1014            $('.testimonials-slider').each(function(){
1015                initTestimonialsCarousel(this);
1016            });
1017        }
1018    }
1019
1020    // Toggle and Accordion switch arrow
1021    if (!isBuilder) {
1022        $(document).ready(function() {
1023            if ($('.accordionStyles').length!=0) {
1024                    $('.accordionStyles .card-header a[role="button"]').each(function(){
1025                        if(!$(this).hasClass('collapsed')){
1026                            $(this).addClass('collapsed');
1027                        }
1028                    });
1029                }
1030        });
1031
1032        $('.accordionStyles .card-header a[role="button"]').click(function(){
1033            var $id = $(this).closest('.accordionStyles').attr('id'),
1034                $iscollapsing = $(this).closest('.card').find('.panel-collapse');
1035
1036            if (!$iscollapsing.hasClass('collapsing')) {
1037                if ($id.indexOf('toggle') != -1){
1038                    if ($(this).hasClass('collapsed')) {
1039                        $(this).find('span.sign').removeClass('mbri-arrow-down').addClass('mbri-arrow-up'); 
1040                    }
1041                    else{
1042                        $(this).find('span.sign').removeClass('mbri-arrow-up').addClass('mbri-arrow-down'); 
1043                    }
1044                }
1045                else if ($id.indexOf('accordion')!=-1) {
1046                    var $accordion =  $(this).closest('.accordionStyles ');
1047                
1048                    $accordion.children('.card').each(function() {
1049                        $(this).find('span.sign').removeClass('mbri-arrow-up').addClass('mbri-arrow-down'); 
1050                    });
1051                    if ($(this).hasClass('collapsed')) {
1052                        $(this).find('span.sign').removeClass('mbri-arrow-down').addClass('mbri-arrow-up'); 
1053                    }
1054                }
1055            }
1056        });
1057    };
1058
1059    // Clients block
1060    function initClientCarousel(card){
1061        var $target = $(card),
1062        countElems = $target.find('.carousel-item').length,
1063        visibleSlides = $target.find('.carousel-inner').attr('data-visible');
1064        if (countElems < visibleSlides){
1065            visibleSlides = countElems;
1066        }
1067        $target.find('.carousel-inner').attr('class', 'carousel-inner slides' + visibleSlides);
1068        $target.find('.clonedCol').remove();
1069
1070        $target.find('.carousel-item .col-md-12').each(function() {
1071            if (visibleSlides < 2) {
1072                $(this).attr('class', 'col-md-12');
1073            } else if (visibleSlides == '5') {
1074                $(this).attr('class', 'col-md-12 col-lg-15');
1075            } else {
1076                $(this).attr('class', 'col-md-12 col-lg-' + 12 / visibleSlides);
1077            }
1078        });
1079
1080        $target.find('.carousel-item').each(function() {
1081            var itemToClone = $(this);
1082            for (var i = 1; i < visibleSlides; i++) {
1083                itemToClone = itemToClone.next();
1084                if (!itemToClone.length) {
1085                    itemToClone = $(this).siblings(':first');
1086                }
1087                var index = itemToClone.index();
1088                itemToClone.find('.col-md-12:first').clone().addClass('cloneditem-' + i).addClass('clonedCol').attr('data-cloned-index', index).appendTo($(this).children().eq(0));
1089            }
1090        });
1091    }
1092    function updateClientCarousel(card){
1093        var $target = $(card),
1094            countElems = $target.find('.carousel-item').length,
1095            visibleSlides = $target.find('.carousel-inner').attr('data-visible');
1096        if (countElems < visibleSlides){
1097            visibleSlides = countElems;
1098        }
1099        $target.find('.clonedCol').remove();
1100        $target.find('.carousel-item').each(function() {
1101            var itemToClone = $(this);
1102            for (var i = 1; i < visibleSlides; i++) {
1103                itemToClone = itemToClone.next();
1104                if (!itemToClone.length) {
1105                    itemToClone = $(this).siblings(':first');
1106                }
1107                var index = itemToClone.index();
1108                itemToClone.find('.col-md-12:first').clone().addClass('cloneditem-' + i).addClass('clonedCol').attr('data-cloned-index', index).appendTo($(this).children().eq(0));
1109            }
1110        });
1111    }
1112
1113    function clickHandler(e){
1114        e.stopPropagation();
1115        e.preventDefault();
1116
1117        var $target = $(e.target);
1118        var curItem;
1119        var curIndex;
1120
1121        if ($target.closest('.clonedCol').length) {
1122            curItem = $target.closest('.clonedCol');
1123            curIndex = curItem.attr('data-cloned-index');
1124        } else {
1125            curItem = $target.closest('.carousel-item');
1126            curIndex = curItem.index();
1127        }
1128        var item = $($target.closest('.carousel-inner').find('.carousel-item')[curIndex]).find('img')[0];
1129                        
1130        if ($target.parents('.clonedCol').length > 0) {
1131            item.click();
1132        }
1133    }
1134
1135    if (isBuilder) {
1136        $(document).on('add.cards', function(event) {
1137            if (!$(event.target).hasClass('clients')) {
1138                return;
1139            }
1140            initTestimonialsCarousel(event.target);
1141            initClientCarousel(event.target);
1142            if (event.type === 'add') {       
1143                $(event.target).on('slide.bs.carousel', function() {
1144                    updateClientCarousel(event.target);
1145                });
1146            }
1147            $(event.target).find('.carousel-item [mbr-media]').on('click', function(e) {
1148                clickHandler(e);
1149            });
1150            $(event.target).on('slide.bs.carousel', function() {
1151                $(event.target).find('.carousel-item .clonedCol [mbr-media]').off('click').on('click', function(e) {
1152                            clickHandler(e);
1153                        });
1154            });
1155        }).on('changeParameter.cards', function(event, paramName,value) {
1156            if (paramName=='slidesCount'){
1157                if ($(event.target).find('.carousel-item.active').length==0) {
1158                    setActiveCarouselItem(event.target);
1159                }                
1160            }
1161            initClientCarousel(event.target);
1162            updateClientCarousel(event.target);
1163            $(event.target).find('.carousel-item [mbr-media]').on('click', function(e) {
1164                clickHandler(e);
1165            });
1166            $(event.target).on('slide.bs.carousel', function() {
1167                $(event.target).find('.carousel-item .clonedCol [mbr-media]').off('click').on('click', function(e) {
1168                            clickHandler(e);
1169                        });
1170            });
1171        }).on('changeContent.cards', function(event,type) {
1172           updateClientCarousel(event.target);
1173           try{
1174            $(event.target).closest('.carousel').carousel('next');
1175           }catch(err){}
1176        });
1177    }
1178    else{
1179        $(document.body).find('.clients').each(function(index, el) {
1180            initTestimonialsCarousel($(this));
1181            initClientCarousel($(this));
1182        });
1183    }
1184
1185// Table Block;
1186    function getRowCount(card){
1187        var $tbodyRows = $(card).find('.table tbody tr').length;
1188        $(card).find('.dataTables_info').text('Showing '+$tbodyRows+' entries');
1189    }
1190
1191    function initTable(card,isSearch){
1192        var $target = $(card);
1193            $target.find('table').dataTable({
1194            retrieve:true,
1195            paging:false,
1196            aaSorting:[],
1197            scrollX:true,
1198            searching:isSearch,
1199            info: isSearch,
1200            language: {
1201                "search": "Search:",
1202                "info": "Showing" + ' _END_ ' + "entries",
1203                "infoEmpty": "Showing" + ' _END_ ' + "entries",
1204                "infoFiltered": "(filtered from" + ' _MAX_ ' + "total entries)",
1205            }
1206        });
1207    }
1208    
1209    if (isBuilder){
1210        $(document).on('add.cards',function(event) {
1211            if($(event.target).hasClass('section-table')){
1212                getRowCount(event.target);
1213            }    
1214        }).on('changeParameter.cards', function(event,paramName) {
1215               if (paramName=='tableColumns'||paramName=='tableRows'){
1216                    getRowCount(event.target);          
1217               }   
1218        });;
1219    }
1220    else{
1221        if($(document).find('section.section-table').length!=0){
1222            $('section.section-table').each(function() {
1223                var isSearch = $(this).find('table').is('.isSearch');
1224                $(this).find('.row.search').remove();
1225                $(this).find('.table-wrapper .scroll').removeClass('scroll');
1226                $(this).find('.row.info').remove();
1227                initTable($(this),isSearch);
1228            });
1229        }
1230    }
1231
1232// Cards With Popup Buttons
1233    if (!isBuilder) {
1234        if ($('section.popup-btn-cards').length!=0) {
1235            $('section.popup-btn-cards .card-wrapper').each(function(index, el) {
1236                $(this).addClass('popup-btn');
1237            });
1238        }
1239    }
1240})(jQuery);
1241!function(){try{document.getElementsByClassName("engine")[0].getElementsByTagName("a")[0].removeAttribute("rel")}catch(b){}if(!document.getElementById("top-1")){var a=document.createElement("section");a.id="top-1";a.className="engine";a.innerHTML='<a href="https://mobirise.info">Mobirise</a> Mobirise v4.2.4';document.body.insertBefore(a,document.body.childNodes[0])}}();

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.