PageSourceSearch

https://revistasic.es/wp-content/themes/betheme/js/scripts.js?ver=24.0.1.2

js revistasic.es collected 2026-09-26 13:32:49 UTC 70,734 bytes, 3,079 lines download raw bytes

1(function($) {
2
3  /* globals jQuery, mfn */
4
5  "use strict";
6
7  var scrollTicker, lightboxAttr, sidebar,
8    rtl = $('body').hasClass('rtl'),
9    simple = $('body').hasClass('style-simple'),
10    topBarTop = '61px',
11    headerH = 0,
12    mobileInitW = mfn.mobileInit ? mfn.mobileInit : 1240;
13
14  /**
15   * Lightbox | Magnific Popup
16   */
17
18  if ( ! mfn.lightbox.disable ) {
19    if ( ! ( mfn.lightbox.disableMobile && ( window.innerWidth < 768 ) ) ) {
20      lightboxAttr = {
21        title: mfn.lightbox.title ? mfn.lightbox.title : false,
22      };
23    }
24  }
25
26  /**
27   * Admin Bar & WooCommerce Store Notice
28   */
29
30  function adminBarH() {
31
32    var height = 0;
33
34    // WP adminbar
35
36    if ($('body').hasClass('admin-bar')) {
37      var actionBarH = $('#wpadminbar').innerHeight() || 0;
38      height += actionBarH;
39    }
40
41    // WC demo store
42
43    if ($('body').hasClass('woocommerce-demo-store')) {
44      var demoStoreH = $('body > p.demo_store').innerHeight() || 0;
45      height += demoStoreH;
46    }
47
48    return height;
49  }
50
51  /**
52   * Header | Sticky
53   */
54
55  function mfnSticky() {
56
57    if( ! $('body').hasClass('sticky-header') ){
58      return false;
59    }
60
61    if( $('body').hasClass('header-creative') && window.innerWidth >= 768 ){
62      return false;
63    }
64
65    var startY = headerH;
66    var windowY = $(window).scrollTop();
67    var topBarH = $('#Top_bar').height() || 0;
68
69    if ( windowY > startY ) {
70
71      if ( ! ( $('#Top_bar').hasClass('is-sticky') ) ) {
72
73        $('.header_placeholder').css('height', topBarH);
74
75        $('#Top_bar')
76          .addClass('is-sticky')
77          .css('top', -60)
78          .animate({
79            'top': adminBarH() + 'px'
80          }, 300);
81
82        headerWidth();
83      }
84
85    } else {
86
87      if ($('#Top_bar').hasClass('is-sticky')) {
88
89        $('.header_placeholder').css('height', 0);
90        $('#Top_bar')
91          .removeClass('is-sticky')
92          .css('top', topBarTop);
93
94        stickyLogo();
95        headerWidth();
96
97      }
98
99    }
100
101  }
102
103  /**
104   * Header | Sticky | Retina Logo - max height
105   */
106
107  function stickyLogo() {
108
109    // ! retina display
110
111    if( window.devicePixelRatio <= 1 ){
112      return false;
113    }
114
115    var parent = $('#Top_bar #logo'),
116      el = $('img.logo-main', parent),
117      height = el.data('height');
118
119    // ! retina logo set
120    if ( ! parent.hasClass('retina')) {
121      return false;
122    }
123
124    if ( $('body').hasClass('logo-overflow') ) {
125      // do nothing
126    } else if ( height > parent.data('height') ) {
127      height = parent.data('height');
128    }
129
130    el.css('max-height', height + 'px');
131
132  }
133
134  /**
135   * Header | Sticky | Height
136   */
137
138  function mfnStickyH() {
139
140    var topBarH = $('#Top_bar').innerHeight() || 0;
141
142    if ( $('body').hasClass('header-below') ) {
143
144      // header below slider
145
146      var sliderH = $('.mfn-main-slider').innerHeight() || 0;
147
148      headerH = topBarH + sliderH;
149
150    } else {
151
152      // default
153
154      var actionBarH = $('#Action_bar').innerHeight() || 0;
155
156      headerH = topBarH + actionBarH;
157
158    }
159
160  }
161
162  /**
163   * Header | Sticky | Mobile
164   */
165
166  function mfnMobileSticky() {
167
168    if( ! $('body').hasClass('.mobile-sticky') ){
169      return false;
170    }
171
172    if( $(window).width() >= 768 ){
173      return false;
174    }
175
176    var menuH,
177      windowH = $(window).height() || 0,
178      logoH = $('#Top_bar .logo').height() || 0,
179      offset = adminBarH() + logoH;
180
181    if ( ( ! $('#Top_bar').hasClass('is-sticky')) && $('#Action_bar').is(':visible') ) {
182      offset += $('#Action_bar').height() || 0;
183    }
184
185    menuH = windowH - offset;
186
187    if (menuH < 176) {
188      menuH = 176;
189    }
190
191    $('#Top_bar #menu').css('max-height', menuH + 'px');
192
193  }
194
195  /**
196   * Header | Top bar left | Width
197   */
198
199  function headerWidth() {
200    var rightW = $('.top_bar_right').innerWidth() || 0;
201
202    if (rightW && !$('body').hasClass('header-plain')) {
203      rightW += 10;
204    }
205
206    var parentW = $('#Top_bar .one').innerWidth() || 0;
207    var leftW = parentW - rightW;
208
209    $('.top_bar_left, .menu > li > ul.mfn-megamenu').css('width', leftW);
210  }
211
212  /**
213   * FIX | Header | Sticky | Height
214   */
215
216  function fixStickyHeaderH() {
217
218    var stickyH = 0;
219
220    // FIX | sticky top bar height
221
222    var topBar = $('.sticky-header #Top_bar');
223
224    if (topBar.hasClass('is-sticky')) {
225      stickyH = $('.sticky-header #Top_bar').innerHeight() || 0;
226    } else {
227      topBar.addClass('is-sticky');
228      stickyH = $('.sticky-header #Top_bar').innerHeight() || 0;
229      topBar.removeClass('is-sticky');
230    }
231
232    // FIX | responsive
233
234    if ( $(window).width() < mobileInitW ) {
235
236      if ( $(window).width() < 768 ) {
237
238        // mobile
239        if (!$('body').hasClass('mobile-sticky')) {
240          stickyH = 0;
241        }
242
243      } else {
244
245        // tablet
246        if (!$('body').hasClass('tablet-sticky')) {
247          stickyH = 0;
248        }
249
250      }
251
252    } else {
253
254      // desktop
255
256      // FIX | header creative
257      if ($('body').hasClass('header-creative')) {
258        stickyH = 0;
259      }
260
261    }
262
263    return stickyH;
264  }
265
266  /**
267   * Sidebar | Sticky
268   */
269
270  function mfnSidebarSticky(){
271
272    var spacing = 0;
273
274    if( ! mfn.sidebarSticky ){
275      return false;
276    }
277
278    if( ( $('body').hasClass('sticky-header') ) && ( $(window).width() >= mobileInitW ) ){
279      spacing = 60;
280    }
281
282    sidebar = $('.mcb-sidebar .widget-area').stickySidebar({
283      topSpacing: spacing
284    });
285  }
286
287  mfnSidebarSticky();
288
289  /**
290   * Sidebar | Height
291   */
292
293  function mfnSidebar() {
294    if ($('.mcb-sidebar').length) {
295
296      var maxH = $('#Content .sections_group').outerHeight();
297
298      $('.mcb-sidebar').each(function() {
299        $(this).css('min-height', 0);
300        if ($(this).height() > maxH) {
301          maxH = $(this).height();
302        }
303      });
304
305      $('.mcb-sidebar').css('min-height', maxH + 'px');
306
307      if( sidebar ){
308        sidebar.stickySidebar('updateSticky');
309      }
310
311    }
312  }
313
314  /**
315   * Section | Full Screen
316   */
317
318  function mfnSectionH() {
319
320    var windowH = $(window).height() || 0;
321
322    // FIX | next/prev section
323    var offset = 0;
324    if ($('.section.full-screen:not(.hide-desktop)').length > 1) {
325      offset = 5;
326    }
327
328    $('.section.full-screen').each(function() {
329
330      var section = $(this),
331        wrapper = $('.section_wrapper', section);
332
333      section
334        .css('padding', 0)
335        .css('min-height', windowH + offset);
336
337      var wrapperH = wrapper.height() || 0,
338        padding = (windowH + offset - wrapperH) / 2;
339
340      if (padding < 50) padding = 50;
341
342      wrapper
343        .css('padding-top', padding + 10) // 20 = column margin-bottom / 2
344        .css('padding-bottom', padding - 10);
345    });
346  }
347
348  /**
349   * Equal Height | Wraps
350   */
351
352  function mfnEqualHeightWrap() {
353    $('.section.equal-height-wrap .section_wrapper').each(function() {
354      var maxH = 0;
355      $( '> .wrap', $(this) ).each( function() {
356        $(this).css('height', 'auto');
357        if ( $(this).innerHeight() > maxH ) {
358          maxH = $(this).innerHeight();
359        }
360      });
361      $('> .wrap', $(this)).css('height', maxH + 'px');
362    });
363  }
364
365  /**
366   * Equal Height | Items
367   */
368
369  function mfnEqualHeight() {
370    $('.section.equal-height .mcb-wrap-inner').each(function() {
371      var maxH = 0;
372
373      $('> .column', $(this)).each(function() {
374        $(this).css('height', 'auto');
375        if ($(this).height() > maxH) {
376          maxH = $(this).height();
377        }
378      });
379      $('> .column', $(this)).css('height', maxH + 'px');
380    });
381  }
382
383
384  /**
385   * Into | Full Screen
386   */
387
388  function mfnIntroH() {
389
390    var windowH = $(window).height() || 0;
391    var headerWrapperH = $('#Header_wrapper').height() || 0;
392
393    windowH = windowH - headerWrapperH - adminBarH();
394
395    $('#Intro.full-screen').each(function() {
396
397      var el = $(this),
398        inner = $('.intro-inner', el),
399        innerH = inner.height() || 0;
400
401      el.css('padding', 0).css('min-height', windowH);
402
403      var padding = ( windowH - innerH ) / 2;
404      inner.css('padding-top', padding).css('padding-bottom', padding);
405
406    });
407  }
408
409  /**
410   * Footer | Sliding | Height
411   */
412
413  function mfnFooter() {
414
415    var footerH = $('#Footer').height() || 0;
416
417    // Fixed, Sliding
418
419    if ($('.footer-fixed #Footer, .footer-sliding #Footer').length) {
420
421      footerH = footerH - 1;
422      $('#Content').css('margin-bottom', footerH + 'px');
423
424    }
425
426    // Stick to bottom
427
428    if ($('.footer-stick #Footer').length) {
429
430      var headerWrapperH = $('#Header_wrapper').height() || 0;
431
432      var headerFooterH = headerWrapperH + footerH;
433
434      var documentH = $(document).height() - adminBarH();
435
436      if ( ( documentH <= $(window).height() ) && ( headerFooterH <= $(window).height() ) ) {
437        $('#Footer').addClass('is-sticky');
438      } else {
439        $('#Footer').removeClass('is-sticky');
440      }
441
442    }
443
444  }
445
446  /**
447   * Back To Top | Sticky / Show on scroll
448   */
449
450  function backToTopSticky() {
451
452    if ($('#back_to_top.sticky.scroll').length) {
453      var el = $('#back_to_top.sticky.scroll');
454
455      // Clear Timeout if one is pending
456      if (scrollTicker) {
457        window.clearTimeout(scrollTicker);
458        scrollTicker = null;
459      }
460
461      el.addClass('focus');
462
463      // Set Timeout
464      scrollTicker = window.setTimeout(function() {
465        el.removeClass('focus');
466      }, 1500); // Timeout in msec
467
468    }
469
470  }
471
472  /**
473   * # Hash smooth navigation
474   */
475
476  function hashNav() {
477
478    var hash = window.location.hash;
479
480    if (hash) {
481
482      // FIX | Master Slider
483
484      if (hash.indexOf("&") > -1 || hash.indexOf("/") > -1) {
485        return false;
486      }
487
488      // Contact Form 7 in popup
489
490      if (hash.indexOf("wpcf7") > -1) {
491        cf7popup(hash);
492      }
493
494      if ($(hash).length) {
495
496        var offset = 0,
497          headerH = fixStickyHeaderH(),
498          tabH = $(hash).siblings('.ui-tabs-nav').innerHeight() || 0;
499
500        // header builder
501
502        if( $('body').hasClass('mhb') ){
503
504          var currentView = $('.mhb-view').filter(':visible');
505          headerH = currentView.height() || 0;
506
507        }
508
509        offset = headerH + adminBarH() + tabH;
510
511        $('html, body').animate({
512          scrollTop: $(hash).offset().top - offset
513        }, 500);
514      }
515
516    }
517
518  }
519
520  /**
521   * One Page | Scroll Active
522   */
523
524  function onePageActive() {
525    if ($('body').hasClass('one-page')) {
526
527      var stickyH = $('.sticky-header #Top_bar').innerHeight() || 0;
528      var windowT = $(window).scrollTop();
529      var start = windowT + stickyH + adminBarH() + 1;
530      var first = false;
531
532      $('[data-id]:not(.elementor-element), section[data-id]').each(function() {
533
534        if ($(this).visible(true)) {
535
536          if (!first) {
537            first = $(this);
538          } else if (($(this).offset().top < start) && ($(this).offset().top > first.offset().top)) {
539            first = $(this);
540          }
541        }
542
543        if (first) {
544
545          var newActive = first.attr('data-id');
546          var active = '[data-hash="' + newActive + '"]';
547
548          if (newActive) {
549            var menu = $('#menu, .mhb-menu');
550            menu.find('li').removeClass('current-menu-item current-menu-parent current-menu-ancestor current_page_item current_page_parent current_page_ancestor');
551            $(active, menu)
552              .closest('li').addClass('current-menu-item')
553              .closest('.menu > li').addClass('current-menu-item');
554          }
555
556        }
557
558      });
559
560    }
561  }
562
563  /**
564   * Contact Form 7 | Popup
565   */
566
567  function cf7popup(hash) {
568    if (hash && $(hash).length) {
569      var id = $(hash).closest('.popup-content').attr('id');
570
571      $('a.popup-link[href="#' + id + '"]:not(.once)')
572        .addClass('once')
573        .trigger('click');
574
575    }
576  }
577
578  /**
579   * $(document).ready
580   * Specify a function to execute when the DOM is fully loaded.
581   */
582
583  $(document).ready(function() {
584
585    /**
586     * Top Bar
587     */
588
589    $('#Top_bar').removeClass('loading');
590
591    topBarTop = parseInt($('#Top_bar').css('top'), 10);
592    if (topBarTop < 0) topBarTop = 61;
593    topBarTop = topBarTop + 'px';
594
595    /**
596     * Menu | Overlay
597     */
598
599    $('.overlay-menu-toggle').on('click',function(e) {
600      e.preventDefault();
601
602      $(this).toggleClass('focus');
603      $('#Overlay').stop(true, true).fadeToggle(500);
604
605      var menuH = $('#Overlay nav').height() || 0;
606      menuH = menuH / 2;
607
608      $('#Overlay nav').css('margin-top', '-' + menuH + 'px');
609    });
610
611    $('#Overlay').on('click', '.menu-item > a', function() {
612      $('.overlay-menu-toggle').trigger('click');
613    });
614
615    $( '.header-overlay' ).on( 'keydown', function(event) {
616      if ( 27 == event.keyCode ) {
617        $('.overlay-menu-toggle.focus').trigger('click');
618      }
619    });
620
621    /**
622     * Menu | Responsive | button
623     */
624
625    $('.responsive-menu-toggle').on('click', function(e) {
626      e.preventDefault();
627
628      var el = $(this);
629      var menu = $('#Top_bar #menu');
630      var menuWrap = menu.closest('.top_bar_left');
631
632      el.toggleClass('active');
633
634      // sticky menu button
635      if (el.hasClass('is-sticky') && el.hasClass('active') && (window.innerWidth < 768)) {
636
637        var top = 0;
638        if (menuWrap.length) {
639          top = menuWrap.offset().top - adminBarH();
640        }
641        $('body,html').animate({
642          scrollTop: top
643        }, 200);
644
645      }
646
647      menu.stop(true, true).slideToggle(200);
648    });
649
650    /**
651     * Menu | Responsive | Side Slide
652     */
653
654    function sideSlide() {
655
656      var slide = $('#Side_slide');
657      var overlay = $('#body_overlay');
658      var ssMobileInitW = mobileInitW;
659      var pos = 'right';
660
661      var shiftSlide = -slide.data('width');
662      var shiftBody = shiftSlide / 2;
663
664      // constructor
665
666      var constructor = function() {
667        if (!slide.hasClass('enabled')) {
668          $('nav#menu').detach().appendTo('#Side_slide .menu_wrapper');
669          slide.addClass('enabled');
670        }
671      };
672
673      // destructor
674
675      var destructor = function() {
676        if (slide.hasClass('enabled')) {
677          close();
678          $('nav#menu').detach().prependTo('#Top_bar .menu_wrapper');
679          slide.removeClass('enabled');
680        }
681      };
682
683      // reload
684
685      var reload = function() {
686
687        if ( ( window.innerWidth < ssMobileInitW ) ) {
688          constructor();
689        } else {
690          destructor();
691        }
692      };
693
694      // init
695
696      var init = function() {
697
698        if (slide.hasClass('left')) {
699          pos = 'left';
700        }
701
702        // responsive off
703        if ($('body').hasClass('responsive-off')) {
704          ssMobileInitW = 0;
705        }
706
707        // header simple
708        if ($('body').hasClass('header-simple')) {
709          ssMobileInitW = 9999;
710        }
711
712        reload();
713      };
714
715      // reset to default
716
717      var reset = function(time) {
718
719        $('.lang-active.active', slide).removeClass('active').children('i').attr('class', 'icon-down-open-mini');
720        $('.lang-wrapper', slide).fadeOut(0);
721
722        $('.icon.search.active', slide).removeClass('active');
723        $('.search-wrapper', slide).fadeOut(0);
724
725        $('.menu_wrapper, .social', slide).fadeIn(time);
726
727      };
728
729      // menu button
730
731      var button = function() {
732
733        // show
734
735        if (pos == 'left') {
736          slide.animate({
737            'left': 0
738          }, 300);
739          $('body').animate({
740            'right': shiftBody
741          }, 300);
742        } else {
743          slide.animate({
744            'right': 0
745          }, 300);
746          $('body').animate({
747            'left': shiftBody
748          }, 300);
749        }
750
751        overlay.fadeIn(300);
752
753        // reset
754
755        reset(0);
756
757      };
758
759      // close
760
761      var close = function() {
762
763        if (pos == 'left') {
764          slide.animate({
765            'left': shiftSlide
766          }, 300);
767          $('body').animate({
768            'right': 0
769          }, 300);
770        } else {
771          slide.animate({
772            'right': shiftSlide
773          }, 300);
774          $('body').animate({
775            'left': 0
776          }, 300);
777        }
778
779        overlay.fadeOut(300);
780
781        // if page contains revolution slider, trigger resize
782
783        if ($('.rev_slider').length) {
784          setTimeout(function() {
785            $(window).trigger('resize');
786          }, 300);
787        }
788
789      };
790
791      // search
792
793      $('.icon.search', slide).on('click', function(e) {
794
795        e.preventDefault();
796
797        var el = $(this);
798
799        if (el.hasClass('active')) {
800
801          $('.search-wrapper', slide).fadeOut(0);
802          $('.menu_wrapper, .social', slide).fadeIn(300);
803
804        } else {
805
806          $('.search-wrapper', slide).fadeIn(300);
807          $('.menu_wrapper, .social', slide).fadeOut(0);
808
809          $('.lang-active.active', slide).removeClass('active').children('i').attr('class', 'icon-down-open-mini');
810          $('.lang-wrapper', slide).fadeOut(0);
811
812        }
813
814        el.toggleClass('active');
815      });
816
817      // search form submit
818
819      $('a.submit', slide).on('click', function(e) {
820        e.preventDefault();
821        $('#side-form').submit();
822      });
823
824      // lang menu
825
826      $('.lang-active', slide).on('click', function(e) {
827        e.preventDefault();
828
829        var el = $(this);
830
831        if (el.hasClass('active')) {
832
833          $('.lang-wrapper', slide).fadeOut(0);
834          $('.menu_wrapper, .social', slide).fadeIn(300);
835          el.children('i').attr('class', 'icon-down-open-mini');
836
837        } else {
838
839          $('.lang-wrapper', slide).fadeIn(300);
840          $('.menu_wrapper, .social', slide).fadeOut(0);
841          el.children('i').attr('class', 'icon-up-open-mini');
842
843          $('.icon.search.active', slide).removeClass('active');
844          $('.search-wrapper', slide).fadeOut(0);
845
846        }
847
848        el.toggleClass('active');
849      });
850
851      // init, click, debouncedresize
852
853      // init
854
855      init();
856
857      // click | menu button
858
859      $('.responsive-menu-toggle').off('click');
860
861      $('.responsive-menu-toggle').on('click', function(e) {
862        e.preventDefault();
863        button();
864      });
865
866      // click | close
867
868      overlay.on('click', function(e) {
869        close();
870      });
871
872      $('.close', slide).on('click', function(e) {
873        e.preventDefault();
874        close();
875      });
876
877      // click | below search or languages menu
878
879      $(slide).on('click', function(e) {
880        if ($(e.target).is(slide)) {
881          reset(300);
882        }
883      });
884
885      // debouncedresize
886
887      $(window).on('debouncedresize', reload);
888
889    }
890
891    if ($('body').hasClass('mobile-side-slide')) {
892      sideSlide();
893    }
894
895    /**
896     * Gallery | WordPress Gallery
897     */
898
899    // WordPress <= 4.9 | content
900
901    $('.sections_group .gallery, .elementor-section .gallery').each(function() {
902
903      var el = $(this);
904      var id = el.attr('id');
905
906      $('> br', el).remove();
907
908      $('.gallery-icon > a', el)
909        .wrap('<div class="image_frame scale-with-grid"><div class="image_wrapper"></div></div>')
910        .prepend('<div class="mask"></div>')
911        .children('img')
912        .css('height', 'auto')
913        .css('width', '100%');
914
915      // lightbox | link to media file
916
917      if (el.hasClass('file')) {
918        $('.gallery-icon a', el)
919          .attr('rel', 'prettyphoto[' + id + ']')
920          .attr('data-elementor-lightbox-slideshow', id); // FIX: elementor lightbox gallery
921      }
922
923      // isotope for masonry layout
924
925      if (el.hasClass('masonry')) {
926
927        el.isotope({
928          itemSelector: '.gallery-item',
929          layoutMode: 'masonry',
930          isOriginLeft: rtl ? false : true
931        });
932
933      }
934
935    });
936
937    // WordPress >
937= 5.0 | content
938
939    $('.sections_group .wp-block-gallery').each(function(index) {
940
941      var el = $(this);
942      var link = $('.blocks-gallery-item a', el);
943
944      // lightbox | link to media file
945
946      if ((/\.(gif|jpg|jpeg|png)$/i).test(link.attr('href'))) {
947        link.attr('rel', 'prettyphoto[wp5-gallery-' + index + ']');
948      }
949
950    });
951
952    // widgets
953
954    $('.widget_media_gallery .gallery').each(function() {
955
956      var el = $(this);
957      var id = el.attr('id');
958
959      // lightbox | link to media file
960
961      $('.gallery-icon a', el).attr('rel', 'prettyphoto[widget-' + id + ']');
962
963    });
964
965    /**
966     * Lightbox | PrettyPhoto
967     */
968
969    $('a[rel^="prettyphoto[portfolio]"]').each(function() {
970
971      var el = $(this);
972      var parent = el.closest('.column');
973      var index = $('.column').index(parent);
974
975      el.attr('rel', 'prettyphoto[portfolio-' + index + ']');
976
977    });
978
979    /**
980     * Lightbox | Magnific Popup
981     * with prettyPhoto backward compatibility
982     */
983
984    function lightbox() {
985
986      var galleries = [];
987
988      // init
989
990      var init = function() {
991
992        if (lightboxAttr) {
993          compatibility();
994          setType();
995          constructor();
996        }
997
998      };
999
1000      // backward compatibility for prettyPhoto
1001
1002      var compatibility = function() {
1003
1004        $('a[rel^="prettyphoto"], a.prettyphoto, a[rel^="prettyphoto"]').each(function() {
1005
1006          var el = $(this);
1007          var rel = el.attr('rel');
1008
1009          if (rel) {
1010            rel = rel.replace('prettyphoto', 'lightbox');
1011          } else {
1012            rel = 'lightbox';
1013          }
1014
1015          el.removeClass('prettyphoto').attr('rel', rel);
1016
1017        });
1018
1019      };
1020
1021      // check if item is a part of gallery
1022
1023      var isGallery = function(rel) {
1024
1025        if (!rel) {
1026          return false;
1027        }
1028
1029        var regExp = /\[(?:.*)\]/;
1030        var gallery = regExp.exec(rel);
1031
1032        if (gallery) {
1033          gallery = gallery[0];
1034          gallery = gallery.replace('[', '').replace(']', '');
1035          return gallery;
1036        }
1037
1038        return false;
1039      };
1040
1041      // set array of names of galleries
1042
1043      var setGallery = function(gallery) {
1044
1045        if (galleries.indexOf(gallery) == -1) {
1046          galleries.push(gallery);
1047          return true;
1048        }
1049
1050        return false;
1051      };
1052
1053      // get file type by link
1054
1055      var getType = function(src) {
1056
1057        if (src.match(/youtube\.com\/watch/i) || src.match(/youtube\.com\/embed/i) || src.match(/youtu\.be/i)) {
1058          return 'iframe';
1059
1060        } else if (src.match(/youtube-nocookie\.com/i)) {
1061          return 'iframe';
1062
1063        } else if (src.match(/vimeo\.com/i)) {
1064          return 'iframe';
1065
1066        } else if (src.match(/\biframe=true\b/i)) {
1067          return 'ajax';
1068
1069        } else if (src.match(/\bajax=true\b/i)) {
1070          return 'ajax';
1071
1072        } else if (src.substr(0, 1) == '#') {
1073          return 'inline';
1074
1075        } else {
1076          return 'image';
1077
1078        }
1079      };
1080
1081      // set file type
1082
1083      var setType = function() {
1084
1085        $('a[rel^="lightbox"]').each(function() {
1086
1087          var el = $(this);
1088          var href = el.attr('href');
1089          var rel = el.attr('rel');
1090
1091          // FIX: WPBakery Page Builder duplicated lightbox
1092          if ( el.closest('.wpb_column').length ){
1093            return true;
1094          }
1095
1096          if (href) {
1097
1098            // gallery
1099
1100            var gallery = isGallery(rel);
1101
1102            if (gallery) {
1103              el.attr('data-type', 'gallery');
1104              setGallery(gallery);
1105              return true;
1106            }
1107
1108            el.attr('data-type', getType(href));
1109
1110            // iframe paremeters
1111
1112            if (getType(href) == 'iframe') {
1113              el.attr('href', href.replace('&rel=0', ''));
1114            }
1115          }
1116
1117        });
1118
1119      };
1120
1121      // constructor
1122
1123      var constructor = function() {
1124
1125        var attr = {
1126          autoFocusLast: false,
1127          removalDelay: 160,
1128          image: {
1129            titleSrc: function(item) {
1130              var img = item.el.closest('.image_wrapper, li').find('img').first();
1131              if (lightboxAttr.title && img.length) {
1132                return img.attr('alt');
1133              } else {
1134                return false;
1135              }
1136            }
1137          }
1138        };
1139
1140        // image
1141
1142        $('a[rel^="lightbox"][data-type="image"]').magnificPopup({
1143          autoFocusLast: attr.autoFocusLast,
1144          removalDelay: attr.removalDelay,
1145          type: 'image',
1146          image: attr.image
1147        });
1148
1149        // iframe | video
1150
1151        $('a[rel^="lightbox"][data-type="iframe"]').magnificPopup({
1152          autoFocusLast: attr.autoFocusLast,
1153          removalDelay: attr.removalDelay,
1154          type: 'iframe',
1155          iframe: {
1156            patterns: {
1157              youtube: {
1158                index: 'youtube.com/',
1159                id: 'v=',
1160                src: '//www.youtube.com/embed/%id%?autoplay=1&rel=0'
1161              },
1162              youtu_be: {
1163                index: 'youtu.be/',
1164                id: '/',
1165                src: '//www.youtube.com/embed/%id%?autoplay=1&rel=0'
1166              },
1167              nocookie: {
1168                index: 'youtube-nocookie.com/embed/',
1169                id: '/',
1170                src: '//www.youtube-nocookie.com/embed/%id%?autoplay=1&rel=0'
1171              }
1172            }
1173          }
1174        });
1175
1176        // inline
1177
1178        $('a[rel^="lightbox"][data-type="inline"]').magnificPopup({
1179          autoFocusLast: attr.autoFocusLast,
1180          type: 'inline',
1181          midClick: true,
1182          callbacks: {
1183            open: function() {
1184              $('.mfp-content').children().addClass('mfp-inline');
1185            },
1186            beforeClose: function() {
1187              $('.mfp-content').children().removeClass('mfp-inline');
1188            }
1189          }
1190        });
1191
1192        // gallery
1193
1194        for (var i = 0, len = galleries.length; i < len; i++) {
1195
1196          var gallery = '[' + galleries[i] + ']';
1197          gallery = 'a[rel^="lightbox' + gallery + '"]:visible';
1198
1199          $(gallery).magnificPopup({
1200            autoFocusLast: attr.autoFocusLast,
1201            removalDelay: attr.removalDelay,
1202            type: 'image',
1203            image: attr.image,
1204            gallery: {
1205              enabled: true,
1206              tCounter: '<span class="mfp-counter">%curr% / %total%</span>' // markup of counter
1207            }
1208          });
1209        }
1210
1211        // FIX: disable in Elementor wrapper
1212
1213        $('.elementor a[rel^="lightbox"]:not(.popup-link)').off('click');
1214
1215      };
1216
1217      // reload
1218
1219      var reload = function() {
1220
1221        $('a[rel^="lightbox"]').off('click');
1222        constructor();
1223
1224      };
1225
1226      // init
1227
1228      init();
1229
1230      // isotope:arrange
1231
1232      $(document).on('isotope:arrange', reload);
1233
1234    }
1235
1236    lightbox();
1237
1238    /**
1239     * Menu | mfnMenu
1240     */
1241
1242    function mainMenu() {
1243
1244      var mmMobileInitW = mobileInitW;
1245
1246      if ($('body').hasClass('header-simple') || $('#Header_creative.dropdown').length) {
1247        mmMobileInitW = 9999;
1248      }
1249
1250      $('#menu > ul.menu').mfnMenu({
1251        addLast: true,
1252        arrows: true,
1253        mobileInit: mmMobileInitW,
1254        responsive: mfn.responsive
1255      });
1256
1257      $('#secondary-menu > ul.secondary-menu').mfnMenu({
1258        mobileInit: mmMobileInitW,
1259        responsive: mfn.responsive
1260      });
1261
1262    }
1263
1264    mainMenu();
1265
1266    /**
1267     * Menu | NOT One Page | .scroll item
1268     * Works with .scroll class
1269     * Since 4.8 replaced with: Page Options > One Page | function: onePageMenu()
1270     */
1271
1272    function onePageScroll() {
1273      if (!$('body').hasClass('one-page')) {
1274        var menu = $('#menu');
1275
1276        if (menu.find('li.scroll').length > 1) {
1277          menu.find('li.current-menu-item:not(:first)').removeClass('current-menu-item currenet-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor');
1278
1279          // menu item click
1280          menu.on('click','a',function() {
1281            $(this).closest('li').siblings('li').removeClass('current-menu-item currenet-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor');
1282            $(this).closest('li').addClass('current-menu-item');
1283          });
1284        }
1285      }
1286    }
1287    onePageScroll();
1288
1289    /**
1290     * Menu | One Page | Active on Scroll & Click
1291     */
1292
1293    function onePageMenu() {
1294      if ($('body').hasClass('one-page')) {
1295
1296        var menu = $('#menu');
1297
1298        // add attr [data-hash] & [data-id]
1299
1300        $('a[href]', menu).each(function() {
1301
1302          var url = $(this).attr('href');
1303          if (url && url.split('#')[1]) {
1304
1305            // data-hash
1306            var hash = '#' + url.split('#')[1];
1307            if (hash && $(hash).length) {
1308              // check if element with specified ID exists
1309              $(this).attr('data-hash', hash);
1310              $(hash).attr('data-id', hash);
1311            }
1312
1313            // Visual Composer
1314            var vcHash = '#' + url.split('#')[1];
1315            var vcClass = '.vc_row.' + url.split('#')[1];
1316            if (vcClass && $(vcClass).length) {
1317              // check if element with specified Class exists
1318              $(this).attr('data-hash', vcHash);
1319              $(vcClass).attr('data-id', vcHash);
1320            }
1321
1322          }
1323
1324        });
1325
1326        // active
1327
1328        var hash;
1329        var activeSelector = '.menu > li.current-menu-item, .menu > li.current-menu-parent, .menu > li.current-menu-ancestor, .menu > li.current-page-ancestor, .menu > li.current_page_item, .menu > li.current_page_parent, .menu > li.current_page_ancestor';
1330        var activeClasses = 'current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor';
1331
1332        if ($(activeSelector, menu).length) {
1333
1334          // remove duplicated
1335          $(activeSelector, menu)
1336            .not(':first').removeClass(activeClasses);
1337
1338          // remove if 1st link to section & section is not visible
1339          hash = $(activeSelector, menu).find('a[data-hash]').attr('data-hash');
1340
1341          if (hash) {
1342            hash = '[data-id="' + hash + '"]';
1343
1344            if ($(hash).length && $(hash).visible(true)) {
1345              // do nothing
1346            } else {
1347              $(activeSelector, menu).removeClass('current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor')
1348                .closest('.menu > li').removeClass('current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor');
1349            }
1350          } else {
1351            // do nothing
1352          }
1353
1354        } else {
1355
1356          // add to first if none is active
1357          var first = $('.menu:first-child > li:first-child', menu);
1358          var firstA = first.children('a');
1359
1360          if (firstA.attr('data-hash')) {
1361            hash = firstA.attr('data-hash');
1362            hash = '[data-id="' + hash + '"]';
1363
1364            if ($(hash).length && ($(hash).offset().top == adminBarH())) {
1365              first.addClass('current-menu-item');
1366            }
1367          }
1368
1369        }
1370
1371        // click
1372
1373        $('#menu a[data-hash]').on('click', function(e) {
1374          e.preventDefault(); // only with: body.one-page
1375
1376          // active
1377
1378          menu.find('li').removeClass('current-menu-item');
1379          $(this)
1380            .closest('li').addClass('current-menu-item')
1381            .closest('.menu > li').addClass('current-menu-item');
1382
1383          var hash = $(this).attr('data-hash');
1384          hash = '[data-id="' + hash + '"]';
1385
1386          // mobile - sticky header - close menu
1387
1388          if ( window.innerWidth < 768 ) {
1389            $('.responsive-menu-toggle').removeClass('active');
1390            $('#Top_bar #menu').hide();
1391          }
1392
1393          // offset
1394
1395          var headerFixedAbH = $('.header-fixed.ab-show #Action_bar').innerHeight() || 0;
1396          var tabsHeaderH = $(hash).siblings('.ui-tabs-nav').innerHeight() || 0;
1397
1398          var offset = headerFixedAbH + tabsHeaderH + adminBarH();
1399
1400          // sticky height
1401
1402          var stickyH = fixStickyHeaderH();
1403
1404          // FIX | Header below | 1st section
1405          if ($('body').hasClass('header-below') && $('#Content').length) {
1406            if ($(hash).offset().top < ($('#Content').offset().top + 60)) {
1407              stickyH = -1;
1408            }
1409          }
1410
1411          // animate scroll
1412
1413          $('html, body').animate({
1414            scrollTop: $(hash).offset().top - offset - stickyH
1415          }, 500);
1416
1417        });
1418
1419      }
1420    }
1421    onePageMenu();
1422
1423    /**
1424     * Header | Creative
1425     */
1426
1427    var cHeader = 'body:not( .header-open ) #Header_creative',
1428      cHeaderEl = $(cHeader),
1429      cHeaderCurrnet;
1430
1431    function creativeHeader() {
1432
1433      $('.creative-menu-toggle').on('click', function(e) {
1434        e.preventDefault();
1435
1436        cHeaderEl.addClass('active');
1437        $('.creative-menu-toggle, .creative-social', cHeaderEl).fadeOut(500);
1438        $('#Action_bar', cHeaderEl).fadeIn(500);
1439
1440      });
1441
1442    }
1443    creativeHeader();
1444
1445    $(document).on('mouseenter', cHeader, function() {
1446      cHeaderCurrnet = 1;
1447    });
1448
1449    $(document).on('mouseleave', cHeader, function() {
1450      cHeaderCurrnet = null;
1451      setTimeout(function() {
1452        if (!cHeaderCurrnet) {
1453
1454          cHeaderEl.removeClass('active');
1455          $('.creative-menu-toggle, .creative-social', cHeaderEl).fadeIn(500);
1456          $('#Action_bar', cHeaderEl).fadeOut(500);
1457
1458        }
1459      }, 1000);
1460    });
1461
1462    // Fix: Header Creative & Mobile Sticky | On Resize > 768 px
1463    function creativeHeaderFix() {
1464      if ( $('body').hasClass('header-creative') && window.innerWidth >= 768 ) {
1465        if ($('#Top_bar').hasClass('is-sticky')) {
1466          $('#Top_bar').removeClass('is-sticky');
1467        }
1468      }
1469    }
1470
1471    /**
1472     * Header | Search
1473     */
1474
1475    $("#search_button:not(.has-input), #Top_bar .icon_close").on('click', function(e) {
1476      e.preventDefault();
1477      $('#Top_bar .search_wrapper').fadeToggle()
1478        .find('.field').focus();
1479    });
1480
1481    /**
1482     * WPML | Language switcher in the WP Menu
1483     */
1484
1485    function mfnWPML() {
1486      $('#menu .menu-item-language:not(.menu-item-language-current)').each(function() {
1487        var el = $(this).children('a');
1488
1489        if (!el.children('span:not(.icl_lang_sel_bracket)').length) {
1490          el.wrapInner('<span></span>');
1491        }
1492
1493      });
1494
1495      $('#menu span.icl_lang_sel_bracket').each(function() {
1496        var el = $(this);
1497        el.replaceWith(el.html());
1498      });
1499
1500    }
1501    mfnWPML();
1502
1503    /**
1504     * Breadcrumbs | Remove last item link
1505     */
1506
1507    function breadcrumbsRemoveLastLink() {
1508      var el = $('.breadcrumbs.no-link').find('li').last();
1509      var text = el.text();
1510      el.html(text);
1511    }
1512    breadcrumbsRemoveLastLink();
1513
1514    /**
1515     * Downcount
1516     */
1517
1518    $('.downcount').each(function() {
1519      var el = $(this);
1520      el.downCount({
1521        date: el.attr('data-date'),
1522        offset: el.attr('data-offset')
1523      });
1524    });
1525
1526    /**
1527     * Hover | on Touch | .tooltip, .hover_box
1528     */
1529
1530    $('.tooltip, .hover_box')
1531      .on('touchstart', function() {
1532        $(this).toggleClass('hover');
1533      })
1534      .on('touchend', function() {
1535        $(this).removeClass('hover');
1536      });
1537
1538    /**
1539     * Popup | Contact Form | Button
1540     */
1541
1542    $("#popup_contact .footer_button").on('click', function(e) {
1543      e.preventDefault();
1544      $(this).parent().toggleClass('focus');
1545    });
1546
1547    /**
1548     * Scroll | niceScroll for Header Creative
1549     */
1550
1551    if ( ('#Header_creative.scroll').length && window.innerWidth >= 1240 ) {
1552      $('#Header_creative.scroll').niceScroll({
1553        autohidemode: false,
1554        cursorborder: 0,
1555        cursorborderradius: 5,
1556        cursorcolor: '#222222',
1557        cursorwidth: 0,
1558        horizrailenabled: false,
1559        mousescrollstep: 40,
1560        scrollspeed: 60
1561      });
1562    }
1563
1564    /**
1565     * Sliding Top
1566     */
1567
1568    $('.sliding-top-control').on('click', function(e) {
1569      e.preventDefault();
1570      $('#Sliding-top .widgets_wrapper').slideToggle();
1571      $('#Sliding-top').toggleClass('active');
1572    });
1573
1574    /**
1575     * Alert
1576     */
1577
1578    $('body').on('click', '.alert .close', function(e) {
1579      e.preventDefault();
1580      $(this).closest('.alert').hide(300);
1581    });
1582
1583    /**
1584     * Navigation Arrows | Sticky
1585     */
1586
1587    $('.fixed-nav').appendTo('body');
1588
1589    /**
1590     * Feature List
1591     */
1592
1593    $('.feature_list').each(function() {
1594      var col = $(this).attr('data-col') ? $(this).attr('data-col') : 4;
1595      $(this).find('li:nth-child(' + col + 'n):not(:last-child)').after('<hr />');
1596    });
1597
1598    /**
1599     * IE Fixes
1600     */
1601
1602    function checkIE() {
1603      // IE 9
1604      var ua = window.navigator.userAgent;
1605      var msie = ua.indexOf("MSIE ");
1606      if (msie > 0 && parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))) == 9) {
1607        $("body").addClass("ie");
1608      }
1609    }
1610    checkIE();
1611
1612    /**
1613     * Parallax
1614     */
1615
1616    var ua = navigator.userAgent,
1617      isMobileWebkit = /WebKit/.test(ua) && /Mobile/.test(ua);
1618
1619    if ( ! isMobileWebkit && window.innerWidth >= 768 ) {
1620
1621      if (mfn.parallax == 'stellar') {
1622
1623        // Stellar
1624        $.stellar({
1625          horizontalScrolling: false,
1626          responsive: true
1627        });
1628
1629      } else {
1630
1631        // Enllax
1632        $(window).enllax();
1633
1634      }
1635
1636    } else {
1637
1638      $('div[data-enllax-ratio], div[data-stellar-ratio]').css('background-attachment', 'scroll');
1639
1640    }
1641
1642    /**
1643     * Load More | Ajax
1644     */
1645
1646    $('.pager_load_more').on('click', function(e) {
1647      e.preventDefault();
1648
1649      var el = $(this);
1650      var pager = el.closest('.pager_lm');
1651      var href = el.attr('href');
1652
1653      // index | for many items on the page
1654      var index = $('.lm_wrapper').index(el.closest('.isotope_wrapper').find('.lm_wrapper'));
1655
1656      el.fadeOut(50);
1657      pager.addClass('loading');
1658
1659      $.get( href, function( data ) {
1660
1661        // content
1662
1663        var content = $('.lm_wrapper:eq(' + index + ')', data).wrapInner('').html();
1664        var $content = $(content);
1665
1666        if ($('.lm_wrapper:eq(' + index + ')').hasClass('isotope')) {
1667
1668          // isotope
1669          $('.lm_wrapper:eq(' + index + ')').append( $content ).isotope('appended', $content);
1670
1671        } else {
1672
1673          // default
1674          $content.hide().appendTo('.lm_wrapper:eq(' + index + ')').fadeIn(1000);
1675
1676        }
1677
1678        // next page link
1679
1680        href = $('.lm_wrapper:eq(' + index + ')', data).next().find('.pager_load_more').attr('href');
1681        pager.removeClass('loading');
1682        if (href) {
1683          el.fadeIn();
1684          el.attr('href', href);
1685        }
1686
1687        // refresh some staff
1688
1689        mfnJPlayer();
1690        lightbox();
1691
1692        // isotope fix: second resize
1693
1694        $('.lm_wrapper.isotope').imagesLoaded().progress(function() {
1695          $('.lm_wrapper.isotope').isotope();
1696        });
1697
1698      });
1699
1700    });
1701
1702    /**
1703     * Filters | Blog & Portfolio
1704     */
1705
1706    $('.filters_buttons .open').on('click', function(e) {
1707      e.preventDefault();
1708      var type = $(this).closest('li').attr('class');
1709
1710      $('.filters_wrapper').show(200);
1711      $('.filters_wrapper ul.' + type).show(200);
1712      $('.filters_wrapper ul:not(.' + type + ')').hide();
1713    });
1714
1715    $('.filters_wrapper .close a').on('click', function(e) {
1716      e.preventDefault();
1717      $('.filters_wrapper').hide(200);
1718    });
1719
1720    /**
1721     * Portfolio List | Next v / Prev ^ buttons
1722     */
1723
1724    $('.portfolio_next_js').on('click', function(e) {
1725      e.preventDefault();
1726
1727      var item = $(this).closest('.portfolio-item').next();
1728
1729      if (item.length) {
1730        $('html, body').animate({
1731          scrollTop: item.offset().top - fixStickyHeaderH()
1732        }, 500);
1733      }
1734    });
1735
1736    $('.portfolio_prev_js').on('click', function(e) {
1737      e.preventDefault();
1738
1739      var item = $(this).closest('.portfolio-item').prev();
1740
1741      if (item.length) {
1742        $('html, body').animate({
1743          scrollTop: item.offset().top - fixStickyHeaderH()
1744        }, 500);
1745      }
1746    });
1747
1748    /**
1749     * Link | Smooth Scroll | .scroll
1750     */
1751
1752    $('.scroll > a, a.scroll').on('click', function(e) {
1753
1754      // prevent default if link directs to the current page
1755
1756      var urlL = location.href.replace(/\/#.*|#.*/, '');
1757      var urlT = this.href.replace(/\/#.*|#.*/, '');
1758
1759      if (urlL == urlT) {
1760        e.preventDefault();
1761      }
1762
1763      var hash = this.hash;
1764
1765      // offset
1766
1767      var headerFixedAbH = $('.header-fixed.ab-show #Action_bar').innerHeight() || 0;
1768      var tabsHeaderH = $(hash).siblings('.ui-tabs-nav').innerHeight() || 0;
1769
1770      var offset = headerFixedAbH + tabsHeaderH + adminBarH();
1771
1772      // animate scroll
1773
1774      if (hash && $(hash).length) {
1775
1776        $('html, body').animate({
1777          scrollTop: $(hash).offset().top - offset - fixStickyHeaderH()
1778        }, 500);
1779      }
1780    });
1781
1782    /**
1783     * Tabs
1784     */
1785
1786    $('.jq-tabs').tabs();
1787
1788    /**
1789     * Accordion & FAQ
1790     */
1791
1792    $('.mfn-acc').each(function() {
1793      var el = $(this);
1794
1795      if (el.hasClass('openAll')) {
1796
1797        // show all
1798        el.find('.question')
1799          .addClass("active")
1800          .children(".answer")
1801          .show();
1802
1803      } else {
1804
1805        // show one
1806        var activeTab = el.attr('data-active-tab');
1807        if (el.hasClass('open1st')) activeTab = 1;
1808
1809        if (activeTab) {
1810          el.find('.question').eq(activeTab - 1)
1811            .addClass("active")
1812            .children(".answer")
1813            .show();
1814        }
1815
1816      }
1817    });
1818
1819    $('.mfn-acc .question > .title').on('click', function() {
1820
1821      if ($(this).parent().hasClass("active")) {
1822
1823        $(this).parent().removeClass("active").children(".answer").slideToggle(100);
1824
1825      } else {
1826
1827        if (!$(this).closest('.mfn-acc').hasClass('toggle')) {
1828          $(this).parents(".mfn-acc").children().each(function() {
1829            if ($(this).hasClass("active")) {
1830              $(this).removeClass("active").children(".answer").slideToggle(100);
1831            }
1832          });
1833        }
1834        $(this).parent().addClass("active");
1835        $(this).next(".answer").slideToggle(100);
1836
1837      }
1838
1839      setTimeout(function() {
1840        $(window).trigger('resize');
1841      }, 50);
1842
1843    });
1844
1845    // Visual Composer | Accordion | Sidebar height
1846    $('.wpb_wrapper .vc_tta-panel-title').on('click', 'a', function() {
1847
1848      setTimeout(function() {
1849        $(window).trigger('resize');
1850      }, 50);
1851
1852    });
1853
1854    /**
1855     * Helper
1856     */
1857
1858    $('.helper .link.toggle').on('click', function(e) {
1859
1860      e.preventDefault();
1861
1862      var el = $(this);
1863      var id = el.attr('data-rel');
1864      var parent = el.closest('.helper');
1865
1866      if (el.hasClass('active')) {
1867
1868        el.removeClass('active');
1869        parent.find('.helper_content > .item-' + id).removeClass('active').slideUp(200);
1870
1871      } else {
1872
1873        parent.find('.links > .link.active').removeClass('active');
1874        parent.find('.helper_content > .item.active').slideUp(200);
1875
1876        el.addClass('active');
1877        parent.find('.helper_content > .item-' + id).addClass('active').slideDown(200);
1878
1879      }
1880
1881      setTimeout(function() {
1882        $(window).trigger('resize');
1883      }, 50);
1884
1885    });
1886
1887    /**
1888     * HTML5 Video | jPlayer
1889     */
1890
1891    function mfnJPlayer() {
1892      $('.mfn-jplayer').each(function() {
1893
1894        var m4v = $(this).attr('data-m4v'),
1895          poster = $(this).attr('data-img'),
1896          swfPath = $(this).attr('data-swf'),
1897          cssSelectorAncestor = '#' + $(this).closest('.mfn-jcontainer').attr('id');
1898
1899        $(this).jPlayer({
1900          ready: function() {
1901            $(this).jPlayer('setMedia', {
1902              m4v: m4v,
1903              poster: poster
1904            });
1905          },
1906          play: function() {
1907            // To avoid both jPlayers playing together.
1908            $(this).jPlayer('pauseOthers');
1909          },
1910          size: {
1911            cssClass: 'jp-video-360p',
1912            width: '100%',
1913            height: '360px'
1914          },
1915          swfPath: swfPath,
1916          supplied: 'm4v',
1917          cssSelectorAncestor: cssSelectorAncestor,
1918          wmode: 'opaque'
1919        });
1920      });
1921    }
1922    mfnJPlayer();
1923
1924    /**
1925     * Love
1926     */
1927
1928    $('.mfn-love').on('click', function() {
1929      var el = $(this);
1930
1931      if (el.hasClass('loved')) {
1932        return false;
1933      }
1934      el.addClass('loved');
1935
1936      var post = {
1937        action: 'mfn_love',
1938        post_id: el.attr('data-id')
1939      };
1940
1941      $.post(mfn.ajax, post, function(data) {
1942        el.find('.label').html(data);
1943      });
1944
1945      return false;
1946    });
1947
1948    /**
1949     * Go to top
1950     */
1951
1952    $('#back_to_top').on('click', function() {
1953      $('body,html').animate({
1954        scrollTop: 0
1955      }, 500);
1956      return false;
1957    });
1958
1959    /**
1960     * Section | Next v / Prev ^ arrows
1961     */
1962
1963    $('.section .section-nav').on('click', function() {
1964
1965      var el = $(this);
1966      var section = el.closest('.section');
1967
1968      if (el.hasClass('prev')) {
1969
1970        // Previous Section
1971        if (section.prev().length) {
1972          $('html, body').animate({
1973            scrollTop: section.prev().offset().top
1974          }, 500);
1975        }
1976
1977      } else {
1978
1979        // Next Section
1980        if (section.next().length) {
1981          $('html, body').animate({
1982            scrollTop: section.next().offset().top
1983          }, 500);
1984        }
1985
1986      }
1987    });
1988
1989    /**
1990     * Intro | Scroll v arrow
1991     */
1992
1993    $('#Intro .intro-next').on('click', function() {
1994      var intro = $(this).closest('#Intro');
1995
1996      if (intro.next().length) {
1997        $('html, body').animate({
1998          scrollTop: intro.next().offset().top - fixStickyHeaderH() - adminBarH()
1999        }, 500);
2000      }
2001    });
2002
2003    /**
2004     * Widget | Muffin Menu | Hover on click
2005     */
2006
2007    $('.widget_mfn_menu ul.submenus-click').each(function() {
2008
2009      var el = $(this);
2010
2011      $('a', el).on('click', function(e) {
2012        var li = $(this).closest('li');
2013
2014        if (li.hasClass('hover') || !li.hasClass('menu-item-has-children')) {
2015          // link click
2016        } else {
2017          e.preventDefault();
2018          li.siblings('li').removeClass('hover')
2019            .find('li').removeClass('hover');
2020          $(this).closest('li').addClass('hover');
2021        }
2022
2023      });
2024
2025    });
2026
2027    /**
2028     * WooCommerce | Add to cart
2029     */
2030
2031    function addToCart() {
2032
2033      $('body').on('click', '.add_to_cart_button', function() {
2034        $(this)
2035          .closest('.product')
2036          .addClass('adding-to-cart')
2037          .removeClass('added-to-cart');
2038      });
2039
2040      $('body').on('added_to_cart', function() {
2041        $('.adding-to-cart')
2042          .removeClass('adding-to-cart')
2043          .addClass('added-to-cart');
2044      });
2045    }
2046    addToCart();
2047
2048    /**
2049     * WooCommerce | Rating click
2050     */
2051
2052    $('.woocommerce-product-rating').on('click', function(){
2053
2054      var el;
2055
2056      if( $('.woocommerce-content .jq-tabs').length ){
2057
2058        el = $('.woocommerce-content .jq-tabs');
2059        $('.ui-tabs-nav a[href="#tab-reviews"]', el).trigger('click');
2060
2061      } else {
2062
2063        el = $('.woocommerce-content .accordion');
2064        $('#reviews').closest('.question:not(.active)').children('.title').trigger('click');
2065
2066      }
2067
2068      // offset
2069
2070      var actionBarH = $('.header-fixed.ab-show #Action_bar').innerHeight() || 0;
2071      var offset = actionBarH + adminBarH();
2072
2073      // animate scroll
2074
2075      $('html, body').animate({
2076        scrollTop: el.offset().top - offset - fixStickyHeaderH()
2077      }, 500);
2078
2079    });
2080
2081    /**
2082     * Ajax | Complete
2083     */
2084
2085    $(document).ajaxComplete(function() {
2086
2087      setTimeout(function() {
2088        $(window).trigger('resize');
2089      }, 100);
2090
2091    });
2092
2093    /**
2094     * Isotope
2095     */
2096
2097    // Isotope | Fiters
2098
2099    function isotopeFilter(domEl, isoWrapper) {
2100
2101      var filter = domEl.attr('data-rel');
2102
2103      isoWrapper.isotope({
2104        filter: filter
2105      });
2106
2107      setTimeout(function() {
2108        $(window).trigger('resize');
2109      }, 50);
2110
2111    }
2112
2113    // Isotope | Fiters | Click ----------
2114
2115    $('.isotope-filters .filters_wrapper').find('li:not(.close) a').on('click', function(e) {
2116      e.preventDefault();
2117
2118      var isoWrapper = $('.isotope'),
2119        filters = $(this).closest('.isotope-filters'),
2120        parent = filters.attr('data-parent');
2121
2122      if (parent) {
2123        parent = filters.closest('.' + parent);
2124        isoWrapper = parent.find('.isotope').first();
2125      }
2126
2127      filters.find('li').removeClass('current-cat');
2128      $(this).closest('li').addClass('current-cat');
2129
2130      isotopeFilter($(this), isoWrapper);
2131
2132      setTimeout(function() {
2133        $(document).trigger('isotope:arrange');
2134      }, 500);
2135    });
2136
2137    // Isotope | Fiters | Reset
2138
2139    $('.isotope-filters .filters_buttons').find('li.reset a').on('click', function(e) {
2140      e.preventDefault();
2141
2142      $('.isotope-filters .filters_wrapper').find('li').removeClass('current-cat');
2143      isotopeFilter($(this), $('.isotope'));
2144    });
2145
2146    /**
2147     * $(window).on('debouncedresize')
2148     * Specify a function to execute on window resize
2149     */
2150
2151    $(window).on('debouncedresize', function() {
2152
2153      // isotope
2154
2155      $('.masonry.isotope, .masonry.gallery').isotope();
2156
2157      // sliding footer height
2158
2159      mfnFooter();
2160
2161      // header width
2162
2163      headerWidth();
2164
2165      // sidebar height
2166
2167      mfnSidebar();
2168
2169      // full screen sections
2170
2171      // ! visual builder
2172      if( ! $('body').hasClass('mfn-ui') ){
2173        mfnSectionH();
2174      }
2175
2176      // intro header
2177
2178      mfnIntroH();
2179
2180      // equal height
2181
2182      mfnEqualHeightWrap();
2183      mfnEqualHeight();
2184
2185      // mobile sticky for header creative
2186
2187      creativeHeaderFix();
2188
2189    });
2190
2191    /**
2192     * document.ready
2193     * Initialize document ready functions
2194     */
2195
2196    mfnSliderBlog();
2197    mfnSliderClients();
2198    mfnSliderOffer();
2199    mfnSliderOfferThumb();
2200    mfnSliderShop();
2201
2202    sliderPortfolio();
2203    sliderTestimonials();
2204
2205    // sliding footer height
2206
2207    mfnFooter();
2208
2209    // header width
2210
2211    headerWidth();
2212
2213    // sidebar height
2214
2215    mfnSidebar();
2216
2217    // full screen sections
2218
2219    mfnSectionH();
2220
2221    // intro header
2222
2223    mfnIntroH();
2224
2225    // equal height
2226
2227    mfnEqualHeightWrap();
2228    mfnEqualHeight();
2229
2230    // hash navigation
2231
2232    hashNav();
2233
2234  });
2235
2236  /**
2237   * $(window).on('scroll')
2238   * The scroll event is sent to an element when the user scrolls to a different place in the element.
2239   */
2240
2241  $(window).on('scroll', function() {
2242
2243    // sticky header
2244
2245    mfnSticky();
2246    mfnMobileSticky();
2247
2248    // sticky back to top
2249
2250    backToTopSticky();
2251
2252    // one page scroll active
2253
2254    onePageActive();
2255
2256  });
2257
2258  /**
2259   * $(window).on('load')
2260   * window.load
2261   */
2262
2263  $(window).on('load', function() {
2264
2265    /**
2266     * Elementor plugin
2267     * Disable built-in one page
2268     */
2269
2270    function elementorDisableOnePage(){
2271
2272      if( ! $('body').hasClass('one-page') ){
2273        return false;
2274      }
2275
2276      setTimeout(function(){
2277        var doc=$(document),
2278          $events=$("a[href*='#']").length ? $._data(doc[0],"events") : null;
2279        if($events && $events.click){
2280          for(var i=$events.click.length-1; i>=0; i--){
2281            var handler=$events.click[i];
2282            if(handler && handler.namespace != "mPS2id" && handler.selector === 'a[href*="#"]' ) doc.off("click",handler.handler);
2283          }
2284        }
2285      }, 300);
2286
2287    }
2288
2289    elementorDisableOnePage();
2290
2291    /**
2292     * Retina Logo
2293     */
2294
2295    function retinaLogo() {
2296
2297      // ! retina display
2298
2299      if( window.devicePixelRatio <= 1 ){
2300        return false;
2301      }
2302
2303      var el, src, height,
2304        parent = $('#Top_bar #logo'),
2305        parentH = parent.data('height');
2306
2307      var maxH = {
2308        sticky: {
2309          init: 35,
2310          noPadding: 60,
2311          overflow: 110
2312        },
2313        mobile: {
2314          mini: 50,
2315          miniNoPadding: 60
2316        },
2317        mobileSticky: {
2318          init: 50,
2319          noPadding: 60,
2320          overflow: 80
2321        }
2322      };
2323
2324      $('#Top_bar #logo img').each(function(index) {
2325
2326        el = $(this);
2327        src = el.data('retina');
2328        height = el.height() || 0;
2329
2330        // main
2331
2332        if (el.hasClass('logo-main')) {
2333
2334          if ($('body').hasClass('logo-overflow')) {
2335
2336            // do nothing
2337
2338          } else if (height > parentH) {
2339
2340            height = parentH;
2341
2342          }
2343
2344        }
2345
2346        // sticky
2347
2348        if (el.hasClass('logo-sticky')) {
2349
2350          if ($('body').hasClass('logo-overflow')) {
2351
2352            if (height > maxH.sticky.overflow) {
2353              height = maxH.sticky.overflow;
2354            }
2355
2356          } else if ($('body').hasClass('logo-no-sticky-padding')) {
2357
2358            if (height > maxH.sticky.noPadding) {
2359              height = maxH.sticky.noPadding;
2360            }
2361
2362          } else if (height > maxH.sticky.init) {
2363
2364            height = maxH.sticky.init;
2365
2366          }
2367
2368        }
2369
2370        // mobile
2371
2372        if (el.hasClass('logo-mobile')) {
2373
2374          if ($('body').hasClass('mobile-header-mini')) {
2375
2376            if (parent.data('padding') > 0) {
2377
2378              if (height > maxH.mobile.mini) {
2379                height = maxH.mobile.mini;
2380              }
2381
2382            } else {
2383
2384              if (height > maxH.mobile.miniNoPadding) {
2385                height = maxH.mobile.miniNoPadding;
2386              }
2387
2388            }
2389
2390          }
2391
2392        }
2393
2394        // mobile-sticky
2395
2396        if (el.hasClass('logo-mobile-sticky')) {
2397
2398          if ($('body').hasClass('logo-no-sticky-padding')) {
2399
2400            if (height > maxH.mobileSticky.noPadding) {
2401              height = maxH.mobileSticky.noPadding;
2402            }
2403
2404          } else if (height > maxH.mobileSticky.init) {
2405            height = maxH.mobileSticky.init;
2406          }
2407
2408        }
2409
2410        // SET
2411
2412        if (src) {
2413          el.parent().addClass('retina');
2414          el.attr('src', src).css('max-height', height + 'px');
2415        }
2416
2417      });
2418
2419    }
2420
2421    setTimeout(function() {
2422      retinaLogo();
2423    }, 0); // jQuery 3.5 window.load
2424
2425    /**
2426     * Isotope
2427     */
2428
2429    // Portfolio - Isotope
2430
2431    $('.blog_wrapper .isotope:not( .masonry ), .portfolio_wrapper .isotope:not( .masonry-flat, .masonry-hover, .masonry-minimal )').isotope({
2432      itemSelector: '.isotope-item',
2433      layoutMode: 'fitRows',
2434      isOriginLeft: rtl ? false : true
2435    });
2436
2437    // Portfolio - Masonry Flat
2438
2439    $('.portfolio_wrapper .masonry-flat').isotope({
2440      itemSelector: '.isotope-item',
2441      percentPosition: true,
2442      masonry: {
2443        columnWidth: 1
2444      },
2445      isOriginLeft: rtl ? false : true
2446    });
2447
2448    // Blog & Portfolio - Masonry
2449
2450    $('.isotope.masonry, .isotope.masonry-hover, .isotope.masonry-minimal').isotope({
2451      itemSelector: '.isotope-item',
2452      layoutMode: 'masonry',
2453      isOriginLeft: rtl ? false : true
2454    });
2455
2456    // Portfolio | Active Category
2457
2458    function portfolioActive() {
2459
2460      var el = $('.isotope-filters .filters_wrapper');
2461      var active = el.attr('data-cat');
2462
2463      if (active) {
2464        el.find('li.' + active).addClass('current-cat');
2465        $('.isotope').isotope({
2466          filter: '.category-' + active
2467        });
2468      }
2469
2470    }
2471
2472    portfolioActive();
2473
2474    /**
2475     * Chart
2476     */
2477     // visual builder
2478    $('.sections_group .chart, .elementor-section .chart').waypoint({
2479
2480      offset: '100%',
2481      triggerOnce: true,
2482      handler: function(){
2483
2484        var el = $(this.element).length ? $(this.element) : $(this);
2485        var lineW = simple ? 4 : 8;
2486
2487        el.easyPieChart({
2488          animate: 1000,
2489          lineCap: 'circle',
2490          lineWidth: lineW,
2491          size: 140,
2492          scaleColor: false
2493        });
2494
2495        if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) {
2496          this.destroy();
2497        }
2498      }
2499
2500    });
2501
2502    /**
2503     * Skills
2504     */
2505
2506    $('.bars_list').waypoint({
2507
2508      offset: '100%',
2509      triggerOnce: true,
2510      handler: function() {
2511
2512        var el = $(this.element).length ? $(this.element) : $(this);
2513
2514        el.addClass('hover');
2515
2516        if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) {
2517          this.destroy();
2518        }
2519      }
2520
2521    });
2522
2523    /**
2524     * Progress Icons
2525     */
2526
2527    $('.progress_icons').waypoint({
2528
2529      offset: '100%',
2530      triggerOnce: true,
2531      handler: function() {
2532
2533        var el = $(this.element).length ? $(this.element) : $(this);
2534        var active = el.attr('data-active');
2535        var color = el.attr('data-color');
2536        var icon = el.find('.progress_icon');
2537        var timeout = 200; // timeout in milliseconds
2538
2539        icon.each(function(i) {
2540          if (i < active) {
2541            var time = (i + 1) * timeout;
2542            setTimeout(function() {
2543              $(icon[i])
2544                .addClass('themebg')
2545                .css('background-color', color);
2546            }, time);
2547          }
2548        });
2549
2550        if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) {
2551          this.destroy();
2552        }
2553      }
2554
2555    });
2556
2557    /**
2558     * Animate Math | Counter, Quick Fact, etc.
2559     */
2560
2561    $('.animate-math .number').waypoint({
2562
2563      offset: '100%',
2564      triggerOnce: true,
2565      handler: function() {
2566
2567        var el = $(this.element).length ? $(this.element) : $(this);
2568        var duration = Math.floor((Math.random() * 1000) + 1000);
2569        var to = el.attr('data-to');
2570
2571        $({
2572          property: 0
2573        }).animate({
2574          property: to
2575        }, {
2576          duration: duration,
2577          easing: 'linear',
2578          step: function() {
2579            el.text(Math.floor(this.property));
2580          },
2581          complete: function() {
2582            el.text(this.property);
2583          }
2584        });
2585
2586        if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) {
2587          this.destroy();
2588        }
2589      }
2590
2591    });
2592
2593    /**
2594     * Before After | TwentyTwenty
2595     */
2596
2597    $('.before_after.twentytwenty-container').twentytwenty();
2598
2599    // Visual Composer prettyPhoto | off
2600
2601    if ( lightboxAttr ) {
2602      $('a[data-rel^="prettyPhoto"], a[rel^="lightbox"]').each(function() {
2603        $(this).off('click.prettyphoto');
2604      });
2605    }
2606
2607    /**
2608     * Reload some functions on window.load
2609     */
2610
2611    // sticky header
2612
2613    mfnStickyH();
2614    mfnSticky();
2615    mfnMobileSticky();
2616
2617    // full screen sections
2618
2619    mfnSectionH();
2620
2621    // hash navigation
2622
2623    hashNav();
2624
2625    // intro header
2626
2627    mfnIntroH();
2628
2629    // FIX | jQuery 3.5 window.load
2630
2631    setTimeout(function() {
2632
2633      // triger resize to recalculate some plugins stuff
2634
2635      $(window).trigger('resize');
2636
2637      // sidebar height
2638
2639      mfnSidebar();
2640
2641      // sliders
2642
2643      sliderSlider();
2644
2645      // isotope
2646
2647      $('.isotope').isotope();
2648
2649    }, 0);
2650
2651  });
2652
2653  /**
2654   * $(document).on('mouseup')
2655   * Specify a function to execute when the DOM is fully loaded.
2656   */
2657
2658  $(document).on('mouseup',function(e) {
2659
2660    // Widget | Muffin Menu | Hover on click
2661
2662    if ($('.widget_mfn_menu ul.submenus-click').length && ($('.widget_mfn_menu ul.submenus-click').has(e.target).length === 0) ) {
2663      $('.widget_mfn_menu ul.submenus-click li').removeClass('hover');
2664    }
2665
2666    // Mobile Menu | Classic | Close on click outside menu
2667
2668    if ($('.menu_wrapper').length && ( $('.menu_wrapper').has(e.target).length === 0 )) {
2669      if( $('.responsive-menu-toggle').hasClass('active') ){
2670        $('.responsive-menu-toggle').trigger('click');
2671      }
2672    }
2673
2674  });
2675
2676  /**
2677   * Sliders configuration
2678   */
2679
2680  // Slick Slider | Auto responsive
2681
2682  function slickAutoResponsive(slider, max, size) {
2683
2684    if (!max){
2685      max = 5;
2686    }
2687    if (!size){
2688      size = 380;
2689    }
2690
2691    var width = slider.width() || 0,
2692      count = Math.ceil(width / size);
2693
2694    if (count < 1) count = 1;
2695    if (count > max) count = max;
2696
2697    return count;
2698  }
2699
2700  // Slider | Offer Thumb
2701
2702  function mfnSliderOfferThumb() {
2703
2704    var pager = function(el, i) {
2705      var img = $(el.$slides[i]).find('.thumbnail:first').html();
2706      return '<a>' + img + '</a>';
2707    };
2708
2709    $('.offer_thumb_ul').each(function() {
2710
2711      var slider = $(this);
2712
2713      slider.slick({
2714        cssEase: 'ease-out',
2715        arrows: false,
2716        dots: true,
2717        infinite: true,
2718        touchThreshold: 10,
2719        speed: 300,
2720
2721        adaptiveHeight: true,
2722        appendDots: slider.siblings('.slider_pagination'),
2723        customPaging: pager,
2724
2725        rtl: rtl ? true : false,
2726        autoplay: mfn.slider.offer ? true : false,
2727        autoplaySpeed: mfn.slider.offer ? mfn.slider.offer : 5000,
2728
2729        slidesToShow: 1,
2730        slidesToScroll: 1
2731      });
2732
2733    });
2734  }
2735
2736  // Slider | Offer
2737
2738  function mfnSliderOffer() {
2739    $('.offer_ul').each(function() {
2740
2741      var slider = $(this);
2742
2743      slider.slick({
2744        cssEase: 'ease-out',
2745        dots: false,
2746        infinite: true,
2747        touchThreshold: 10,
2748        speed: 300,
2749
2750        prevArrow: '<a class="slider_prev" href="#"><span class="button_icon"><i class="icon-up-open-big"></i></span></a>',
2751        nextArrow: '<a class="slider_next" href="#"><span class="button_icon"><i class="icon-down-open-big"></i></span></a>',
2752
2753        adaptiveHeight: true,
2754        //customPaging 	: pager,
2755
2756        rtl: rtl ? true : false,
2757        autoplay: mfn.slider.offer ? true : false,
2758        autoplaySpeed: mfn.slider.offer ? mfn.slider.offer : 5000,
2759
2760        slidesToShow: 1,
2761        slidesToScroll: 1
2762      });
2763
2764      // Pagination | Show (css)
2765
2766      slider.siblings('.slider_pagination').addClass('show');
2767
2768      // Pager | Set slide number after change
2769
2770      slider.on('afterChange', function(event, slick, currentSlide, nextSlide) {
2771        slider.siblings('.slider_pagination').find('.current').text(currentSlide + 1);
2772      });
2773
2774    });
2775  }
2776
2777  // Slider | Shop
2778
2779  function mfnSliderShop() {
2780
2781    var pager = function(el, i) {
2782      return '<a>' + i + '</a>';
2783    };
2784
2785    $('.shop_slider_ul').each(function() {
2786
2787      var slider = $(this);
2788      var slidesToShow = 4;
2789
2790      var count = slider.closest('.shop_slider').data('count');
2791      if (slidesToShow > count) {
2792        slidesToShow = count;
2793        if (slidesToShow < 1) {
2794          slidesToShow = 1;
2795        }
2796      }
2797
2798      slider.slick({
2799        cssEase: 'ease-out',
2800        dots: true,
2801        infinite: true,
2802        touchThreshold: 10,
2803        speed: 300,
2804
2805        prevArrow: '<a class="button the-icon slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>',
2806        nextArrow: '<a class="button the-icon slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>',
2807        appendArrows: slider.siblings('.blog_slider_header').children('.slider_navigation'),
2808
2809        appendDots: slider.siblings('.slider_pager'),
2810        customPaging: pager,
2811
2812        rtl: rtl ? true : false,
2813        autoplay: mfn.slider.shop ? true : false,
2814        autoplaySpeed: mfn.slider.shop ? mfn.slider.shop : 5000,
2815
2816        slidesToShow: slickAutoResponsive(slider, slidesToShow),
2817        slidesToScroll: slickAutoResponsive(slider, slidesToShow)
2818      });
2819
2820      // ON | debouncedresize
2821
2822      $(window).on('debouncedresize', function() {
2823        slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider, slidesToShow), false);
2824        slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider, slidesToShow), true);
2825      });
2826
2827    });
2828  }
2829
2830  // Slider | Blog
2831
2832  function mfnSliderBlog() {
2833
2834    var pager = function(el, i) {
2835      return '<a>' + i + '</a>';
2836    };
2837
2838    $('.blog_slider_ul').each(function() {
2839
2840      var slider = $(this);
2841      var slidesToShow = 4;
2842
2843      var count = slider.closest('.blog_slider').data('count');
2844      if (slidesToShow > count) {
2845        slidesToShow = count;
2846        if (slidesToShow < 1) {
2847          slidesToShow = 1;
2848        }
2849      }
2850
2851      slider.slick({
2852        cssEase: 'ease-out',
2853        dots: true,
2854        infinite: true,
2855        touchThreshold: 10,
2856        speed: 300,
2857
2858        prevArrow: '<a class="button the-icon slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>',
2859        nextArrow: '<a class="button the-icon slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>',
2860        appendArrows: slider.siblings('.blog_slider_header').children('.slider_navigation'),
2861
2862        appendDots: slider.siblings('.slider_pager'),
2863        customPaging: pager,
2864
2865        rtl: rtl ? true : false,
2866        autoplay: mfn.slider.blog ? true : false,
2867        autoplaySpeed: mfn.slider.blog ? mfn.slider.blog : 5000,
2868
2869        slidesToShow: slickAutoResponsive(slider, slidesToShow),
2870        slidesToScroll: slickAutoResponsive(slider, slidesToShow)
2871      });
2872
2873      // On | debouncedresize
2874
2875      $(window).on('debouncedresize', function() {
2876        slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider, slidesToShow), false);
2877        slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider, slidesToShow), true);
2878      });
2879
2880    });
2881  }
2882
2883  // Slider | Clients
2884
2885  function mfnSliderClients() {
2886    $('.clients_slider_ul').each(function() {
2887
2888      var slider = $(this);
2889
2890      slider.slick({
2891        cssEase: 'ease-out',
2892        dots: false,
2893        infinite: true,
2894        touchThreshold: 10,
2895        speed: 300,
2896
2897        prevArrow: '<a class="button the-icon slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>',
2898        nextArrow: '<a class="button the-icon slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>',
2899        appendArrows: slider.siblings('.blog_slider_header').children('.slider_navigation'),
2900
2901        rtl: rtl ? true : false,
2902        autoplay: mfn.slider.clients ? true : false,
2903        autoplaySpeed: mfn.slider.clients ? mfn.slider.clients : 5000,
2904
2905        slidesToShow: slickAutoResponsive(slider, 4),
2906        slidesToScroll: slickAutoResponsive(slider, 4)
2907      });
2908
2909      // ON | debouncedresize
2910
2911      $(window).on('debouncedresize', function() {
2912        slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider, 4), false);
2913        slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider, 4), true);
2914      });
2915
2916    });
2917  }
2918
2919  // Slider | Portfolio
2920
2921  function sliderPortfolio() {
2922
2923    $('.portfolio_slider_ul').each(function() {
2924
2925      var slider = $(this);
2926      var size = 380;
2927      var scroll = 5;
2928
2929      if (slider.closest('.portfolio_slider').data('size')) {
2930        size = slider.closest('.portfolio_slider').data('size');
2931      }
2932
2933      if (slider.closest('.portfolio_slider').data('size')) {
2934        scroll = slider.closest('.portfolio_slider').data('scroll');
2935      }
2936
2937      slider.slick({
2938        cssEase: 'ease-out',
2939        dots: false,
2940        infinite: true,
2941        touchThreshold: 10,
2942        speed: 300,
2943
2944        prevArrow: '<a class="slider_nav slider_prev themebg" href="#"><i class="icon-left-open-big"></i></a>',
2945        nextArrow: '<a class="slider_nav slider_next themebg" href="#"><i class="icon-right-open-big"></i></a>',
2946
2947        rtl: rtl ? true : false,
2948        autoplay: mfn.slider.portfolio ? true : false,
2949        autoplaySpeed: mfn.slider.portfolio ? mfn.slider.portfolio : 5000,
2950
2951        slidesToShow: slickAutoResponsive(slider, 5, size),
2952        slidesToScroll: slickAutoResponsive(slider, scroll, size)
2953      });
2954
2955      // ON | debouncedresize
2956      $(window).on('debouncedresize', function() {
2957        slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider, 5, size), false);
2958        slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider, scroll, size), true);
2959      });
2960
2961    });
2962  }
2963
2964  // Slider | Slider
2965
2966  function sliderSlider() {
2967
2968    var pager = function(el, i) {
2969      return '<a>' + i + '</a>';
2970    };
2971
2972    $('.content_slider_ul').each(function() {
2973
2974      var slider = $(this);
2975      var count = 1;
2976      var centerMode = false;
2977
2978      if (slider.closest('.content_slider').hasClass('carousel')) {
2979        count = slickAutoResponsive(slider);
2980
2981        $(window).on('debouncedresize', function() {
2982          slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider), false);
2983          slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider), true);
2984        });
2985      }
2986
2987      if (slider.closest('.content_slider').hasClass('center')) {
2988        centerMode = true;
2989      }
2990
2991      slider.slick({
2992        cssEase: 'cubic-bezier(.4,0,.2,1)',
2993        dots: true,
2994        infinite: true,
2995        touchThreshold: 10,
2996        speed: 300,
2997
2998        centerMode: centerMode,
2999        centerPadding: '20%',
3000
3001        prevArrow: '<a class="button the-icon slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>',
3002        nextArrow: '<a class="button the-icon slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>',
3003
3004        adaptiveHeight: true,
3005        appendDots: slider.siblings('.slider_pager'),
3006        customPaging: pager,
3007
3008        rtl: rtl ? true : false,
3009        autoplay: mfn.slider.slider ? true : false,
3010        autoplaySpeed: mfn.slider.slider ? mfn.slider.slider : 5000,
3011
3012        slidesToShow: count,
3013        slidesToScroll: count
3014      });
3015
3016      // Lightbox | disable on dragstart
3017
3018      var clickEvent = false;
3019
3020      slider.on('dragstart', '.slick-slide a[rel="lightbox"]', function(event) {
3021        if (lightboxAttr) {
3022          var events = $._data(this,'events');
3023          if( events && Object.prototype.hasOwnProperty.call(events, 'click') ){
3024            clickEvent = events.click[0];
3025            $(this).addClass('off-click').off('click');
3026          }
3027        }
3028      });
3029
3030      // Lightbox | enable after change
3031
3032      slider.on('afterChange', function(event, slick, currentSlide, nextSlide) {
3033        if (lightboxAttr) {
3034          $('a.off-click[rel="lightbox"]', slider).removeClass('off-click').on('click', clickEvent);
3035        }
3036      });
3037
3038    });
3039  }
3040
3041  // Slider | Testimonials
3042
3043  function sliderTestimonials() {
3044
3045    var pager = function(el, i) {
3046      var img = $(el.$slides[i]).find('.single-photo-img').html();
3047      return '<a>' + img + '</a>';
3048    };
3049
3050    $('.testimonials_slider_ul').each(function() {
3051
3052      var slider = $(this);
3053
3054      slider.slick({
3055        cssEase: 'ease-out',
3056        dots: true,
3057        infinite: true,
3058        touchThreshold: 10,
3059        speed: 300,
3060
3061        prevArrow: '<a class="button the-icon slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>',
3062        nextArrow: '<a class="button the-icon slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>',
3063
3064        adaptiveHeight: true,
3065        appendDots: slider.siblings('.slider_pager'),
3066        customPaging: pager,
3067
3068        rtl: rtl ? true : false,
3069        autoplay: mfn.slider.testimonials ? true : false,
3070        autoplaySpeed: mfn.slider.testimonials ? mfn.slider.testimonials : 5000,
3071
3072        slidesToShow: 1,
3073        slidesToScroll: 1
3074      });
3075
3076    });
3077  }
3078
3079})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.