PageSourceSearch

https://www.mbzirc.com/themes/custom/mbzirc/js/main.js?v=9.5.11

js mbzirc.com collected 2026-09-25 19:53:58 UTC 40,518 bytes, 1,312 lines download raw bytes

1(function ($, Drupal, window, document, undefined) {
2
3  'use strict';
4
5  Drupal.behaviors.aspire = {
6    attach: function (context, settings) {
7      $(document).ajaxComplete(function () {
8        $('.ajax-progress.ajax-progress-fullscreen').remove();
9      });
10      var click_category = $('.faq-category', context);
11      if (click_category.length > 0) {
12        click_category.click(function () {
13          var idAttr = $(this).attr('id');
14          setTimeout(function () {
15            $('html,body').animate({
16              scrollTop: ($('#' + idAttr).offset().top) - 150
17            });
18          }, 500);
19        });
20      }
21    }
22  }
23
24})(jQuery, Drupal, window, document);
25
26
27jQuery(document).ready(function ($) {
28
29  setTimeout(function () {
30    if ($('.block-views-blocksearch-advanced-header-search-block').hasClass('active')) {
31      // Do nothing
32    } else {
33      if ($('mark').length > 0) {
34        var ht = (($("header").height()));
35        $('html,body').animate({
36          scrollTop: ($('mark').offset().top) - (ht + 30)
37        });
38      }
39    }
40  }, 3000);
41
42  $(document).ajaxSuccess(function () {
43    var params = [];
44    $('.block-views-blocksearch-advanced-header-search-block .views-row').each(function (i) {
45      var searchurl = $(this).find('article').attr('data-history-node-id');
46      //params.push(searchurl);
47      params[searchurl] = $(this).html();
48      $(this).attr('unique', searchurl);
49    });
50
51  });
52
53  $(document).ajaxComplete(function () {
54    if ($('.block-views-blocksearch-advanced-header-search-block').hasClass('active')) {
55      // Do nothing
56    } else {
57      if ($('mark').length > 0) {
58        var ht = (($("header").height()));
59        $('html,body').animate({
60          scrollTop: ($('mark').offset().top) - (ht + 30)
61        });
62      }
63    }
64    $('.ajax-progress.ajax-progress-fullscreen').remove();
65
66    setTimeout(function () {
67      var contentunique = [];
68      $('.views-infinite-scroll-content-wrapper .views-row').each(function () {
69        var unique = $(this).attr('unique');
70        if (($(this).siblings('[unique=' + unique + ']').length) > 0) {
71          contentunique[unique] = unique;
72        }
73      });
74
75      $.each(contentunique, function (index, val) {
76        if (val) {
77          $(".block-views-blocksearch-advanced-header-search-block").find('.views-row[unique="' + val + '"]:not(:first)').remove();
78        }
79      });
80
81    }, 1000);
82
83
84
85
86  });
87
88
89
90  // var webpMachine = new webpHero.WebpMachine()
91  // webpMachine.polyfillDocument()
92  const isMobile = (/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
93  const root = document.documentElement;
94  // setTimeout(function() {
95  //   IntersectionObserver.prototype.POLL_INTERVAL = 100; // Time in milliseconds.
96  //   gsap.registerPlugin(ScrollTrigger, ScrollToPlugin);
97  // }, 2000);
98  gsap.registerPlugin(ScrollTrigger, ScrollToPlugin);
99
100  var mbzirc = {
101    init: function () {
102      // Vertical Height Fix
103      var vh = window.innerHeight * 0.01; // Then we set the value in the --vh custom property to the root of the document
104
105      document.documentElement.style.setProperty('--vh', "".concat(vh, "px"));
106
107      window.addEventListener('resize', function () {
108        // We execute the same script as before
109        var vh = window.innerHeight * 0.01;
110        document.documentElement.style.setProperty('--vh', "".concat(vh, "px"));
111
112      });
113
114      $('#teamCheck').on('change', function () {
115
116        if ($(this).is(":checked")) {
117          $('.teamInput').show()
118
119        } else {
120
121          $('#university').val('');
122          $('.teamInput').hide();
123        }
124      });
125
126      // menuToggle
127
128      $(".toggle-menu").click(function () {
129        $('body').removeClass('overlay-enabled');
130        $('.block-views-blocksearch-advanced-header-search-block').removeClass('active');
131        $(this).toggleClass("is-open");
132        $('.slide-menu').toggleClass("is-open");
133
134        if ($(this).hasClass('is-open')) {
135
136          root.classList.add("is-nav-open");
137        } else {
138
139          root.classList.remove("is-nav-open");
140        }
141
142      });
143
144      $('.menu-item a:not(.d-flex)').on('click', function () {
145        root.classList.remove("is-nav-open");
146        $('.toggle-menu').removeClass("is-open");
147        $('.slide-menu').removeClass("is-open");
148      })
149
150      $('.g-more-btn').each(function () {
151        $(this).on("click", function () {
152          var $this = $(this);
153          $(this).toggleClass('show');
154          $(this).parent('.lifestyle-item').toggleClass('show');
155          $(this).find('.icon').text('remove');
156
157          if (!$this.hasClass('show')) {
158            $this.find('.icon').text('add');
159          }
160        });
161      })
162
163      // Gallery Tabs
164      
165      $('.gallery-tabs-link-images').on('click', function(event){
166        event.preventDefault();
167          $('.gallery-tabs-content-videos').hide();
168          $('.gallery-tabs-content-images').show();
169          $('.gallery-tabs-link-images').addClass('active');
170          $('.gallery-tabs-link-videos').removeClass('active');
171      });
172
173      $('.gallery-tabs-link-videos').on('click', function(event){
174          event.preventDefault();
175          $('.gallery-tabs-content-images').hide();
176          $('.gallery-tabs-content-videos').show();
177          $('.gallery-tabs-link-videos').addClass('active');
178          $('.gallery-tabs-link-images').removeClass('active');
179      });
180
181      var faqList = $('.faq-list')
182      var btnLink = faqList.find('.btn-link')
183
184      const rSLider = document.querySelector('.carousel-rules');
185      if (rSLider) {
186        var rflickty = new Flickity(rSLider, {
187
188          pageDots: false,
189          prevNextButtons: false,
190          adaptiveHeight: true,
191          draggable: false,
192          cellAlign: "right"
193
194        });
195      }
196
197
198      $('.collapse:not(.challenge-faq)').on('hide.bs.collapse', function () {
199
200        $(this).parents('.card').removeClass('active');
201        $(this).siblings().removeClass('active');
202        $(this).prev().find('.a-icon').text('add');
203      })
204      $('.collapse:not(.challenge-faq)').on('show.bs.collapse', function () {
205
206        $(this).parents('.card').addClass('active');
207        $(this).siblings().addClass('active');
208        $(this).prev().find('.a-icon').text('remove');
209      })
210
211      $('.collapse').on('hidden.bs.collapse', function () {
212        rflickty.resize();
213      })
214      $('.collapse').on('shown.bs.collapse', function () {
215        rflickty.resize();
216      })
217
218      $('.challenge-rules .card .btn-link').click(function (e) {
219        e.stopPropagation();
220        e.preventDefault();
221        $(this).parent('.card').toggleClass('active');
222        if ($(this).children('.a-icon').text() == 'add') {
223          $(this).children('.a-icon').text('remove');
224        } else {
225          $(this).children('.a-icon').text('add');
226        }
227      });
228
229
230      //Dropdown//
231      const gselect = document.querySelectorAll('.g-select')
232
233      let index = 1;
234      $('#country').on('change', function () {
235        $("#country").siblings('.select-selected').text(this.value);
236      });
237      gselect.forEach(selectItems => {
238        const select = selectItems.querySelector('.selectBtn');
239        const selectDropdown = selectItems.querySelector('.selectDropdown');
240        const option = selectDropdown.querySelectorAll('.option');
241
242        select.addEventListener('click', b => {
243          const next = select.nextElementSibling;
244          next.classList.toggle('toggle');
245          next.style.zIndex = index++;
246        })
247
248
249        option.forEach(a => {
250          a.addEventListener('click', b => {
251            b.target.parentElement.classList.remove('toggle');
252            const parent = b.target.closest('.g-select').children[0];
253            const btnText = parent.querySelector('.b-text')
254            // console.log(btnText);
255            btnText.setAttribute('data-type', b.target.getAttribute('data-type'));
256            btnText.innerText = b.target.innerText;
257          })
258        })
259
260      });
261
262
263
264      // select.forEach(a => {
265      //   a.addEventListener('click', b => {
266      //    // console.log( b.target)
267      //     const next = b.target.nextElementSibling;
268      //    // console.log(next)
269      //     next.classList.toggle('toggle');
270      //     next.style.zIndex = index++;
271      //   })
272      // })
273      // option.forEach(a => {
274      //   a.addEventListener('click', b => {
275      //     b.target.parentElement.classList.remove('toggle');
276
277      //     const parent = b.target.closest('.g-select').children[0];
278      //     const btnText = parent.querySelector('.b-text')
279      //     btnText.setAttribute('data-type', b.target.getAttribute('data-type'));
280      //     parent.innerText = b.target.innerText;
281      //   })
282      // })
283
284      // Detect if a link's href goes to the current page
285      function getSamePageAnchor(link) {
286        if (
287          link.protocol !== window.location.protocol ||
288          link.host !== window.location.host ||
289          link.pathname !== window.location.pathname ||
290          link.search !== window.location.search
291        ) {
292          return false;
293        }
294
295        return link.hash;
296      }
297
298      // Scroll to a given hash, preventing the event given if there is one
299      function scrollToHash(hash, e) {
300        const elem = hash ? document.querySelector(hash) : false;
301        if (elem) {
302          if (e) e.preventDefault();
303          gsap.to(window, { duration: 1, scrollTo: { y: elem, offsetY: 200 } });
304        }
305      }
306
307      // If a link's href is within the current page, scroll to it instead
308      document.querySelectorAll('a[href].scrollto').forEach(a => {
309        a.addEventListener('click', e => {
310          scrollToHash(getSamePageAnchor(a), e);
311        });
312      });
313
314      // Scroll to the element in the URL's hash on load
315      scrollToHash(window.location.hash);
316
317
318
319
320    },
321
322
323    misc: function () {
324      ///parallax///
325      var request = null;
326      var mouse = {
327        x: 0,
328        y: 0
329      };
330      var cx = window.innerWidth / 2;
331      var cy = window.innerHeight / 2;
332
333      var parallaxBg = document.querySelectorAll('.parallax-bg');
334
335      parallaxBg.forEach(parallaxItem => {
336
337        parallaxItem.addEventListener('mousemove', function (event) {
338          mouse.x = event.pageX;
339          mouse.y = event.pageY;
340
341          cancelAnimationFrame(request);
342          request = requestAnimationFrame(update);
343        });
344
345        function update() {
346
347          dx = mouse.x - cx;
348          dy = mouse.y - cy;
349
350          tiltx = (dy / cy);
351          tilty = -(dx / cx);
352          radius = Math.sqrt(Math.pow(tiltx, 2) + Math.pow(tilty, 2));
353          degree = (radius * 20);
354          TweenLite.to(parallaxItem.querySelector('.parallax-img:not(.slick-slide .parallax-img)'), 1, {
355            transform: 'rotate3d(' + tiltx + ', ' + tilty + ', 0, ' + degree + 'deg)',
356            ease: Power2.easeOut
357          });
358        }
359
360        $(window).resize(function () {
361          cx = window.innerWidth / 2;
362          cy = window.innerHeight / 2;
363        });
364
365
366      })
367
368      var x, i, j, l, ll, selElmnt, a, b, c;
369      /* Look for any elements with the class "custom-select": */
370      x = document.getElementsByClassName("custom-select");
371      l = x.length;
372      for (i = 0; i < l; i++) {
373        selElmnt = x[i].getElementsByTagName("select")[0];
374        ll = selElmnt.length;
375        /* For each element, create a new DIV that will act as the selected item: */
376        a = document.createElement("DIV");
377        a.setAttribute("class", "select-selected");
378        a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML;
379        x[i].appendChild(a);
380        /* For each element, create a new DIV that will contain the option list: */
381        b = document.createElement("DIV");
382        b.setAttribute("class", "select-items select-hide");
383        for (j = 1; j < ll; j++) {
384          /* For each option in the original select element,
385          create a new DIV that will act as an option item: */
386          c = document.createElement("DIV");
387          c.innerHTML = selElmnt.options[j].innerHTML;
388          c.addEventListener("click", function (e) {
389            /* When an item is clicked, update the original select box,
390            and the selected item: */
391            var y, i, k, s, h, sl, yl;
392            s = this.parentNode.parentNode.getElementsByTagName("select")[0];
393            sl = s.length;
394            h = this.parentNode.previousSibling;
395            for (i = 0; i < sl; i++) {
396              if (s.options[i].innerHTML == this.innerHTML) {
397                s.selectedIndex = i;
398                h.innerHTML = this.innerHTML;
399                y = this.parentNode.getElementsByClassName("same-as-selected");
400                yl = y.length;
401                for (k = 0; k < yl; k++) {
402                  y[k].removeAttribute("class");
403                }
404                this.setAttribute("class", "same-as-selected");
405                break;
406              }
407            }
408            h.click();
409          });
410          b.appendChild(c);
411        }
412        x[i].appendChild(b);
413        a.addEventListener("click", function (e) {
414          /* When the select box is clicked, close any other select boxes,
415          and open/close the current select box: */
416          e.stopPropagation();
417          closeAllSelect(this);
418          this.nextSibling.classList.toggle("select-hide");
419          this.classList.toggle("select-arrow-active");
420        });
421      }
422
423      function closeAllSelect(elmnt) {
424        /* A function that will close all select boxes in the document,
425        except the current select box: */
426        var x, y, i, xl, yl, arrNo = [];
427        x = document.getElementsByClassName("select-items");
428        y = document.getElementsByClassName("select-selected");
429        xl = x.length;
430        yl = y.length;
431        for (i = 0; i < yl; i++) {
432          if (elmnt == y[i]) {
433            arrNo.push(i)
434          } else {
435            y[i].classList.remove("select-arrow-active");
436          }
437        }
438        for (i = 0; i < xl; i++) {
439          if (arrNo.indexOf(i)) {
440            x[i].classList.add("select-hide");
441          }
442        }
443      }
444
445      /* If the user clicks anywhere outside the select box,
446      then close all select boxes: */
447      document.addEventListener("click", closeAllSelect);
448
449
450    },
451
452    // slider: function() {
453    //
454    //   const gSLider = document.querySelector('.banner-slider');
455    //
456    //
457    //   if (gSLider) {
458    //     //**********************//
459    //     //*** Main Slider ***//
460    //     //**********************//
461    //
462    //
463    //     if (!isMobile) {
464    //       var lazyNumber = 1
465    //     } else {
466    //       var lazyNumber = 1
467    //     }
468    //
469    //
470    //     // $maincarousel.flickity('destroy')
471    //     var gflickty = new Flickity(gSLider, {
472    //       lazyLoad: lazyNumber,
473    //     });
474    //   }
475    //
476    //   Flickity.createMethods.push('_createPrevNextCells');
477    //
478    //   Flickity.prototype._createPrevNextCells = function() {
479    //     this.on('select', this.setPrevNextCells);
480    //   };
481    //
482    //   Flickity.prototype.setPrevNextCells = function() {
483    //     // remove classes
484    //     changeSlideClasses(this.previousSlide, 'remove', 'is-previous');
485    //     changeSlideClasses(this.nextSlide, 'remove', 'is-next');
486    //     // set slides
487    //     this.previousSlide = this.slides[this.selectedIndex - 1];
488    //     this.nextSlide = this.slides[this.selectedIndex + 1];
489    //     // add classes
490    //     changeSlideClasses(this.previousSlide, 'add', 'is-previous');
491    //     changeSlideClasses(this.nextSlide, 'add', 'is-next');
492    //   };
493    //
494    //   function changeSlideClasses(slide, method, className) {
495    //     if (!slide) {
496    //       return;
497    //     }
498    //     slide.getCellElements().forEach(function(cellElem) {
499    //       cellElem.classList[method](className);
500    //     });
501    //   }
502    //
503    //
504    //
505    // },
506
507    plyrjs: function () {
508      // Change "{}" to your options:
509      // https://github.com/sampotts/plyr/#options
510
511
512
513
514      // //PRECONNECT TO YOUTUBE IMAGES
515      // var linkTag = document.createElement("link");
516      // linkTag.rel = "preconnect";
517      // linkTag.href = "https://img.youtube.com";
518      // //inject tag in the head of the document
519      // document.head.appendChild(linkTag);
520
521
522      // var YouTubeContainers = document.querySelector("#player");
523
524      // if (YouTubeContainers) {
525      //   // Iterate over every YouTube container you may have
526
527      //   var container = YouTubeContainers;
528
529      //   //GET YT Thumbnail Image + Video Title
530      //   var imageSource = "https://img.youtube.com/vi_webp/" + container.dataset.plyrEmbedId + "/maxresdefault.webp";
531      //   var ytUrl = "https://www.youtube.com/watch?v=" + container.dataset.plyrEmbedId + ""; //		var imageTitle = "";
532
533      //   // Load the Thumbnail Image asynchronously
534      //   var image = new Image();
535      //   image.src = imageSource;
536
537      //   // alt image
538      //   fetch("https://noembed.com/embed?dataType=json&url=" + ytUrl)
539      //   .then(function(res) {
540      //     return res.json();
541      //   })
542      //   .then(function(data) {
543      //     return (image.alt = data.title);
544      //   });
545
546      //   var playBtn = document.querySelector('.play-btn')
547
548      //   //   image attributes
549
550      //   image.width = "1920";
551      //   image.height = "1080";
552      //   //	image.loading = 'lazy';
553
554      //   image.addEventListener("load", function() {
555      //     container.appendChild(image);
556      //   }); // When the user clicks on the container, load the embedded YouTube video
557
558      //   //LOAD PLYR ON CLICK
559      //   container.addEventListener("click", function() {
560
561
562
563      //     this.classList.add('loaded');
564      //     var plyr = container.getAttribute("data-plyr-embed-id"); //
565      //    // console.log(plyr)
566      //     var plyr = ".js-player[data-plyr-embed-id=" + plyr + "]";
567      //     var player = new Plyr(plyr, {
568      //       youtube: {
569      //         //SEE YOUTUBE API: https://developers.google.com/youtube/player_parameters#Parameters
570      //         origin: window.location.host,
571      //         iv_load_policy: 3,
572      //         modestbranding: 1,
573      //         playsinline: 1,
574      //         showinfo: 0,
575      //         rel: 0,
576      //         enablejsapi: 1,
577      //         noCookie: true
578      //       }
579      //     });
580
581
582      //     player.on("ready", function() {
583      //       player.play();
584      //       $('.v-btn-wrapper').addClass('playing');
585      //       $(this).removeClass('plyr--init-hide-controls');
586      //     }); // Attach Play Event
587
588      //     player.on('pause', function(event) {
589      //       $(this).addClass('plyr--init-hide-controls');
590      //       $('.v-btn-wrapper').removeClass('playing');
591      //     });
592
593      //     player.on('play', function(event) {
594      //       $('.v-btn-wrapper').addClass('playing');
595      //       $(this).removeClass('plyr--init-hide-controls');
596      //     });
597
598
599      //   });
600
601
602
603      // }
604
605      // $('.y-media-player').each(function(){
606      //   var $this = $(this);
607      //     var player = new Plyr($this, {
608      //       hideControls: true
609      //     });
610      //     window.player = player;
611      //     $('.plyr').on('ready', function(event) {
612
613      //           $(this).addClass('plyr--init-hide-controls');
614      //           $('.v-btn-wrapper').removeClass('playing');
615
616      //       }).on('play', function(event) {
617      //             $(this).removeClass('plyr--init-hide-controls');
618      //             $('.v-btn-wrapper').addClass('playing');
619      //       }).on('pause', function(event) {
620      //         $(this).addClass('plyr--init-hide-controls');
621      //         $('.v-btn-wrapper').removeClass('playing');
622
623      //       });
624
625      //     $('.v-btn-wrapper').on('click', function(){
626      //         player.play();
627      //     });
628      // });
629
630      if ($('.y-media-player').length > 0) {
631        const players = Plyr.setup('.y-media-player');
632
633        $('.yModal').on('hidden.bs.modal', function (event) {
634
635          players.forEach(function (player) {
636            player.pause();
637          });
638        });
639      }
640
641
642
643      // Expose player so it can be used from the console
644
645
646
647
648
649
650    },
651
652    scrollContent: function () {
653
654      const config = {
655        rootMargin: '0px 0px 200px 0px',
656        threshold: 0
657      };
658
659      var lazyImages = [].slice.call(document.querySelectorAll(".imgload.lazyImage"));
660      /** Then we set up a intersection observer watching over those images and whenever any of those becomes visible on the view then replace the placeholder image with actual one, remove the non-loaded class and then unobserve for that element **/
661      let lazyImageObserver = new IntersectionObserver(function (entries, observer) {
662        entries.forEach(function (entry) {
663          if (entry.isIntersecting) {
664            let lazyImage = entry.target;
665            lazyImage.src = lazyImage.dataset.src;
666            lazyImage.classList.remove("lazyImage");
667            lazyImageObserver.unobserve(lazyImage);
668          }
669        });
670      }, config);
671      /** Now observe all the non-loaded images using the observer we have setup above **/
672      lazyImages.forEach(function (lazyImage) {
673        lazyImageObserver.observe(lazyImage);
674      });
675
676
677
678      gsap.utils.toArray(".revealMe").forEach(image => {
679        var revealMe = gsap.timeline({
680          scrollTrigger: {
681            trigger: image,
682            start: "top bottom",
683            end: "bottom top",
684            toggleActions: "play none none reverse",
685          }
686        });
687
688        revealMe.from(image, {
689          y: 30,
690          ease: "power4.Out",
691          autoAlpha: 0,
692          duration: 1,
693        });
694      });
695
696
697      var scriptadded;
698
699      var facebook = document.querySelector(".connectSocial");
700      if (facebook) {
701        /** Then we set up a intersection observer watching over those images and whenever any of those becomes visible on the view then replace the placeholder image with actual one, remove the non-loaded class and then unobserve for that element **/
702        let facebookObserver = new IntersectionObserver(function (entries, observer) {
703          entries.forEach(function (entry) {
704            if (entry.isIntersecting) {
705              let facebook = entry.target;
706              facebook.classList.remove("facebook");
707              facebookObserver.unobserve(facebook);
708
709              loadExecuteTwitter();
710            }
711          });
712        }, config);
713        /** Now observe all the non-loaded images using the observer we have setup above **/
714
715        facebookObserver.observe(facebook);
716      }
717
718      function loadExecuteTwitter() {
719
720        var scripts = ["//platform.twitter.com/widgets.js", "https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v11.0"];
721
722        scripts.forEach((script, index) => {
723
724
725          var elem = document.createElement('script');
726          // var insertElem = document.querySelectorAll('.tab-pane');
727          var insertElem = document.getElementsByTagName('script')[index];
728
729          elem.src = scripts[index];
730          scriptadded = true;
731          var created = insertElem.parentNode.insertBefore(elem, insertElem);
732
733        });
734
735      }
736
737      var videoContent = document.querySelector(".content-video");
738
739      if (videoContent) {
740        /** Then we set up a intersection observer watching over those images and whenever any of those becomes visible on the view then replace the placeholder image with actual one, remove the non-loaded class and then unobserve for that element **/
741        let videoContentObserver = new IntersectionObserver(function (entries, observer) {
742          entries.forEach(function (entry) {
743            if (entry.isIntersecting) {
744              let videoContent = entry.target;
745              facebook.classList.remove("videoLoaded");
746              videoContentObserver.unobserve(videoContent);
747
748              lazyLoadvideo();
749            }
750          });
751        }, config);
752        videoContentObserver.observe(videoContent);
753
754      }
755
756
757
758      function lazyLoadvideo() {
759
760        const player = new Plyr('#player', {
761          hideControls: true
762        });
763
764        // Expose player so it can be used from the console
765        window.player = player;
766
767
768        $('.plyr').on('ready', function (event) {
769
770          $(this).addClass('plyr--init-hide-controls');
771          $('.v-btn-wrapper').removeClass('playing');
772
773        }).on('play', function (event) {
774          $(this).removeClass('plyr--init-hide-controls');
775          $('.v-btn-wrapper').addClass('playing');
776        }).on('pause', function (event) {
777          $(this).addClass('plyr--init-hide-controls');
778          $('.v-btn-wrapper').removeClass('playing');
779
780        });
781
782        $('.v-btn-wrapper').on('click', function () {
783          player.play();
784        });
785      }
786
787
788
789      // apply parallax effect to any element with a data-speed attribute
790      if ($('[data-speed]').length) {
791        gsap.to("[data-speed]", {
792          y: (i, el) => (1 - parseFloat(el.getAttribute("data-speed"))) * ScrollTrigger.maxScroll(window),
793          ease: "none",
794          scrollTrigger: {
795            start: 0,
796            end: "max",
797            invalidateOnRefresh: true,
798            scrub: 0
799          }
800        });
801
802      }
803      const sSLider = $('.banner-slider');
804      if (sSLider.length > 0) {
805        sSLider.slick({
806          autoplay: true,
807          autoplaySpeed: 10000,
808          dots: true,
809          infinite: true,
810          speed: 500,
811          fade: true,
812          cssEase: 'linear',
813          slide: 'div',
814          pauseOnHover: true,
815          pauseOnFocus: true,
816          pauseOnDotsHover: true,
817          lazyLoad: 'ondemand',
818          slidesToShow: 1,
819          slidesToScroll: 1
820        });
821      }
822
823    },
824
825    preloader: function () {
826      ///Image Load for Preloader///
827
828      var imgLoad = imagesLoaded('.imgload', {
829        background: true
830      });
831
832      var progressBar = $(".progress")
833      images = $(".imgload").length,
834        loadedCount = 0,
835        loadingProgress = 0,
836        tlProgress = gsap.timeline();
837
838
839
840      imgLoad.on('progress', function (instance, image) {
841        loadProgress();
842        var result = image.isLoaded ? 'loaded' : 'broken';
843        //console.log('image is ' + result + ' for ' + image.img.src);
844
845      });
846
847
848      function loadProgress(imgLoad, image) {
849
850        loadedCount++;
851
852        loadingProgress = (loadedCount / images);
853        //console.log(loadingProgress);
854        root.classList.add('is-loading');
855
856        gsap.to(tlProgress, 1, {
857          progress: loadingProgress
858        });
859        gsap.set('header', {
860          autoAlpha: 0,
861          ease: "Power4.inOut",
862        })
863        gsap.set('.g-banner .b-reveal', {
864          autoAlpha: 0,
865          ease: "Power4.inOut",
866        })
867
868
869        gsap.set('.g-intro', {
870          autoAlpha: 0,
871          ease: "Power4.inOut",
872        })
873
874      }
875
876      var tlProgress = gsap.timeline({
877        paused: true,
878        onUpdate: countPercent,
879        onComplete: loadComplete
880      });
881
882      tlProgress
883
884        .to(progressBar, 1, {
885          autoAlpha: 1
886        });
887
888      function countPercent() {
889
890        var newPercent = (tlProgress.progress() * 100).toFixed();
891
892        // count.text(newPercent + "%");
893      }
894
895      function loadComplete() {
896
897
898
899        root.classList.add('is-ready');
900
901
902
903        var tlEnd = gsap.timeline({
904
905          onComplete: function () {
906            root.classList.remove('is-loading');
907            root.classList.add('is-loaded');
908            // mbzirc.scrollText();
909            // document.querySelector('.loading-screen').remove();
910
911
912
913          }
914        });
915
916        tlEnd
917          .to(".progress", {
918            autoAlpha: 0,
919            duration: .5,
920            ease: "Power4.inOut",
921          })
922          .to(".p-layer .p-layer-items", {
923            xPercent: 100,
924            duration: .6,
925            ease: "Power4.inOut",
926            stagger: { // wrap advanced options in an object
927              each: .15
928            }
929          })
930          .to(".p-layer2 .p-layer-items", {
931            xPercent: 100,
932            duration: .5,
933            ease: "Power3.inOut",
934            stagger: { // wrap advanced options in an object
935              each: .15
936            }
937          }, '-=.6')
938
939          .to('header', {
940            autoAlpha: 1,
941            ease: "Power3.inOut",
942            duration: 1,
943          }, '-=.6')
944
945          .to('.g-banner .b-reveal', {
946            autoAlpha: 1,
947            ease: "Power3.inOut",
948            duration: .6,
949            stagger: { // wrap advanced options in an object
950              each: .15
951            }
952          }, '-=1.3')
953
954
955          .to('.g-intro', {
956            autoAlpha: 1,
957            ease: "Power4.inOut",
958            delay: .4,
959          }, '-=.95')
960
961          .to(".loading-screen", {
962            autoAlpha: 0,
963            duration: .1,
964            zIndex: -1,
965
966          })
967
968
969
970      }
971
972    },
973    contact: function () {
974      $('#erroralert-contact').hide();
975      $('#erroralert2-contact').hide();
976      $('#successalert-contact').hide();
977      var validity = [];
978      function isValidName(name) {
979        var pattern = new RegExp(/[0-9`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/);
980        return pattern.test(name);
981      }
982
983      function isValidMessage(name) {
984        var pattern = new RegExp(/[`!@#$%^&*_+\-=\[\]{};\\<>\/~|]/);
985        return pattern.test(name);
986      }
987
988      function isValidEmailAddress(emailAddress) {
989        var pattern = new RegExp("^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[_A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
990        return pattern.test(emailAddress);
991      }
992
993      function validate(el) {
994        var flag = false;
995        var type = $(el).attr('name');
996        // console.log('type', type);
997        var value = $(el).val().trim();
998        var $this = $(el);
999
1000        switch (type) {
1001          case "fullName":
1002            flag = !isValidName($(el).val().trim());
1003            var name = $(el).val().trim();
1004
1005            if (!name) {
1006              $this.addClass('is-invalid');
1007              flag = false;
1008              $($this).parent().find('.invalid-feedback').show();
1009            } else {
1010              if (!flag) {
1011                $this.addClass('is-invalid');
1012                flag = false;
1013                $($this).parent().find('.invalid-feedback').show();
1014              } else {
1015
1016                $this.removeClass('is-invalid');
1017                flag = true;
1018                $($this).parent().find('.invalid-feedback').hide();
1019              }
1020            }
1021            break;
1022          case "emailAddress":
1023            flag = isValidEmailAddress($(el).val().trim());
1024            var email = $(el).val().trim();
1025
1026            if (!email) {
1027              $this.addClass('is-invalid');
1028              flag = false;
1029              $($this).parent().find('.invalid-feedback').show();
1030            } else {
1031              if (!flag) {
1032                $this.addClass('is-invalid');
1033                flag = false;
1034                $($this).parent().find('.invalid-feedback').show();
1035              } else {
1036                $this.removeClass('is-invalid');
1037                flag = true;
1038                $($this).parent().find('.invalid-feedback').hide();
1039              }
1040            }
1041
1042            break;
1043          case "message":
1044            $($this).parent().find('.invalid-feedback').hide();
1045            var message = $(el).val().trim();
1046            flag = !isValidMessage($(el).val().trim());
1047
1048            if (!message) {
1049              $this.addClass('is-invalid');
1050              flag = false;
1051              $($this).parent().find('.invalid-feedback1').show();
1052            } else {
1053              if (!flag) {
1054                $this.addClass('is-invalid');
1055                flag = false;
1056                $($this).parent().find('.invalid-feedback2').show();
1057              } else {
1058
1059                $this.removeClass('is-invalid');
1060                flag = true;
1061                $($this).parent().find('.invalid-feedback').hide();
1062              }
1063            }
1064            break;
1065
1066          case "g-recaptcha-response":
1067          case "hiddencaptcha-contact":
1068            $('#captcha-contact').parent().find('.invalid-feedback').hide();
1069            var captcha = $('#hiddencaptcha-contact').val().trim();
1070
1071            if (!captcha) {
1072              $this.addClass('is-invalid');
1073              flag = false;
1074              $('#captcha-contact').parent().find('.invalid-feedback1').show();
1075            } else {
1076              $this.removeClass('is-invalid');
1077              flag = true;
1078              $('#captcha-contact').parent().find('.invalid-feedback').hide();
1079            }
1080            break;
1081
1082          case "submitContact":
1083            flag = true;
1084            break;
1085        }
1086        validity.push(flag);
1087      }
1088
1089      var form = document.getElementById("contactform");
1090      var url = "/functions/contact";
1091
1092      $("#submitContact").click(function (e) {
1093        e.preventDefault();
1094        $('#erroralert-contact').hide();
1095        $('#erroralert2-contact').hide();
1096        $('#successalert-contact').hide();
1097
1098        $('#submitContact').prop('disabled', true);
1099
1100        $("form#contactform :input").each(function () {
1101          validate(this);
1102        });
1103
1104        // console.log(validity);
1105
1106        if ($.inArray(false, validity) != -1) {
1107          $('#erroralert-contact').show();
1108          $('#submitContact').prop('disabled', false);
1109          validity = [];
1110        }
1111        else {
1112          validity = [];
1113          var formData = {
1114            'name': $("#fullName").val(),
1115            'message': $("#message").val(),
1116            'email': $("#emailAddress").val(),
1117            'g-recaptcha-response': $("#hiddencaptcha-contact").val(),
1118          };
1119          // console.log(formData);
1120
1121          $('.loading').show();
1122          $.ajax({
1123            type: "POST",
1124            url: url,
1125            data: formData,
1126            success: function (data) {
1127              $('.loading').hide();
1128              var response = JSON.parse(data);
1129              if (response.success === false) {
1130                $('#submitContact').prop('disabled', false);
1131                // console.log(response);
1132                if (response.message == "validation-error") {
1133                  $('#erroralert-contact').show();
1134
1135                  if (response.data.name) {
1136                    $('#fullName').siblings().show();
1137                  }
1138
1139                  if (response.data.email) {
1140                    $('#emailAddress').siblings().show();
1141                  }
1142
1143                  if (response.data.message) {
1144                    $('#message').siblings().eq(1).show();
1145                  }
1146
1147                  if (response.data['g-recaptcha-response']) {
1148                    $('#captcha-contact').siblings().eq(1).text(response.data['g-recaptcha-response']);
1149                    $('#captcha-contact').siblings().eq(1).show();
1150                    grecaptcha.reset();
1151                  }
1152
1153                } else {
1154                  $('#erroralert2-contact').children('span').text(response.message);
1155                  $('#erroralert2-contact').show();
1156                }
1157              }
1158              else {
1159                grecaptcha.reset();
1160                $('#erroralert-contact').hide();
1161                $('#successalert-contact').show();
1162                //reset form
1163                $('#submitContact').prop('disabled', false);
1164                $("form#contactform :input").val("");
1165              }
1166            },
1167            error: function (XMLHttpRequest, textStatus, errorThrown) {
1168              $('.loading').hide();
1169              $('#erroralert2-contact').show();
1170            }
1171          });
1172        }
1173        //  form.submit();
1174      });
1175    },
1176    subscribe: function () {
1177      $('#erroralert-subscribe').hide();
1178      $('#erroralert2-subscribe').hide();
1179      $('#successalert-subscribe').hide();
1180      var validity = [];
1181
1182      function isValidEmailAddress(emailAddress) {
1183        var pattern = new RegExp("^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[_A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
1184        return pattern.test(emailAddress);
1185      }
1186
1187      function validate(el) {
1188        var flag = false;
1189        var type = $(el).attr('name');
1190        var value = $(el).val().trim();
1191        var $this = $(el);
1192
1193        switch (type) {
1194
1195          case "MERGE0":
1196            flag = isValidEmailAddress($(el).val().trim());
1197            var email = $(el).val().trim();
1198
1199            if (!email) {
1200              $this.addClass('is-invalid');
1201              flag = false;
1202              $($this).parent().find('.invalid-feedback').show();
1203            } else {
1204              if (!flag) {
1205                $this.addClass('is-invalid');
1206                flag = false;
1207                $($this).parent().find('.invalid-feedback').show();
1208              } else {
1209                $this.removeClass('is-invalid');
1210                flag = true;
1211                $($this).parent().find('.invalid-feedback').hide();
1212              }
1213            }
1214
1215            break;
1216
1217          // case "g-recaptcha-response":
1218          // case "hiddencaptcha-subscribe":
1219          // $('#captcha-subscribe').parent().find('.invalid-feedback').hide();
1220          // var captcha = $('#hiddencaptcha-subscribe').val().trim();
1221
1222          // if (!captcha) {
1223          // $this.addClass('is-invalid');
1224          // flag = false;
1225          // $('#captcha-subscribe').parent().find('.invalid-feedback1').show();
1226          // } else{
1227          //     $this.removeClass('is-invalid');
1228          //     flag = true;
1229          //     $('#captcha-subscribe').parent().find('.invalid-feedback').hide();
1230          // }
1231          // break;
1232        }
1233        validity.push(flag);
1234      }
1235
1236      var form = document.getElementById("subscribeform");
1237      var url = "https://tii.us10.list-manage.com/subscribe/post-json?u=5bfd04680889396a4fcdf7d62&id=bf85b00e2f&c=?";
1238
1239      $("#subscribebtn").click(function (e) {
1240        e.preventDefault();
1241        $('#erroralert-subscribe').hide();
1242        $('#erroralert2-subscribe').hide();
1243        $('#successalert-subscribe').hide();
1244
1245        $('#subscribebtn').prop('disabled', true);
1246
1247        $("form#subscribeform :input").not("button[name=subscribebtn]").each(function () {
1248          validate(this);
1249        });
1250        if ($.inArray(false, validity) != -1) {
1251          $('#erroralert-subscribe').show();
1252          $('#subscribebtn').prop('disabled', false);
1253          validity = [];
1254        }
1255        else {
1256          validity = [];
1257          var formData = {
1258            'MERGE0': $("#MERGE0").val(),
1259            //   'g-recaptcha-response': $("#hiddencaptcha-subscribe").val(),
1260          };
1261          // console.log(formData);
1262
1263          $('.loading').show();
1264          $.ajax({
1265            type: "POST",
1266            url: url,
1267            data: formData,
1268            dataType: 'json',
1269            contentType: "application/json; charset=utf-8",
1270            encode: true,
1271            success: function (data) {
1272              $('.loading').hide();
1273              // grecaptcha.reset($("#hiddencaptchaid-subscribe").val());
1274              // console.log(data);
1275              if (data.result === 'error') {
1276                //  alert('there are errors '+ data.message);
1277                $('#subscribebtn').prop('disabled', false);
1278                $('#erroralert2-subscribe').html(data.msg);
1279                $('#erroralert2-subscribe').show();
1280              }
1281              else {
1282                $('#erroralert-subscribe').hide();
1283                $('#successalert-subscribe').show();
1284                //reset form
1285                $('#subscribebtn').prop('disabled', false);
1286                $("form#subscribeform :input").val("");
1287              }
1288            },
1289            error: function (XMLHttpRequest, textStatus, errorThrown) {
1290              $('.loading').hide();
1291              // grecaptcha.reset($("#hiddencaptchaid-subscribe").val());
1292              // console.log(errorThrown);
1293              $('#erroralert2-subscribe').show();
1294            }
1295          });
1296        }
1297
1298        //  form.submit();
1299      });
1300    }
1301
1302  }
1303
1304  mbzirc.init();
1305  mbzirc.preloader();
1306  mbzirc.contact();
1307  mbzirc.subscribe();
1308  mbzirc.misc();
1309  mbzirc.plyrjs();
1310  mbzirc.scrollContent();
1311
1312});

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.