PageSourceSearch

https://www.ifeja.org/ibercaza/js/script.js

js ifeja.org collected 2026-09-25 00:15:38 UTC 66,927 bytes, 2,021 lines download raw bytes

1"use strict";
2(function () {
3
4  /**
5   * Global variables
6   */
7  var userAgent = navigator.userAgent.toLowerCase(),
8    initialDate = new Date(),
9
10    $document = $(document),
11    $window = $(window),
12    $html = $("html"),
13    $body = $("body"),
14
15    isDesktop = $html.hasClass("desktop"),
16    isRtl = $html.attr("dir") === "rtl",
17    isIE = userAgent.indexOf("msie") !== -1 ? parseInt(userAgent.split("msie")[1], 10) : userAgent.indexOf("trident") !== -1 ? 11 : userAgent.indexOf("edge") !== -1 ? 12 : false,
18    isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
19
20    windowReady = false,
21    isNoviBuilder = false,
22    preloaderAnimateionDuration = 300,
23    loaderTimeoutId,
24
25    plugins = {
26      preloader: $("#preloader"),
27      bootstrapTooltip: $("[data-toggle='tooltip']"),
28      bootstrapModalDialog: $('.modal'),
29      bootstrapTabs: $(".tabs-custom"),
30      bootstrapCollapse: $(".card-custom"),
31      rdNavbar: $(".rd-navbar"),
32      materialParallax: $(".parallax-container"),
33      rdMailForm: $(".rd-mailform"),
34      rdInputLabel: $(".form-label"),
35      regula: $("[data-constraints]"),
36      rdRange: $('.rd-range'),
37      wow: $(".wow"),
38      owl: $(".owl-carousel"),
39      swiper: $(".swiper-slider"),
40      search: $(".rd-search"),
41      searchResults: $('.rd-search-results'),
42      statefulButton: $('.btn-stateful'),
43      popover: $('[data-toggle="popover"]'),
44      viewAnimate: $('.view-animate'),
45      radio: $("input[type='radio']"),
46      checkbox: $("input[type='checkbox']"),
47      customToggle: $("[data-custom-toggle]"),
48      counter: $(".counter"),
49      progressLinear: $(".progress-linear"),
50      progressBar: $(".progress-bar-js"),
51      dateCountdown: $('.DateCountdown'),
52      captcha: $('.recaptcha'),
53      lightGallery: $("[data-lightgallery='group']"),
54      lightGalleryItem: $("[data-lightgallery='item']"),
55      lightDynamicGalleryItem: $("[data-lightgallery='dynamic']"),
56      mailchimp: $('.mailchimp-mailform'),
57      campaignMonitor: $('.campaign-mailform'),
58      copyrightYear: $(".copyright-year"),
59      selectFilter: $("select"),
60      inlineToggle: $('.inline-toggle'),
61      focusToggle: $('.focus-toggle'),
62      countDown: $(".countdown"),
63      stepper: $("input[type='number']"),
64      doughnutChart: $(".doughnut-chart"),
65      radioPanel: $('.radio-panel .radio-inline'),
66      slick: $('.slick-slider'),
67      videoOverlay: $('.video-overlay'),
68    };
69
70  // Initialize All Scripts
71  $(function () {
72    isNoviBuilder = window.xMode;
73
74    // Page loader & Page transition
75    if (plugins.preloader.length && !isNoviBuilder) {
76      pageTransition({
77        target: document.querySelector('.page'),
78        delay: 100,
79        duration: preloaderAnimateionDuration,
80        classIn: 'fadeIn',
81        classOut: 'fadeOut',
82        classActive: 'animated',
83        conditions: function (event, link) {
84          return !/(\#|callto:|tel:|mailto:|:\/\/)/.test(link) && !event.currentTarget.hasAttribute('data-lightgallery');
85        },
86        onTransitionStart: function ( options ) {
87          setTimeout( function () {
88            plugins.preloader.removeClass('loaded');
89          }, options.duration * .75 );
90        },
91        onReady: function () {
92          plugins.preloader.addClass('loaded');
93          windowReady = true;
94        }
95      });
96    }
97
98    /**
99     * getSwiperHeight
100     * @description  calculate the height of swiper slider basing on data attr
101     */
102    function getSwiperHeight(object, attr) {
103      var val = object.attr("data-" + attr),
104        dim;
105
106      if (!val) {
107        return undefined;
108      }
109
110      dim = val.match(/(px)|(%)|(vh)|(vw)$/i);
111
112      if (dim.length) {
113        switch (dim[0]) {
114          case "px":
115            return parseFloat(val);
116          case "vh":
117            return $window.height() * (parseFloat(val) / 100);
118          case "vw":
119            return $window.width() * (parseFloat(val) / 100);
120          case "%":
121            return object.width() * (parseFloat(val) / 100);
122        }
123      } else {
124        return undefined;
125      }
126    }
127
128    /**
129     * toggleSwiperInnerVideos
130     * @description  toggle swiper videos on active slides
131     */
132    function toggleSwiperInnerVideos(swiper) {
133      var prevSlide = $(swiper.slides[swiper.previousIndex]),
134        nextSlide = $(swiper.slides[swiper.activeIndex]),
135        videos,
136        videoItems = prevSlide.find("video");
137
138      for (var i = 0; i < videoItems.length; i++) {
139        videoItems[i].pause();
140      }
141
142      videos = nextSlide.find("video");
143      if (videos.length) {
144        videos.get(0).play();
145      }
146    }
147
148    /**
149     * @desc Toggle swiper animations on active slides
150     * @param {object} swiper - swiper slider
151     */
152    function toggleSwiperCaptionAnimation(swiper) {
153      var prevSlide = $(swiper.container).find("[data-caption-animate]"),
154        nextSlide = $(swiper.slides[swiper.activeIndex]).find("[data-caption-animate]"),
155        delay,
156        duration,
157        nextSlideItem,
158        prevSlideItem;
159
160      for (var i = 0; i < prevSlide.length; i++) {
161        prevSlideItem = $(prevSlide[i]);
162
163        prevSlideItem.removeClass("animated")
164          .removeClass(prevSlideItem.attr("data-caption-animate"))
165          .addClass("not-animated");
166      }
167
168
169      var tempFunction = function (nextSlideItem, duration) {
170        return function () {
171          nextSlideItem
172            .removeClass("not-animated")
173            .addClass(nextSlideItem.attr("data-caption-animate"))
174            .addClass("animated");
175          if (duration) {
176            nextSlideItem.css('animation-duration', duration + 'ms');
177          }
178        };
179      };
180
181      for (var i = 0; i < nextSlide.length; i++) {
182        nextSlideItem = $(nextSlide[i]);
183        delay = nextSlideItem.attr("data-caption-delay");
184        duration = nextSlideItem.attr('data-caption-duration');
185        if (!isNoviBuilder) {
186          if (delay) {
187            setTimeout(tempFunction(nextSlideItem, duration), parseInt(delay, 10));
188          } else {
189            setTimeout(tempFunction(nextSlideItem, duration), 0);
190          }
191
192        } else {
193          nextSlideItem.removeClass("not-animated")
194        }
195      }
196    }
197
198    /**
199     * initOwlCarousel
200     * @description  Init owl carousel plugin
201     */
202    function initOwlCarousel(c) {
203      var aliaces = ["-", "-sm-", "-md-", "-lg-", "-xl-", "-xxl-"],
204        values = [0, 576, 768, 992, 1200, 1600],
205        responsive = {};
206
207      for (var j = 0; j < values.length; j++) {
208        responsive[values[j]] = {};
209        for (var k = j; k >= -1; k--) {
210          if (!responsive[values[j]]["items"] && c.attr("data" + aliaces[k] + "items")) {
211            responsive[values[j]]["items"] = k < 0 ? 1 : parseInt(c.attr("data" + aliaces[k] + "items"), 10);
212          }
213          if (!responsive[values[j]]["stagePadding"] && responsive[values[j]]["stagePadding"] !== 0 && c.attr("data" + aliaces[k] + "stage-padding")) {
214            responsive[values[j]]["stagePadding"] = k < 0 ? 0 : parseInt(c.attr("data" + aliaces[k] + "stage-padding"), 10);
215          }
216          if (!responsive[values[j]]["margin"] && responsive[values[j]]["margin"] !== 0 && c.attr("data" + aliaces[k] + "margin")) {
217            responsive[values[j]]["margin"] = k < 0 ? 30 : parseInt(c.attr("data" + aliaces[k] + "margin"), 10);
218          }
219        }
220      }
221
222
223      c.on("initialized.owl.carousel", function (event) {
224        var $carousel = $(event.currentTarget);
225        // Enable custom pagination
226        if (c.attr('data-dots-custom')) {
227          var customPag = $($carousel.attr("data-dots-custom")),
228            active = 0;
229
230          if ($carousel.attr('data-active')) {
231            active = parseInt($carousel.attr('data-active'), 10);
232          }
233
234          $carousel.trigger('to.owl.carousel', [active, 300, true]);
235          customPag.find("[data-owl-item='" + active + "']").addClass("active");
236
237          customPag.find("[data-owl-item]").on('click', function (e) {
238            e.preventDefault();
239            $carousel.trigger('to.owl.carousel', [parseInt(this.getAttribute("data-owl-item"), 10), 300, true]);
240          });
241
242          $carousel.on("translate.owl.carousel", function (event) {
243            customPag.find(".active").removeClass("active");
244            customPag.find("[data-owl-item='" + event.item.index + "']").addClass("active")
245          });
246        }
247
248        // Enable Custom Navigation
249        if (c.attr('data-nav-custom')) {
250          var customNav = $carousel.parents($carousel.attr("data-nav-custom"));
251          // Custom Navigation Events
252          customNav.find(".owl-arrow-next").click(function (e) {
253            e.preventDefault();
254            $carousel.trigger('next.owl.carousel');
255          });
256          customNav.find(".owl-arrow-prev").click(function (e) {
257            e.preventDefault();
258            $carousel.trigger('prev.owl.carousel');
259          });
260        }
261      });
262
263      c.on("initialized.owl.carousel", function (event) {
264        initLightGalleryItem(c.find('[data-lightgallery="item"]'), 'lightGallery-in-carousel');
265      });
266
267      c.owlCarousel({
268        autoplay: isNoviBuilder ? false : c.attr("data-autoplay") === "true",
269        autoplayTimeout: c.data("autoplay-timeout"),
270        autoplayHoverPause: c.data("autoplay-hover-pause"),
271        autoplaySpeed: c.data("data-autoplay-speed"),
272        center: c.data("data-center"),
273        startPosition: c.data("data-start-position"),
274        loop: isNoviBuilder ? false : c.attr("data-loop") === "true",
275        items: 1,
276        rtl: isRtl,
277        autoWidth: c.data("data-autowidth") === "true",
278        autoHeight: c.data("data-autoheight") === "true",
279        dotsContainer: c.attr("data-pagination-class") || false,
280        navContainer: c.attr("data-navigation-class") || false,
281        mouseDrag: isNoviBuilder ? false : c.attr("data-mouse-drag") !== "fal
281se",
282        touchDrag: c.data("data-touch-drag"),
283        dragEndSpeed: c.data("data-drag-end-speed"),
284        nav: c.attr('data-nav') === 'true',
285        navSpeed: c.data("data-nav-speed"),
286        dots: c.attr("data-dots") === "true",
287        dotsSpeed: c.data("dots-speed"),
288        dotsEach: c.attr("data-dots-each") ? parseInt(c.attr("data-dots-each"), 10) : false,
289        animateIn: c.attr('data-animation-in') ? c.attr('data-animation-in') : false,
290        animateOut: c.attr('data-animation-out') ? c.attr('data-animation-out') : false,
291        lazyLoad: c.data("data-lazy-load"),
292        responsive: responsive,
293        navText: function () {
294          try {
295            return JSON.parse(c.attr("data-nav-text"));
296          } catch (e) {
297            return [];
298          }
299        }(),
300        navClass: function () {
301          try {
302            return JSON.parse(c.attr("data-nav-class"));
303          } catch (e) {
304            return ['owl-prev', 'owl-next'];
305          }
306        }()
307      });
308
309
310      // Mousewheel plugin
311      var owl = $('.owl-mousewheel');
312      owl.on('mousewheel', '.owl-stage', function (e) {
313        var curr = $(this);
314        if (e.deltaY > 0) {
315          curr.trigger('prev.owl', [800]);
316        } else {
317          curr.trigger('next.owl', [800]);
318        }
319        e.preventDefault();
320        e.stopImmediatePropagation();
321      });
322
323    }
324
325    /**
326     * isScrolledIntoView
327     * @description  check the element was been scrolled into the view
328     */
329    function isScrolledIntoView(elem) {
330      if (!isNoviBuilder) {
331        return elem.offset().top + elem.outerHeight() >= $window.scrollTop() && elem.offset().top <= $window.scrollTop() + $window.height();
332      }
333      else {
334        return true;
335      }
336    }
337
338    /**
339     * initOnView
340     * @description  calls a function when element has been scrolled into the view
341     */
342    function lazyInit(element, func) {
343      $document.on('scroll', function () {
344        if ((!element.hasClass('lazy-loaded') && (isScrolledIntoView(element)))) {
345          func.call();
346          element.addClass('lazy-loaded');
347        }
348      }).trigger("scroll");
349    }
350
351    /**
352     * Live Search
353     * @description  create live search results
354     */
355    function liveSearch(options) {
356      $('#' + options.live).removeClass('cleared').html();
357      options.current++;
358      options.spin.addClass('loading');
359      $.get(handler, {
360        s: decodeURI(options.term),
361        liveSearch: options.live,
362        dataType: "html",
363        liveCount: options.liveCount,
364        filter: options.filter,
365        template: options.template
366      }, function (data) {
367        options.processed++;
368        var live = $('#' + options.live);
369        if ((options.processed === options.current) && !live.hasClass('cleared')) {
370          live.find('> #search-results').removeClass('active');
371          live.html(data);
372          setTimeout(function () {
373            live.find('> #search-results').addClass('active');
374          }, 50);
375        }
376        options.spin.parents('.rd-search').find('.input-group-addon').removeClass('loading');
377      })
378    }
379
380    /**
381     * attachFormValidator
382     * @description  attach form validation to elements
383     */
384    function attachFormValidator(elements) {
385      for (var i = 0; i < elements.length; i++) {
386        var o = $(elements[i]), v;
387        o.addClass("form-control-has-validation").after("<span class='form-validation'></span>");
388        v = o.parent().find(".form-validation");
389        if (v.is(":last-child")) {
390          o.addClass("form-control-last-child");
391        }
392      }
393
394      elements
395        .on('input change propertychange blur', function (e) {
396          var $this = $(this), results;
397
398          if (e.type !== "blur") {
399            if (!$this.parent().hasClass("has-error")) {
400              return;
401            }
402          }
403
404          if ($this.parents('.rd-mailform').hasClass('success')) {
405            return;
406          }
407
408          if ((results = $this.regula('validate')).length) {
409            for (i = 0; i < results.length; i++) {
410              $this.siblings(".form-validation").text(results[i].message).parent().addClass("has-error")
411            }
412          } else {
413            $this.siblings(".form-validation").text("").parent().removeClass("has-error")
414          }
415        })
416        .regula('bind');
417
418      var regularConstraintsMessages = [
419        {
420          type: regula.Constraint.Required,
421          newMessage: "The text field is required."
422        },
423        {
424          type: regula.Constraint.Email,
425          newMessage: "The email is not a valid email."
426        },
427        {
428          type: regula.Constraint.Numeric,
429          newMessage: "Only numbers are required"
430        },
431        {
432          type: regula.Constraint.Selected,
433          newMessage: "Please choose an option."
434        }
435      ];
436
437
438      for (var i = 0; i < regularConstraintsMessages.length; i++) {
439        var regularConstraint = regularConstraintsMessages[i];
440
441        regula.override({
442          constraintType: regularConstraint.type,
443          defaultMessage: regularConstraint.newMessage
444        });
445      }
446    }
447
448    /**
449     * isValidated
450     * @description  check if all elemnts pass validation
451     */
452    function isValidated(elements, captcha) {
453      var results, errors = 0;
454
455      if (elements.length) {
456        for (var j = 0; j < elements.length; j++) {
457
458          var $input = $(elements[j]);
459          if ((results = $input.regula('validate')).length) {
460            for (k = 0; k < results.length; k++) {
461              errors++;
462              $input.siblings(".form-validation").text(results[k].message).parent().addClass("has-error");
463            }
464          } else {
465            $input.siblings(".form-validation").text("").parent().removeClass("has-error")
466          }
467        }
468
469        if (captcha) {
470          if (captcha.length) {
471            return validateReCaptcha(captcha) && errors === 0
472          }
473        }
474
475        return errors === 0;
476      }
477      return true;
478    }
479
480
481    /**
482     * Init Bootstrap tooltip
483     * @description  calls a function when need to init bootstrap tooltips
484     */
485    function initBootstrapTooltip(tooltipPlacement) {
486      if (window.innerWidth < 576) {
487        plugins.bootstrapTooltip.tooltip('dispose');
488        plugins.bootstrapTooltip.tooltip({
489          placement: 'bottom'
490        });
491      } else {
492        plugins.bootstrapTooltip.tooltip('dispose');
493        plugins.bootstrapTooltip.tooltip({
494          placement: tooltipPlacement
495        });
496      }
497    }
498
499
500    /**
501     * validateReCaptcha
502     * @description  validate google reCaptcha
503     */
504    function validateReCaptcha(captcha) {
505      var captchaToken = captcha.find('.g-recaptcha-response').val();
506
507      if (captchaToken.length === 0) {
508        captcha
509          .siblings('.form-validation')
510          .html('Please, prove that you are not robot.')
511          .addClass('active');
512        captcha
513          .closest('.form-wrap')
514          .addClass('has-error');
515
516        captcha.on('propertychange', function () {
517          var $this = $(this),
518            captchaToken = $this.find('.g-recaptcha-response').val();
519
520          if (captchaToken.length > 0) {
521            $this
522              .closest('.form-wrap')
523              .removeClass('has-error');
524            $this
525              .siblings('.form-validation')
526              .removeClass('active')
527              .html('');
528            $this.off('propertychange');
529          }
530        });
531
532        return false;
533      }
534
535      return true;
536    }
537
538
539    /**
540     * onloadCaptchaCallback
541     * @description  init google reCaptcha
542     */
543    window.onloadCaptchaCallback = function () {
544      for (var i = 0; i < plugins.captcha.length; i++) {
545        var $capthcaItem = $(plugins.captcha[i]);
546
547        grecaptcha.render(
548          $capthcaItem.attr('id'),
549          {
550            sitekey: $capthcaItem.attr('data-sitekey'),
551            size: $capthcaItem.attr('data-size') ? $capthcaItem.attr('data-size') : 'normal',
552            theme: $capthcaItem.attr('data-theme') ? $capthcaItem.attr('data-theme') : 'light',
553            callback: function (e) {
554              $('.recaptcha').trigger('propertychange');
555            }
556          }
557        );
558        $capthcaItem.after("<span class='form-validation'></span>");
559      }
560    };
561
562    /**
563     * Google ReCaptcha
564     * @description Enables Google ReCaptcha
565     */
566    if (plugins.captcha.length) {
567      $.getScript("//www.google.com/recaptcha/api.js?onload=onloadCaptchaCallback&render=explicit&hl=en");
568    }
569
570
571    /**
572     * Is Mac os
573     */
574    if (navigator.platform.match(/(Mac)/i)) $html.addClass("mac-os");
575
576
577    /**
578     * Is Firefox
579     */
580    if (typeof InstallTrigger !== 'undefined') $html.addClass("firefox");
581    
582    
583    /**
584     * IE Polyfills
585     * @description  Adds some loosing functionality to IE browsers
586     */
587    if (isIE) {
588      if (isIE < 10) {
589        $html.addClass("lt-ie-10");
590      }
591
592      if (isIE < 11) {
593        if (plugins.pointerEvents) {
594          $.getScript(plugins.pointerEvents)
595            .done(function () {
596              $html.addClass("ie-10");
597              PointerEventsPolyfill.initialize({});
598            });
599        }
600      }
601
602      if (isIE === 11) {
603        $html.addClass("ie-11");
604      }
605
606      if (isIE === 12) {
607        $html.addClass("ie-edge");
608      }
609    }
610
611
612    /**
613     * Bootstrap Tooltips
614     * @description Activate Bootstrap Tooltips
615     */
616    if (plugins.bootstrapTooltip.length) {
617      var tooltipPlacement = plugins.bootstrapTooltip.attr('data-placement');
618      initBootstrapTooltip(tooltipPlacement);
619
620      $window.on('resize orientationchange', function () {
621        initBootstrapTooltip(tooltipPlacement);
622      })
623    }
624
625
626    /**
627     * bootstrapModalDialog
628     * @description Stap vioeo in bootstrapModalDialog
629     */
630    if (plugins.bootstrapModalDialog.length > 0) {
631      for (var i = 0; i < plugins.bootstrapModalDialog.length; i++) {
632        var modalItem = $(plugins.bootstrapModalDialog[i]);
633
634        modalItem.on('hidden.bs.modal', $.proxy(function () {
635          var activeModal = $(this),
636            rdVideoInside = activeModal.find('video'),
637            youTubeVideoInside = activeModal.find('iframe');
638
639          if (rdVideoInside.length) {
640            rdVideoInside[0].pause();
641          }
642
643          if (youTubeVideoInside.length) {
644            var videoUrl = youTubeVideoInside.attr('src');
645
646            youTubeVideoInside
647              .attr('src', '')
648              .attr('src', videoUrl);
649          }
650        }, modalItem))
651      }
652    }
653
654
655    /**
656     * Popovers
657     * @description Enables Popovers plugin
658     */
659    if (plugins.popover.length) {
660      if (window.innerWidth < 767) {
661        plugins.popover.attr('data-placement', 'bottom');
662        plugins.popover.popover();
663      }
664      else {
665        plugins.popover.popover();
666      }
667    }
668
669
670    /**
671     * Bootstrap Buttons
672     * @description  Enable Bootstrap Buttons plugin
673     */
674    if (plugins.statefulButton.length) {
675      $(plugins.statefulButton).on('click', function () {
676        var statefulButtonLoading = $(this).button('loading');
677
678        setTimeout(function () {
679          statefulButtonLoading.button('reset')
680        }, 2000);
681      })
682    }
683
684
685    /**
686     * Bootstrap tabs
687     * @description Activate Bootstrap Tabs
688     */
689
690    if (plugins.bootstrapTabs.length) {
691      for (var i = 0; i < plugins.bootstrapTabs.length; i++) {
692        var $bootstrapTabsItem = $(plugins.bootstrapTabs[i]);
693
694        // Nav plugin
695        if ($bootstrapTabsItem.attr('data-nav') === 'true') {
696
697          var $buttonPrev = $($bootstrapTabsItem.find('[data-nav-prev]')).first(),
698            $buttonNext = $($bootstrapTabsItem.find('[data-nav-next]')).first();
699
700          if ($buttonPrev && $buttonNext) {
701            var isClicked = true,
702              currentIndex = 0,
703              $nav = $($bootstrapTabsItem.find('.nav')),
704              navItemsLength = $nav.children().length;
705
706
707            for (var z = 0; z < navItemsLength; z++) {
708              $($nav.find('li:eq(' + z + ') a')).on('hidden.bs.tab', function () {
709                isClicked = true;
710              });
711              $($nav.find('li:eq(' + z + ') a')).on('shown.bs.tab', function () {
712                isClicked = true;
713              });
714            }
715
716            $buttonPrev.on('click', (function ($nav) {
717              return function () {
718                var prevIndex = $($nav.find('.active')).parent().index() - 1;
719
720                if ((currentIndex != prevIndex) && prevIndex >= 0 && isClicked) {
721                  currentIndex = prevIndex;
722                  isClicked = false;
723                  $($nav.find('li:eq(' + prevIndex + ') a')).tab('show');
724                }
725              }
726            })($nav));
727
728            $buttonNext.on('click', (function ($nav) {
729              return function () {
730                var nextIndex = $($nav.find('.active')).parent().index() + 1;
731
732                if ((currentIndex != nextIndex) && (nextIndex < navItemsLength) && isClicked) {
733                  currentIndex = nextIndex;
734                  isClicked = false;
735                  $($nav.find('li:eq(' + nextIndex + ') a')).tab('show');
736                }
737              }
738            })($nav));
739          }
740        }
741      }
742    }
743
744    /**
745     * Bootstrap Collapse
746     */
747    if (plugins.bootstrapCollapse.length) {
748      for (var i = 0; i < plugins.bootstrapCollapse.length; i++) {
749        var $bootstrapCollapseItem = $(plugins.bootstrapCollapse[i]);
750
751        $bootstrapCollapseItem.on('show.bs.collapse', (function ($bootstrapCollapseItem) {
752          return function () {
753            $bootstrapCollapseItem.addClass('active');
754          };
755        })($bootstrapCollapseItem));
756
757        $bootstrapCollapseItem.on('hide.bs.collapse', (function ($bootstrapCollapseItem) {
758          return function () {
759            $bootstrapCollapseItem.removeClass('active');
760          };
761        })($bootstrapCollapseItem));
762      }
763    }
764
765
766    /**
767     * Copyright Year
768     * @description  Evaluates correct copyright year
769     */
770    if (plugins.copyrightYear.length) {
771      plugins.copyrightYear.text(initialDate.getFullYear());
772    }
773
774    /**
775     * Select2
776     * @description Enables select2 plugin
777     */
778    if (plugins.selectFilter.length) {
779      for (var i = 0; i < plugins.selectFilter.length; i++) {
780        var select = $(plugins.selectFilter[i]);
781
782        select.select2({
783          placeholder: select.attr("data-placeholder") ? select.attr("data-placeholder") : false,
784          minimumResultsForSearch: select.attr("data-minimum-results-search") ? select.attr("data-minimum-results-search") : -1,
785          maximumSelectionSize: 3,
786          selectOnBlur: false,
787          dropdownCssClass: select.attr("data-dropdown-class") ? select.attr("data-dropdown-class") : ''
788        });
789      }
790    }
791    
792
793    /**
794     * Radio
795     * @description Add custom styling options for input[type="radio"]
796     */
797    if (plugins.radio.length) {
798      for (var i = 0; i < plugins.radio.length; i++) {
799        $(plugins.radio[i]).addClass("radio-custom").after("<span class='radio-custom-dummy'></span>")
800      }
801    }
802
803    /**
804     * Checkbox
805     * @description Add custom styling options for input[type="checkbox"]
806     */
807    if (plugins.checkbox.length) {
808      for (var i = 0; i < plugins.checkbox.length; i++) {
809        $(plugins.checkbox[i]).addClass("checkbox-custom").after("<span class='checkbox-custom-dummy'></span>")
810      }
811    }
812
813
814    /**
815     * UI To Top
816     * @description Enables ToTop Button
817     */
818    if (isDesktop && !isNoviBuilder) {
819      $().UItoTop({
820        easingType: 'easeOutQuad',
821        containerClass: 'ui-to-top fa fa-angle-up'
822      });
823    }
824
825    /**
826     * Owl carousel
827     * @description Enables Owl carousel plugin
828     */
829    if (plugins.owl.length) {
830      for (var i = 0; i < plugins.owl.length; i++) {
831        var c = $(plugins.owl[i]);
832        plugins.owl[i].owl = c;
833
834        initOwlCarousel(c);
835      }
836    }
837
838    /**
839     * lightGallery
840     * @description Enables lightGallery plugin
841     */
842    function initLightGallery(itemsToInit, addClass) {
843      if (!isNoviBuilder) {
844        $(itemsToInit).lightGallery({
845          thumbnail: $(itemsToInit).attr("data-lg-thumbnail") !== "false",
846          selector: "[data-lightgallery='item']",
847          autoplay: $(itemsToInit).attr("data-lg-autoplay") === "true",
848          pause: parseInt($(itemsToInit).attr("data-lg-autoplay-delay")) || 5000,
849          addClass: addClass,
850          mode: $(itemsToInit).attr("data-lg-animation") || "lg-slide",
851          loop: $(itemsToInit).attr("data-lg-loop") !== "false"
852        });
853      }
854    }
855
856    function initDynamicLightGallery(itemsToInit, addClass) {
857      if (!isNoviBuilder) {
858        $(itemsToInit).on("click", function() {
859          $(itemsToInit).lightGallery({
860            thumbnail: $(itemsToInit).attr("data-lg-thumbnail") !== "false",
861            selector: "[data-lightgallery='item']",
862            autoplay: $(itemsToInit).attr("data-lg-autoplay") === "true",
863            pause: parseInt($(itemsToInit).attr("data-lg-autoplay-delay")) || 5000,
864            addClass: addClass,
865            mode: $(itemsToInit).attr("data-lg-animation") || "lg-slide",
866            loop: $(itemsToInit).attr("data-lg-loop") !== "false",
867            dynamic: true,
868            dynamicEl: JSON.parse($(itemsToInit).attr("data-lg-dynamic-elements")) || []
869          });
870        });
871      }
872    }
873
874    function initLightGalleryItem(itemToInit, addClass) {
875      if (!isNoviBuilder) {
876        $(itemToInit).lightGallery({
877          selector: "this",
878          addClass: addClass,
879          counter: false,
880          youtubePlayerParams: {
881            modestbranding: 1,
882            showinfo: 0,
883            rel: 0,
884            controls: 0
885          },
886          vimeoPlayerParams: {
887            byline: 0,
888            portrait: 0
889          }
890        });
891      }
892    }
893
894    // Filter carousel items
895    var notCarouselItems = [];
896    for (var z = 0; z < plugins.lightGalleryItem.length; z++) {
897      if ( !$(plugins.lightGalleryItem[z]).parents('.owl-carousel').length &&
898           !$(plugins.lightGalleryItem[z]).parents('.swiper-slider').length &&
899           !$(plugins.lightGalleryItem[z]).parents('.slick-slider').length) {
900        notCarouselItems.push( plugins.lightGalleryItem[z] );
901      }
902    }
903
904    plugins.lightGalleryItem = notCarouselItems;
905
906    if (plugins.lightGallery.length) {
907      for (var i = 0; i < plugins.lightGallery.length; i++) {
908        initLightGallery(plugins.lightGallery[i]);
909      }
910    }
911    
912    if (plugins.lightGalleryItem.length) {
913      for (var i = 0; i < plugins.lightGalleryItem.length; i++) {
914        initLightGalleryItem(plugins.lightGalleryItem[i]);
915      }
916    }
917
918    if (plugins.lightDynamicGalleryItem.length) {
919      for (var i = 0; i < plugins.lightDynamicGalleryItem.length; i++) {
920        initDynamicLightGallery(plugins.lightDynamicGalleryItem[i]);
921      }
922    }
923
924
925    /**
926     * RD Navbar
927     * @description Enables RD Navbar plugin
928     */
929    if (plugins.rdNavbar.length) {
930      var aliaces, i, j, len, value, values, responsiveNavbar;
931
932      aliaces = ["-", "-sm-", "-md-", "-lg-", "-xl-", "-xxl-"];
933      values = [0, 576, 768, 992, 1200, 1600];
934      responsiveNavbar = {};
935
936      for (i = j = 0, len = values.length; j < len; i = ++j) {
937        value = values[i];
938        if (!responsiveNavbar[values[i]]) {
939          responsiveNavbar[values[i]] = {};
940        }
941        if (plugins.rdNavbar.attr('data' + aliaces[i] + 'layout')) {
942          responsiveNavbar[values[i]].layout = plugins.rdNavbar.attr('data' + aliaces[i] + 'layout');
943        }
944        if (plugins.rdNavbar.attr('data' + aliaces[i] + 'device-layout')) {
945          responsiveNavbar[values[i]]['deviceLayout'] = plugins.rdNavbar.attr('data' + aliaces[i] + 'device-layout');
946        }
947        if (plugins.rdNavbar.attr('data' + aliaces[i] + 'hover-on')) {
948          responsiveNavbar[values[i]]['focusOnHover'] = plugins.rdNavbar.attr('data' + aliaces[i] + 'hover-on') === 'true';
949        }
950        if (plugins.rdNavbar.attr('data' + aliaces[i] + 'auto-height')) {
951          responsiveNavbar[values[i]]['autoHeight'] = plugins.rdNavbar.attr('data' + aliaces[i] + 'auto-height') === 'true';
952        }
953
954        if (isNoviBuilder) {
955          responsiveNavbar[values[i]]['stickUp'] = false;
956        } else if (plugins.rdNavbar.attr('data' + aliaces[i] + 'stick-up')) {
957          responsiveNavbar[values[i]]['stickUp'] = plugins.rdNavbar.attr('data' + aliaces[i] + 'stick-up') === 'true';
958        }
959
960        if (plugins.rdNavbar.attr('data' + aliaces[i] + 'stick-up-offset')) {
961          responsiveNavbar[values[i]]['stickUpOffset'] = plugins.rdNavbar.attr('data' + aliaces[i] + 'stick-up-offset');
962        }
963      }
964
965
966      plugins.rdNavbar.RDNavbar({
967        anchorNav: !isNoviBuilder,
968        stickUpClone: (plugins.rdNavbar.attr("data-stick-up-clone") && !isNoviBuilder) ? plugins.rdNavbar.attr("data-stick-up-clone") === 'true' : false,
969        responsive: responsiveNavbar,
970        callbacks: {
971          onStuck: function () {
972            var navbarSearch = this.$element.find('.rd-search input');
973
974            if (navbarSearch) {
975              navbarSearch.val('').trigger('propertychange');
976            }
977
978            var navbarSelect = plugins.rdNavbar.find('.select2-container');
979            if(navbarSelect.length) {
980              navbarSelect.select2("close");
981            }
982          },
983          onDropdownOver: function () {
984            return !isNoviBuilder;
985          },
986          onUnstuck: function () {
987            if (this.$clone === null)
988              return;
989
990            var navbarSearch = this.$clone.find('.rd-search input');
991
992            if (navbarSearch) {
993              navbarSearch.val('').trigger('propertychange');
994              navbarSearch.trigger('blur');
995            }
996
997          }
998        }
999      });
1000
1001
1002      if (plugins.rdNavbar.attr("data-body-class")) {
1003        document.body.className += ' ' + plugins.rdNavbar.attr("data-body-class");
1004      }
1005    }
1006
1007
1008
1009    /**
1010     * RD Search
1011     * @description Enables search
1012     */
1013    if (plugins.search.length || plugins.searchResults) {
1014      var handler = "bat/rd-search.php";
1015      var defaultTemplate = '<h6 class="search-title"><a target="_top" href="#{href}" class="search-link">#{title}</a></h6>' +
1016        '<p>...#{token}...</p>' +
1017        '<p class="match"><em>Terms matched: #{count} - URL: #{href}</em></p>';
1018      var defaultFilter = '*.html';
1019
1020      if (plugins.search.length) {
1021        for (var i = 0; i < plugins.search.length; i++) {
1022          var searchItem = $(plugins.search[i]),
1023            options = {
1024              element: searchItem,
1025              filter: (searchItem.attr('data-search-filter')) ? searchItem.attr('data-search-filter') : defaultFilter,
1026              template: (searchItem.attr('data-search-template')) ? searchItem.attr('data-search-template') : defaultTemplate,
1027              live: (searchItem.attr('data-search-live')) ? searchItem.attr('data-search-live') : false,
1028              liveCount: (searchItem.attr('data-search-live-count')) ? parseInt(searchItem.attr('data-search-live'), 10) : 4,
1029              current: 0, processed: 0, timer: {}
1030            };
1031
1032          var $toggle = $('.rd-navbar-search-toggle');
1033          if ($toggle.length) {
1034            $toggle.on('click', (function (searchItem) {
1035              return function () {
1036                if (!($(this).hasClass('active'))) {
1037                  searchItem.find('input').val('').trigger('propertychange');
1038                }
1039              }
1040            })(searchItem));
1041          }
1042
1043          if (options.live) {
1044            var clearHandler = false;
1045
1046            searchItem.find('input').on("input propertychange", $.proxy(function () {
1047              this.term = this.element.find('input').val().trim();
1048              this.spin = this.element.find('.input-group-addon');
1049
1050              clearTimeout(this.timer);
1051
1052              if (this.term.length > 2) {
1053                this.timer = setTimeout(liveSearch(this), 200);
1054
1055                if (clearHandler === false) {
1056                  clearHandler = true;
1057
1058                  $body.on("click", function (e) {
1059                    if ($(e.toElement).parents('.rd-search').length === 0) {
1060                      $('#rd-search-results-live').addClass('cleared').html('');
1061                    }
1062                  })
1063                }
1064
1065              } else if (this.term.length === 0) {
1066                $('#' + this.live).addClass('cleared').html('');
1067              }
1068            }, options, this));
1069          }
1070
1071          searchItem.submit($.proxy(function () {
1072            $('<input />').attr('type', 'hidden')
1073              .attr('name', "filter")
1074              .attr('value', this.filter)
1075              .appendTo(this.element);
1076            return true;
1077          }, options, this))
1078        }
1079      }
1080
1081      if (plugins.searchResults.length) {
1082        var regExp = /\?.*s=([^&]+)\&filter=([^&]+)/g;
1083        var match = regExp.exec(location.search);
1084
1085        if (match !== null) {
1086          $.get(handler, {
1087            s: decodeURI(match[1]),
1088            dataType: "html",
1089            filter: match[2],
1090            template: defaultTemplate,
1091            live: ''
1092          }, function (data) {
1093            plugins.searchResults.html(data);
1094          })
1095        }
1096      }
1097    }
1098
1099
1100    /**
1101     * ViewPort Universal
1102     * @description Add class in viewport
1103     */
1104    if (plugins.viewAnimate.length) {
1105      for (var i = 0; i < plugins.viewAnimate.length; i++) {
1106        var $view = $(plugins.viewAnimate[i]).not('.active');
1107        $document.on("scroll", $.proxy(function () {
1108          if (isScrolledIntoView(this)) {
1109            this.addClass("active");
1110          }
1111        }, $view))
1112          .trigger("scroll");
1113      }
1114    }
1115
1116
1117    /**
1118     * Swiper
1119     * @description  Enable Swiper Slider
1120     */
1121    if (plugins.swiper.length) {
1122      for (var i = 0; i < plugins.swiper.length; i++) {
1123        var s = $(plugins.swiper[i]);
1124        var pag = s.find(".swiper-pagination"),
1125          next = s.find(".swiper-button-next"),
1126          prev = s.find(".swiper-button-prev"),
1127          bar = s.find(".swiper-scrollbar"),
1128          swiperSlide = s.find(".swiper-slide"),
1129          autoplay = false;
1130
1131        for (var j = 0; j < swiperSlide.length; j++) {
1132          var $this = $(swiperSlide[j]),
1133            url;
1134
1135          if (url = $this.attr("data-slide-bg")) {
1136            $this.css({
1137              "background-image": "url(" + url + ")",
1138              "background-size": "cover"
1139            })
1140          }
1141        }
1142
1143        swiperSlide.end()
1144          .find("[data-caption-animate]")
1145          .addClass("not-animated")
1146          .end();
1147
1148        s.swiper({
1149          autoplay: s.attr('data-autoplay') ? s.attr('data-autoplay') === "false" || s.attr('data-autoplay-hover') === "true" ? undefined : s.attr('data-autoplay') : 5000,
1150          direction: s.attr('data-direction') ? s.attr('data-direction') : "horizontal",
1151          effect: s.attr('data-slide-effect') ? s.attr('data-slide-effect') : "slide",
1152          speed: s.attr('data-slide-speed') ? s.attr('data-slide-speed') : 600,
1153          keyboardControl: s.attr('data-keyboard') === "true",
1154          mousewheelControl: s.attr('data-mousewheel') === "true",
1155          mousewheelReleaseOnEdges: s.attr('data-mousewheel-releaase') === "true",
1156          lazyLoading: s.attr('data-lazy-loading') === "true",
1157          nextButton: next.length ? next.get(0) : null,
1158          prevButton: prev.length ? prev.get(0) : null,
1159          pagination: pag.length ? pag.get(0) : null,
1160          paginationClickable: pag.length ? pag.attr("data-clickable") !== "false" : false,
1161          paginationBulletRender: pag.length ? pag.attr("data-index-bullet") === "true" ? function (swiper, index, className) {
1162            return '<span class="' + className + '"><span>' + ((index + 1) < 10 ? ('0' + (index + 1) ): (index + 1))  + '</span></span>';
1163          } : null : null,
1164          scrollbar: bar.length ? bar.get(0) : null,
1165          scrollbarDraggable: bar.length ? bar.attr("data-draggable") !== "false" : true,
1166          scrollbarHide: bar.length ? bar.attr("data-draggable") === "false" : false,
1167          loop: isNoviBuilder ? false : s.attr('data-loop') !== "false",
1168          simulateTouch: s.attr('data-simulate-touch') && !isNoviBuilder ? s.attr('data-simulate-touch') === "true" : false,
1169          onTransitionStart: function (swiper) {
1170            toggleSwiperInnerVideos(swiper);
1171          },
1172          onTransitionEnd: function (swiper) {
1173            toggleSwiperCaptionAnimation(swiper);
1174          },
1175          onInit: function (swiper) {
1176            toggleSwiperInnerVideos(swiper);
1177            toggleSwiperCaptionAnimation(swiper);
1178
1179            if (swiper.container.data('autoplay-hover') === true) {
1180              var hoverEvent;
1181
1182              swiper.container.mouseenter(function (e) {
1183                hoverEvent = setInterval(function () {
1184                  swiper.slideNext();
1185                }, $(swiper.container).data('autoplay'));
1186              });
1187
1188              swiper.container.mouseleave(function (e) {
1189                clearInterval(hoverEvent);
1190              });
1191            }
1192            
1193            initLightGalleryItem(s.find('[data-lightgallery="item"]'), 'lightGallery-in-carousel');
1194          }
1195        });
1196
1197        $window.on("resize", (function (s) {
1198          return function () {
1199            var mh = getSwiperHeight(s, "min-height"),
1200              h = getSwiperHeight(s, "height");
1201            if (h) {
1202              s.css("height", mh ? mh > h ? mh : h : h);
1203            }
1204          }
1205        })(s)).trigger("resize");
1206      }
1207    }
1208
1209
1210    /**
1211     * WOW
1212     * @description Enables Wow animation plugin
1213     */
1214    if ($html.hasClass("wow-animation") && plugins.wow.length && !isNoviBuilder && isDesktop) {
1215      new WOW().init();
1216    }
1217
1218
1219    /**
1220     * RD Input Label
1221     * @description Enables RD Input Label Plugin
1222     */
1223    if (plugins.rdInputLabel.length) {
1224      plugins.rdInputLabel.RDInputLabel();
1225    }
1226
1227
1228    /**
1229     * Regula
1230     * @description Enables Regula plugin
1231     */
1232    if (plugins.regula.length) {
1233      attachFormValidator(plugins.regula);
1234    }
1235
1236
1237    /**
1238     * MailChimp Ajax subscription
1239     */
1240
1241    if (plugins.mailchimp.length) {
1242      for (i = 0; i < plugins.mailchimp.length; i++) {
1243        var $mailchimpItem = $(plugins.mailchimp[i]),
1244          $email = $mailchimpItem.find('input[type="email"]');
1245
1246        // Required by MailChimp
1247        $mailchimpItem.attr('novalidate', 'true');
1248        $email.attr('name', 'EMAIL');
1249
1250        $mailchimpItem.on('submit', $.proxy(function (e) {
1251          e.preventDefault();
1252
1253          var $this = this;
1254
1255          var data = {},
1256            url = $this.attr('action').replace('/post?', '/post-json?').concat('&c=?'),
1257            dataArray = $this.serializeArray(),
1258            $output = $("#" + $this.attr("data-form-output"));
1259
1260          for (i = 0; i < dataArray.length; i++) {
1261            data[dataArray[i].name] = dataArray[i].value;
1262          }
1263
1264          $.ajax({
1265            data: data,
1266            url: url,
1267            dataType: 'jsonp',
1268            error: function (resp, text) {
1269              $output.html('Server error: ' + text);
1270
1271              setTimeout(function () {
1272                $output.removeClass("active");
1273              }, 4000);
1274            },
1275            success: function (resp) {
1276              $output.html(resp.msg).addClass('active');
1277
1278              setTimeout(function () {
1279                $output.removeClass("active");
1280              }, 6000);
1281            },
1282            beforeSend: function (data) {
1283              // Stop request if builder or inputs are invalide
1284              if (isNoviBuilder || !isValidated($this.find('[data-constraints]')))
1285                return false;
1286
1287              $output.html('Submitting...').addClass('active');
1288            }
1289          });
1290
1291          return false;
1292        }, $mailchimpItem));
1293      }
1294    }
1295
1296
1297    /**
1298     * Campaign Monitor ajax subscription
1299     */
1300    if (plugins.campaignMonitor.length) {
1301      for (i = 0; i < plugins.campaignMonitor.length; i++) {
1302        var $campaignItem = $(plugins.campaignMonitor[i]);
1303
1304        $campaignItem.on('submit', $.proxy(function (e) {
1305          var data = {},
1306            url = this.attr('action'),
1307            dataArray = this.serializeArray(),
1308            $output = $("#" + plugins.campaignMonitor.attr("data-form-output")),
1309            $this = $(this);
1310
1311          for (i = 0; i < dataArray.length; i++) {
1312            data[dataArray[i].name] = dataArray[i].value;
1313          }
1314
1315          $.ajax({
1316            data: data,
1317            url: url,
1318            dataType: 'jsonp',
1319            error: function (resp, text) {
1320              $output.html('Server error: ' + text);
1321
1322              setTimeout(function () {
1323                $output.removeClass("active");
1324              }, 4000);
1325            },
1326            success: function (resp) {
1327              $output.html(resp.Message).addClass('active');
1328
1329              setTimeout(function () {
1330                $output.removeClass("active");
1331              }, 6000);
1332            },
1333            beforeSend: function (data) {
1334              // Stop request if builder or inputs are invalide
1335              if (isNoviBuilder || !isValidated($this.find('[data-constraints]')))
1336                return false;
1337
1338              $output.html('Submitting...').addClass('active');
1339            }
1340          });
1341
1342          return false;
1343        }, $campaignItem));
1344      }
1345    }
1346
1347
1348    /**
1349     * RD Mailform
1350     * @version      3.2.0
1351     */
1352    if (plugins.rdMailForm.length) {
1353      var i, j, k,
1354        msg = {
1355          'MF000': 'Successfully sent!',
1356          'MF001': 'Recipients are not set!',
1357          'MF002': 'Form will not work locally!',
1358          'MF003': 'Please, define email field in your form!',
1359          'MF004': 'Please, define type of your form!',
1360          'MF254': 'Something went wrong with PHPMailer!',
1361          'MF255': 'Aw, snap! Something went wrong.'
1362        };
1363
1364      for (i = 0; i < plugins.rdMailForm.length; i++) {
1365        var $form = $(plugins.rdMailForm[i]),
1366          formHasCaptcha = false;
1367
1368        $form.attr('novalidate', 'novalidate').ajaxForm({
1369          data: {
1370            "form-type": $form.attr("data-form-type") || "contact",
1371            "counter": i
1372          },
1373          beforeSubmit: function (arr, $form, options) {
1374            if (isNoviBuilder)
1375              return;
1376
1377            var form = $(plugins.rdMailForm[this.extraData.counter]),
1378              inputs = form.find("[data-constraints]"),
1379              output = $("#" + form.attr("data-form-output")),
1380              captcha = form.find('.recaptcha'),
1381              captchaFlag = true;
1382
1383            output.removeClass("active error success");
1384
1385            if (isValidated(inputs, captcha)) {
1386
1387              // veify reCaptcha
1388              if (captcha.length) {
1389                var captchaToken = captcha.find('.g-recaptcha-response').val(),
1390                  captchaMsg = {
1391                    'CPT001': 'Please, setup you "site key" and "secret key" of reCaptcha',
1392                    'CPT002': 'Something wrong with google reCaptcha'
1393                  };
1394
1395                formHasCaptcha = true;
1396
1397                $.ajax({
1398                  method: "POST",
1399                  url: "bat/reCaptcha.php",
1400                  data: {'g-recaptcha-response': captchaToken},
1401                  async: false
1402                })
1403                  .done(function (responceCode) {
1404                    if (responceCode !== 'CPT000') {
1405                      if (output.hasClass("snackbars")) {
1406                        output.html('<p><span class="icon text-middle mdi mdi-check icon-xxs"></span><span>' + captchaMsg[responceCode] + '</span></p>')
1407
1408                        setTimeout(function () {
1409                          output.removeClass("active");
1410                        }, 3500);
1411
1412                        captchaFlag = false;
1413                      } else {
1414                        output.html(captchaMsg[responceCode]);
1415                      }
1416
1417                      output.addClass("active");
1418                    }
1419                  });
1420              }
1421
1422              if (!captchaFlag) {
1423                return false;
1424              }
1425
1426              form.addClass('form-in-process');
1427
1428              if (output.hasClass("snackbars")) {
1429                output.html('<p><span class="icon text-middle fa fa-circle-o-notch fa-spin icon-xxs"></span><span>Sending</span></p>');
1430                output.addClass("active");
1431              }
1432            } else {
1433              return false;
1434            }
1435          },
1436          error: function (result) {
1437            if (isNoviBuilder)
1438              return;
1439
1440            var output = $("#" + $(plugins.rdMailForm[this.extraData.counter]).attr("data-form-output")),
1441              form = $(plugins.rdMailForm[this.extraData.counter]);
1442
1443            output.text(msg[result]);
1444            form.removeClass('form-in-process');
1445
1446            if (formHasCaptcha) {
1447              grecaptcha.reset();
1448            }
1449          },
1450          success: function (result) {
1451            if (isNoviBuilder)
1452              return;
1453
1454            var form = $(plugins.rdMailForm[this.extraData.counter]),
1455              output = $("#" + form.attr("data-form-output")),
1456              select = form.find('select');
1457
1458            form
1459              .addClass('success')
1460              .removeClass('form-in-process');
1461
1462            if (formHasCaptcha) {
1463              grecaptcha.reset();
1464            }
1465
1466            result = result.length === 5 ? result : 'MF255';
1467            output.text(msg[result]);
1468
1469            if (result === "MF000") {
1470              if (output.hasClass("snackbars")) {
1471                output.html('<p><span class="icon text-middle mdi mdi-check icon-xxs"></span><span>' + msg[result] + '</span></p>');
1472              } else {
1473                output.addClass("active success");
1474              }
1475            } else {
1476              if (output.hasClass("snackbars")) {
1477                output.html(' <p class="snackbars-left"><span class="icon icon-xxs mdi mdi-alert-outline text-middle"></span><span>' + msg[result] + '</span></p>');
1478              } else {
1479                output.addClass("active error");
1480              }
1481            }
1482
1483            form.clearForm();
1484
1485            if (select.length) {
1486              select.select2("val", "");
1487            }
1488
1489            form.find('input, textarea').trigger('blur');
1490
1491            setTimeout(function () {
1492              output.removeClass("active error success");
1493              form.removeClass('success');
1494            }, 3500);
1495          }
1496        });
1497      }
1498    }
1499
1500    /**
1501     * Stepper
1502     * @description Enables Stepper Plugin
1503     */
1504    if (plugins.stepper.length) {
1505      plugins.stepper.stepper({
1506        labels: {
1507          up: "",
1508          down: ""
1509        }
1510      });
1511    }
1512
1513
1514
1515    /**
1516     * Custom Toggles
1517     */
1518    if (plugins.customToggle.length) {
1519      for (var i = 0; i < plugins.customToggle.length; i++) {
1520        var $this = $(plugins.customToggle[i]);
1521
1522        $this.on('click', $.proxy(function (event) {
1523          event.preventDefault();
1524
1525          var $ctx = $(this);
1526          $($ctx.attr('data-custom-toggle')).add(this).toggleClass('active');
1527        }, $this));
1528
1529        if ($this.attr("data-custom-toggle-hide-on-blur") === "true") {
1530          $body.on("click", $this, function (e) {
1531            if (e.target !== e.data[0]
1532              && $(e.data.attr('data-custom-toggle')).find($(e.target)).length
1533              && e.data.find($(e.target)).length === 0) {
1534              $(e.data.attr('data-custom-toggle')).add(e.data[0]).removeClass('active');
1535            }
1536          })
1537        }
1538
1539        if ($this.attr("data-custom-toggle-disable-on-blur") === "true") {
1540          $body.on("click", $this, function (e) {
1541            if (e.target !== e.data[0]
1542              && $(e.data.attr('data-custom-toggle')).find($(e.target)).length === 0
1543              && e.data.find($(e.target)).length === 0) {
1544              $(e.data.attr('data-custom-toggle')).add(e.data[0]).removeClass('active');
1545            }
1546          })
1547        }
1548      }
1549    }
1550
1551
1552    /**
1553     * jQuery Count To
1554     * @description Enables Count To plugin
1555     */
1556    if (plugins.counter.length) {
1557      for (var i = 0; i < plugins.counter.length; i++) {
1558        var $counterNotAnimated = $(plugins.counter[i]).not('.animated');
1559        $document.on("scroll", $.proxy(function () {
1560          var $this = this;
1561
1562          if ((!$this.hasClass("animated")) && (isScrolledIntoView($this))) {
1563            $this.countTo({
1564              refreshInterval: 40,
1565              from: 0,
1566              to: parseInt($this.text(), 10),
1567              speed: $this.attr("data-speed") || 1000
1568            });
1569            $this.addClass('animated');
1570          }
1571        }, $counterNotAnimated))
1572          .trigger("scroll");
1573      }
1574    }
1575
1576
1577    /**
1578     * TimeCircles
1579     * @description  Enable TimeCircles plugin
1580     */
1581    if (plugins.dateCountdown.length) {
1582      for (var i = 0; i < plugins.dateCountdown.length; i++) {
1583        var dateCountdownItem = $(plugins.dateCountdown[i]),
1584          time = {
1585            "Days": {
1586              "text": "Days",
1587              "show": true,
1588              color: dateCountdownItem.attr("data-color") ? dateCountdownItem.attr("data-color") : "#f9f9f9"
1589            },
1590            "Hours": {
1591              "text": "Hours",
1592              "show": true,
1593              color: dateCountdownItem.attr("data-color") ? dateCountdownItem.attr("data-color") : "#f9f9f9"
1594            },
1595            "Minutes": {
1596              "text": "Minutes",
1597              "show": true,
1598              color: dateCountdownItem.attr("data-color") ? dateCountdownItem.attr("data-color") : "#f9f9f9"
1599            },
1600            "Seconds": {
1601              "text": "Seconds",
1602              "show": true,
1603              color: dateCountdownItem.attr("data-color") ? dateCountdownItem.attr("data-color") : "#f9f9f9"
1604            }
1605          };
1606
1607        dateCountdownItem.TimeCircles({
1608          color: dateCountdownItem.attr("data-color") ? dateCountdownItem.attr("data-color") : "rgba(247, 247, 247, 1)",
1609          animation: "smooth",
1610          bg_width: dateCountdownItem.attr("data-bg-width") ? dateCountdownItem.attr("data-bg-width") : 0.6,
1611          circle_bg_color: dateCountdownItem.attr("data-bg") ? dateCountdownItem.attr("data-bg") : "rgba(0, 0, 0, 1)",
1612          fg_width: dateCountdownItem.attr("data-width") ? dateCountdownItem.attr("data-width") : 0.03
1613        });
1614
1615        (function (dateCountdownItem, time) {
1616          $window.on('load resize orientationchange', function () {
1617            if (window.innerWidth < 479) {
1618              dateCountdownItem.TimeCircles({
1619                time: {
1620                  "Days": {
1621                    "text": "Days",
1622                    "show": true,
1623                    color: dateCountdownItem.attr("data-color") ? dateCountdownItem.attr("data-color") : "#f9f9f9"
1624                  },
1625                  "Hours": {
1626                    "text": "Hours",
1627                    "show": true,
1628                    color: dateCountdownItem.attr("data-color") ? dateCountdownItem.attr("data-color") : "#f9f9f9"
1629                  },
1630                  "Minutes": {
1631                    "text": "Minutes",
1632                    "show": true,
1633                    color: dateCountdownItem.attr("data-color") ? dateCountdownItem.attr("data-color") : "#f9f9f9"
1634                  },
1635                  Seconds: {
1636                    "text": "Seconds",
1637                    show: false,
1638                    color: dateCountdownItem.attr("data-color") ? dateCountdownItem.attr("data-color") : "#f9f9f9"
1639                  }
1640                }
1641              }).rebuild();
1642            } else if (window.innerWidth < 767) {
1643              dateCountdownItem.TimeCircles({
1644                time: {
1645                  "Days": {
1646                    "text": "Days",
1647                    "show": true,
1648                    color: dateCountdownItem.attr("data-color") ? dateCountdownItem.attr("data-color") : "#f9f9f9"
1649                  },
1650                  "Hours": {
1651                    "text": "Hours",
1652                    "show": true,
1653                    color: dateCountdownItem.attr("data-color") ? dateCountdownItem.attr("data-color") : "#f9f9f9"
1654                  },
1655                  "Minutes": {
1656                    "text": "Minutes",
1657                    "show": true,
1658                    color: dateCountdownItem.attr("data-color") ? dateCountdownItem.attr("data-color") : "#f9f9f9"
1659                  },
1660                  Seconds: {
1661                    text: '',
1662                    show: false,
1663                    color: dateCountdownItem.attr("data-color") ? dateCountdownItem.attr("data-color") : "#f9f9f9"
1664                  }
1665                }
1666              }).rebuild();
1667            } else {
1668              dateCountdownItem.TimeCircles({time: time}).rebuild();
1669            }
1670          });
1671        })(dateCountdownItem, time);
1672      }
1673    }
1674
1675
1676    /**
1677     * Circle Progress bar
1678     * @description  Enable progress bar
1679     */
1680    if (plugins.progressBar.length) {
1681      var i,
1682        bar,
1683        type;
1684
1685      for (i = 0; i < plugins.progressBar.length; i++) {
1686        var progressItem = plugins.progressBar[i];
1687        bar = null;
1688
1689        if (progressItem.className.indexOf("progress-bar-horizontal") > -1) {
1690          type = 'Line';
1691        }
1692
1693        if (progressItem.className.indexOf("progress-bar-radial") > -1) {
1694          type = 'Circle';
1695        }
1696
1697        if (progressItem.getAttribute("data-stroke") && progressItem.getAttribute("data-value") && type) {
1698          bar = new ProgressBar[type](progressItem, {
1699            strokeWidth: Math.round(parseFloat(progressItem.getAttribute("data-stroke")) / progressItem.offsetWidth * 100),
1700            trailWidth: progressItem.getAttribute("data-trail") ? Math.round(parseFloat(progressItem.getAttribute("data-trail")) / progressItem.offsetWidth * 100) : 0,
1701            text: {
1702              value: progressItem.getAttribute("data-counter") === "true" ? '0' : null,
1703              className: 'progress-bar__body',
1704              style: null
1705            }
1706          });
1707          bar.svg.setAttribute('preserveAspectRatio', "none meet");
1708          if (type === 'Line') {
1709            bar.svg.setAttributeNS(null, "height", progressItem.getAttribute("data-stroke"));
1710          }
1711
1712          bar.path.removeAttribute("stroke");
1713          bar.path.className.baseVal = "progress-bar__stroke";
1714          if (bar.trail) {
1715            bar.trail.removeAttribute("stroke");
1716            bar.trail.className.baseVal = "progress-bar__trail";
1717          }
1718
1719          if (progressItem.getAttribute("data-easing") && !isIE) {
1720            $document
1721              .on("scroll", {"barItem": bar}, $.proxy(function (event) {
1722                var bar = event.data.barItem;
1723                var $this = $(this);
1724
1725                if (isScrolledIntoView($this) && this.className.indexOf("progress-bar--animated") === -1) {
1726                  this.className += " progress-bar--animated";
1727                  bar.animate(parseInt($this.attr("data-value"), 10) / 100.0, {
1728                    easing: $this.attr("data-easing"),
1729                    duration: $this.attr("data-duration") ? parseInt($this.attr("data-duration", 10), 10) : 800,
1730                    step: function (state, b) {
1731                      if (b._container.className.indexOf("progress-bar-horizontal") > -1 ||
1732                        b._container.className.indexOf("progress-bar-vertical") > -1) {
1733                        b.text.style.width = Math.abs(b.value() * 100).toFixed(0) + "%"
1734                      }
1735                      b.setText(Math.abs(b.value() * 100).toFixed(0));
1736                    }
1737                  });
1738                }
1739              }, progressItem))
1740              .trigger("scroll");
1741          } else {
1742            bar.set(parseInt($(progressItem).attr("data-value"), 10) / 100.0);
1743            bar.setText($(progressItem).attr("data-value"));
1744            if (type === 'Line') {
1745              bar.text.style.width = parseInt($(progressItem).attr("data-value"), 10) + "%";
1746            }
1747          }
1748        } else {
1749          console.error(progressItem.className + ": progress bar type is not defined");
1750        }
1751      }
1752    }
1753
1754
1755    /**
1756     * Linear Progress bar
1757     * @description  Enable progress bar
1758     */
1759    if (plugins.progressLinear.length) {
1760      for (i = 0; i < plugins.progressLinear.length; i++) {
1761        var progressBar = $(plugins.progressLinear[i]);
1762        $window.on("scroll load", $.proxy(function () {
1763          var bar = $(this);
1764          if (!bar.hasClass('animated-first') && isScrolledIntoView(bar)) {
1765            var end = parseInt($(this).find('.progress-value').text(), 10);
1766            bar.find('.progress-bar-linear').css({width: end + '%'});
1767            bar.find('.progress-value').countTo({
1768              refreshInterval: 40,
1769              from: 0,
1770              to: end,
1771              speed: 500
1772            });
1773            bar.addClass('animated-first');
1774          }
1775        }, progressBar));
1776      }
1777    }
1778
1779
1780    /**
1781     * Material Parallax
1782     * @description Enables Material Parallax plugin
1783     */
1784    if (plugins.materialParallax.length) {
1785      var i;
1786
1787      if (!isNoviBuilder && !isIE && !isMobile) {
1788        plugins.materialParallax.parallax();
1789      } else {
1790        for (i = 0; i < plugins.materialParallax.length; i++) {
1791          var parallax = $(plugins.materialParallax[i]),
1792            imgPath = parallax.data("parallax-img");
1793
1794          parallax.css({
1795            "background-image": 'url(' + imgPath + ')',
1796            "background-attachment": "fixed",
1797            "background-size": "cover"
1798          });
1799        }
1800      }
1801    }
1802
1803
1804    /**
1805     * RD Range
1806     * @description Enables RD Range plugin
1807     */
1808    if (plugins.rdRange.length && !isNoviBuilder) {
1809      plugins.rdRange.RDRange({});
1810    }
1811    
1812
1813    if (plugins.inlineToggle.length) {
1814      for (var i = 0; i < plugins.inlineToggle.length; i++) {
1815        var $element = $(plugins.inlineToggle[i]);
1816
1817        $element.on('click', (function ($element) {
1818          return function (event) {
1819            event.preventDefault();
1820            $element.parents(".inline-toggle-parent").toggleClass("active");
1821          }
1822        })($element));
1823
1824        $body.on('click', $element, (function ($element) {
1825          return function (event) {
1826            if (event.target !== event.data[0]
1827              && !$(event.target).hasClass("inline-toggle-parent")
1828              && event.data.find($(event.target)).length === 0) {
1829
1830              $element.parents(".inline-toggle-parent").removeClass("active");
1831            }
1832          }
1833        })($element));
1834      }
1835    }
1836
1837    /**
1838     * Focus toggle
1839     */
1840    if (plugins.focusToggle.length) {
1841      for (var i = 0; i < plugins.focusToggle.length; i++) {
1842        var $element = $(plugins.focusToggle[i]);
1843
1844        $element.hover(
1845          function (event) {
1846            event.preventDefault();
1847            $(this).parents('.focus-toggle-parent').addClass('focus');
1848          }
1849        );
1850
1851        $element.parents('.focus-toggle-parent').hover(
1852          function () {
1853          },
1854          function () {
1855            $(this).removeClass('focus');
1856          }
1857        )
1858      }
1859    }
1860
1861
1862    /**
1863     * jQuery Countdown
1864     * @description  Enable countdown plugin
1865     */
1866    if (plugins.countDown.length) {
1867      for (var i = 0; i < plugins.countDown.length; i++) {
1868        var $countDownItem = $(plugins.countDown[i]),
1869          d = new Date(),
1870          type = $countDownItem.attr('data-type'),
1871          time = $countDownItem.attr('data-time'),
1872          format = $countDownItem.attr('data-format'),
1873          settings = [];
1874
1875        // Classic style
1876        if ($countDownItem.attr('data-style') === 'short') {
1877          settings['labels'] = ['Yeas', 'Mons', 'Weks', 'Days', 'Hrs', 'Mins', 'Secs'];
1878        }
1879
1880        d.setTime(Date.parse(time)).toLocaleString();
1881        settings[type] = d;
1882        settings['format'] = format;
1883        $countDownItem.countdown(settings);
1884      }
1885    }
1886
1887    /**
1888     * doughnutChart
1889     * @description  Enable doughnutChart plugin
1890     */
1891    if (plugins.doughnutChart.length) {
1892      for (var i = 0; i < plugins.doughnutChart.length; i++) {
1893        var $element = $(plugins.doughnutChart[i]),
1894          $chartDataList = $element.find('.doughnut-chart-list').first();
1895
1896        if ($chartDataList) {
1897          var ratioValues = [],
1898            chartDataListItems = $chartDataList.find('> li');
1899
1900          for (var k = 0; k < chartDataListItems.length; k++) {
1901            var value = Math.abs(chartDataListItems[k].getAttribute('data-value') * 1);
1902            ratioValues.push({});
1903            ratioValues[k].title = chartDataListItems[k].innerHTML;
1904            ratioValues[k].value = value ? value : 10;
1905          }
1906
1907          $element.drawDoughnutChart(
1908            ratioValues, {
1909              segmentShowStroke: false,
1910              segmentStrokeWidth: 0,
1911              baseColor: '#f5f5f5',
1912              baseOffset: 0,
1913              edgeOffset: 1,
1914              percentageInnerCutout: 85
1915            }
1916          );
1917        }
1918      }
1919    }
1920
1921    // Radio Panel
1922    if (plugins.radioPanel) {
1923      for (var i = 0; i < plugins.radioPanel.length; i++) {
1924        var $element = $(plugins.radioPanel[i]);
1925        $element.on('click', function () {
1926          plugins.radioPanel.removeClass('active');
1927          $(this).addClass('active');
1928        })
1929      }
1930    }
1931
1932    /**
1933     * Slick carousel
1934     * @description  Enable Slick carousel plugin
1935     */
1936    if (plugins.slick.length) {
1937      for (var i = 0; i < plugins.slick.length; i++) {
1938        var $slickItem = $(plugins.slick[i]);
1939
1940        $slickItem.on('init', function (slick) {
1941          initLightGallery($(slick).find('[data-lightgallery="item"]'), 'lightGallery-in-carousel');
1942        });
1943
1944        $slickItem.slick({
1945          slidesToScroll: parseInt($slickItem.attr('data-slide-to-scroll'), 10) || 1,
1946          asNavFor: $slickItem.attr('data-for') || false,
1947          dots: $slickItem.attr("data-dots") === "true",
1948          infinite: isNoviBuilder ? false : $slickItem.attr("data-loop") === "true",
1949          focusOnSelect: true,
1950          arrows: $slickItem.attr("data-arrows") === "true",
1951          swipe: $slickItem.attr("data-swipe") === "true",
1952          autoplay: isNoviBuilder ? false : $slickItem.attr("data-autoplay") === "true",
1953          autoplaySpeed: $slickItem.attr("data-autoplay-speed") ? parseInt($slickItem.attr("data-autoplay-speed")) : 3500,
1954          vertical: $slickItem.attr("data-vertical") === "true",
1955          centerMode: $slickItem.attr("data-center-mode") === "true",
1956          centerPadding: $slickItem.attr("data-center-padding") ? $slickItem.attr("data-center-padding") : '0.50',
1957          mobileFirst: true,
1958          rtl: isRtl,
1959          responsive: [
1960            {
1961              breakpoint: 0,
1962              settings: {
1963                slidesToShow: parseInt($slickItem.attr('data-items'), 10) || 1
1964              }
1965            },
1966            {
1967              breakpoint: 575,
1968              settings: {
1969                slidesToShow: parseInt($slickItem.attr('data-sm-items'), 10) || 1
1970              }
1971            },
1972            {
1973              breakpoint: 767,
1974              settings: {
1975                slidesToShow: parseInt($slickItem.attr('data-md-items'), 10) || 1
1976              }
1977            },
1978            {
1979              breakpoint: 991,
1980              settings: {
1981                slidesToShow: parseInt($slickItem.attr('data-lg-items'), 10) || 1
1982              }
1983            },
1984            {
1985              breakpoint: 1199,
1986              settings: {
1987                slidesToShow: parseInt($slickItem.attr('data-xl-items'), 10) || 1
1988              }
1989            }
1990          ]
1991        })
1992          .on('afterChange', function (event, slick, currentSlide, nextSlide) {
1993            var $this = $(this),
1994              childCarousel = $this.attr('data-child');
1995
1996            if (childCarousel) {
1997              $(childCarousel + ' .slick-slide').removeClass('slick-current');
1998              $(childCarousel + ' .slick-slide').eq(currentSlide).addClass('slick-current');
1999            }
2000          });
2001      }
2002    }
2003
2004    // Video Overlay
2005    if (plugins.videoOverlay.length) {
2006      for (var i = 0; i < plugins.videoOverlay.length; i++) {
2007        var overlay = plugins.videoOverlay[i];
2008        if (overlay) {
2009          overlay.style.opacity = '1';
2010          overlay.addEventListener('click', function (e) {
2011            $(this).animate({
2012              opacity: 0
2013            }, function () {
2014              this.style.display = 'none';
2015            });
2016          });
2017        }
2018      }
2019    }
2020  });
2021}());

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.