PageSourceSearch

https://www.elbuscolu.com//js/theme.js

js elbuscolu.com collected 2026-10-02 11:57:42 UTC 24,254 bytes, 682 lines download raw bytes

1
2(function () {
3  "use strict";
4
5  /**
6  * ------------------------------------------------------------------------
7  * Back to top function
8  * ------------------------------------------------------------------------
9  */
10  const Back_to_top = function (){
11      // browser window scroll (in pixels) after which the "back to top" link is shown
12      var offset = 300,
13      //browser window scroll (in pixels) after which the "back to top" link opacity is reduced
14      offset_opacity = 1200,
15      //grab the "back to top" link
16      $back_to_top = $('.back-top');
17      //hide or show the "back to top" link
18      $(window).scroll(function(){
19          ( $(this).scrollTop() > offset ) ? $back_to_top.addClass('backtop-is-visible') : $back_to_top.removeClass('backtop-is-visible backtop-fade-out');
20          if( $(this).scrollTop() > offset_opacity ) { 
21              $back_to_top.addClass('backtop-fade-out');
22          }
23      });
24      // Material-scrolltop
25      function mScrollTop(element, settings) {
26          var _ = this,
27              breakpoint;
28          var scrollTo = 0;
29          _.btnClass = '.material-scrolltop';
30          _.revealClass = 'reveal';
31          _.btnElement = $(_.btnClass);
32          _.initial = {
33              revealElement: 'body',
34              revealPosition: 'top',
35              padding: 0,
36              duration: 600,
37              easing: 'swing',
38              onScrollEnd: false
39          }
40          _.options = $.extend({}, _.initial, settings);
41          _.revealElement = $(_.options.revealElement);
42          breakpoint = _.options.revealPosition !== 'bottom' ? _.revealElement.offset().top : _.revealElement.offset().top + _.revealElement.height();
43          scrollTo = element.offsetTop + _.options.padding;
44          $(document).scroll(function() {
45              if (breakpoint < $(document).scrollTop()) {
46                  _.btnElement.addClass(_.revealClass);
47              } else {
48                  _.btnElement.removeClass(_.revealClass);
49              }
50          });
51          _.btnElement.click(function() {
52              var trigger = true;
53              $('html, body').animate({
54                  scrollTop: scrollTo
55              }, _.options.duration, _.options.easing, function() {
56                  if (trigger) { // Fix callback triggering twice on chromium
57                      trigger = false;
58                      var callback = _.options.onScrollEnd;
59                      if (typeof callback === "function") {
60                          callback();
61                      }
62                  }
63              });
64              return false;
65          });
66      }
67      $.fn.materialScrollTop = function() {
68          var _ = this,
69              opt = arguments[0],
70              l = _.length,
71              i = 0;
72          if (typeof opt == 'object' || typeof opt == 'undefined') {
73              _[i].materialScrollTop = new mScrollTop(_[i], opt);
74          }
75          return _;
76      };
77      $('body').materialScrollTop({   // Scroll to the top of <body> element ...
78          revealElement: 'header',    // Reveal button when scrolling over <header><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> ...
79          revealPosition: 'bottom',   // ... and do it at the end of </header> element
80          duration: 1000,              // Animation will run 1000 ms
81      });
82  }
83  /**
84  * ------------------------------------------------------------------------
85  * Show the navbar when the page is scrolled up function
86  * ------------------------------------------------------------------------
87  */
88  const Showbacktop = function() {
89    var minscreen = 992;
90
91    //primary navigation slide-in effect
92    if ($(window).width() > minscreen) {
93      var headerHeight = $('#showbacktop').height();
94      $(window).on('scroll', {
95          previousTop: 0
96        },
97        function() {
98          var currentTop = $(window).scrollTop();
99          var min_header = 120;
100          //check if user is scrolling up
101          if (currentTop < this.previousTop) {
102            //if scrolling up...
103            if (currentTop > min_header && $('#showbacktop').hasClass('is-fixed')) {
104              $('#showbacktop').addClass('is-visible');
105            } else {
106              $('#showbacktop').removeClass('is-visible is-fixed');
107            }
108          } else if (currentTop > this.previousTop) {
109            //if scrolling down...
110            $('#showbacktop').removeClass('is-visible');
111            if (currentTop > headerHeight && !$('#showbacktop').hasClass('is-fixed')) $('#showbacktop').addClass('is-fixed');
112          } 
113          this.previousTop = currentTop;
114        });
115    }
116  }
117  /**
118  * ------------------------------------------------------------------------
119  * Ajax load content function
120  * ------------------------------------------------------------------------
121  */
122  const Block_loadcontent = function() {
123      $(document).ready(function(){
124          $('#carouselmega, #featured').carousel({
125            interval:false // remove interval for manual sliding
126          });
127          $(".nav-block-link li a, .nav-block-link1 li a, .nav-block-link2 li a, .nav-block-link3 li a, .nav-block-link4 li a, .nav-block-link5 li a, .nav-block-link6 li a, .nav-block-link7 li a").click(function() {
128              $(this).parent().addClass('active').siblings().removeClass('active');
129          });
130          $('[data-bs-toggle="tabajax"]').click(function(e) {
131              e.preventDefault();
132              var loadurl = $(this).attr('href');
133              var targ = $(this).attr('data-bs-target');
134              $.get(loadurl, function(data) {
135                  $.ajax({
136                     beforeSend: function(){
137                      // Before load
138                      $(targ).html('<p class="loaders"><i class="fa fa-spinner fa-spin"></i></p>');
139                     },
140                     complete: function(){
141                      // Content Loaded
142                      $(targ).html(data);
143                     }
144                   });
145              });
146              $(this).tab('show');
147          });
148      });
149  }
150  /**
151  * ------------------------------------------------------------------------
152  * Suggestion function
153  * ------------------------------------------------------------------------
154  */
155  const Suggestion_post = function() {
156      var minscreen = 992;
157      //primary navigation slide-in effect
158      if ($(window).width() > minscreen) {
159          var offset = 2000,
160          offset_opacity = 2000,
161          $suggestion_box = $('.suggestion-box');
162          $(window).scroll(function(){
163              ( $(this).scrollTop() > offset ) ? $suggestion_box.addClass('hide') : $suggestion_box.removeClass('hide show');
164              if( $(this).scrollTop() > offset_opacity ) { 
165                  $suggestion_box.addClass('show');
166              }
167          });
168          // close suggestion
169          $('#close-suggestion').click(function()  {
170              $suggestion_box.addClass('close');
171          });
172      }
173  }
174  /**
175  * ------------------------------------------------------------------------
176  * Hamburger function
177  * ------------------------------------------------------------------------
178  */
179  const Hamburger = function() {
180      $('.nav-hamburger').on('click', function () {
181          // hamburger animation
182          $('.hamburger-icon').toggleClass('open');
183      });
184  }
185  /**
186  * ------------------------------------------------------------------------
187  * Dropdown submenu function
188  * ------------------------------------------------------------------------
189  */
190  const Dropdown_submenu = function() {
191      
192      // submenu
193    const sub_dropdown = function sub_dropdown() {
194      var togglers = document.querySelectorAll(".navbar-nav .dropdown-toggle");
195
196      var _loop = function _loop(i) {
197        togglers[i].addEventListener("click", function () {
198          togglers[i].nextElementSibling.classList.toggle("show");
199          togglers[i].parentNode.classList.toggle("show");
200        });
201        window.addEventListener("mouseup", function (event) {
202          if (event.target != togglers[i].nextElementSibling && event.target.parentNode != togglers[i].nextElementSibling && event.target.classList.contains("dropdown-toggle") != true) {
203            togglers[i].nextElementSibling.classList.remove("show");
204            togglers[i].parentNode.classList.remove("show");
205          }
206        });
207      };
208
209      for (var i = 0; i < togglers.length; i++) {
210        _loop(i);
211      }
212    }; 
213
214    // close
215    const close_dropdown = function close_dropdown() {
216      var dropdown_a = document.querySelectorAll(".navbar-nav .dropdown > .dropdown-toggle");
217      var dropdownMenu_a = document.querySelectorAll(".navbar-nav .dropdown > .dropdown-menu");
218      var dropdownSubMenu_a = document.querySelectorAll(".navbar-nav .dropdown-menu > li > .dropdown-menu");
219
220      var _loop2 = function _loop2(i) {
221        dropdown_a[i].addEventListener("click", function () {
222          for (var j = 0; j < dropdownMenu_a.length; j++) {
223            if (i != j) {
224              dropdownMenu_a[j].parentNode.classList.remove("show");
225              dropdownSubMenu_a[j].parentNode.classList.remove("show");
226              dropdownMenu_a[j].classList.remove("show");
227              dropdownSubMenu_a[j].classList.remove("show");
228            }
229          }
230        });
231      };
232
233      for (var i = 0; i < dropdown_a.length; i++) {
234        _loop2(i);
235      }
236    }; 
237
238    // subdropdown
239    const close_subdropdown = function close_subdropdown() {
240      var dropdown_b = document.querySelectorAll(".navbar-nav .dropdownfirst > .dropdown-toggle");
241      var dropdownMenu_b = document.querySelectorAll(".navbar-nav .dropdownfirst > .dropdown-menu");
242      var dropdownSubMenu_b = document.querySelectorAll(".navbar-nav .dropdownsecond > .dropdown-menu");
243
244      var _loop3 = function _loop3(i) {
245        dropdown_b[i].addEventListener("click", function () {
246          for (var j = 0; j < dropdownMenu_b.length; j++) {
247            if (i != j) {
248              dropdownMenu_b[j].parentNode.classList.remove("show");
249              dropdownMenu_b[j].classList.remove("show");
250
251              if (dropdownSubMenu_b[j] === undefined) {} else {
252                dropdownSubMenu_b[j].parentNode.classList.remove("show");
253                dropdownSubMenu_b[j].classList.remove("show");
254              }
255            }
256          }
257        });
258      };
259
260      for (var i = 0; i < dropdown_b.length; i++) {
261        _loop3(i);
262      }
263    }; 
264
265    // child subdropdown
266    const close_childsubdropdown = function close_childsubdropdown() {
267      var dropdown_c = document.querySelectorAll(".navbar-nav .dropdownsecond > .dropdown-toggle");
268      var dropdownMenu_c = document.querySelectorAll(".navbar-nav .dropdownsecond > .dropdown-menu");
269
270      var _loop4 = function _loop4(i) {
271        var els = dropdown_c[i];
272        dropdown_c[i].addEventListener("click", function () {
273          for (var j = 0; j < dropdownMenu_c.length; j++) {
274            if (i != j) {
275              dropdownMenu_c[j].parentNode.classList.remove("show");
276              dropdownMenu_c[j].classList.remove("show");
277            }
278          }
279        }); // dropdown reverse
280
281        dropdown_c[i].addEventListener("mouseenter", function () {
282          for (var j = 0; j < dropdownMenu_c.length; j++) {
283            var elm = dropdownMenu_c[j];
284            var rect = elm.getBoundingClientRect();
285            var l = rect.left;
286            var w = elm.offsetWidth;
287            var docW = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
288            var isEntirelyVisible = l + w;
289
290            if (isEntirelyVisible > docW) {
291              elm.classList.add('dropdown-reverse');
292            }
293          }
294        });
295      };
296
297      for (var i = 0; i < dropdown_c.length; i++) {
298        _loop4(i);
299      }
300    };
301
302    var ef = document.querySelector(".dropdown");
303    if ( ef != null) {
304      sub_dropdown();
305      close_dropdown();
306      close_subdropdown();
307      close_childsubdropdown();
308    }
309
310      // sidenav
311      $(".sidenav-menu ul").addClass("border-bottom-last-0");
312      $(".sidenav-menu ul li a").addClass("list-group-item");
313      $('a.dropdown-toggle').click(function(e) {
314        e.preventDefault();
315      });
316  }
317  /**
318  * ------------------------------------------------------------------------
319  * Vertical Tabs function
320  * ------------------------------------------------------------------------
321  */
322  const Vertical_tabs = function() {
323      // tabs in mega menu
324      $('.dropdown-menu a[data-bs-toggle="tab"]').click(function (e) {
325          e.stopPropagation();      
326          $(this).tab('show');
327      });
328  }
329  /**
330  * ------------------------------------------------------------------------
331  * Dropdown animate function
332  * ------------------------------------------------------------------------
333  */
334  const Dropdown_animate = function() {
335      // dropdown animate css
336      $('.dropdown, .mega-dropdown, .dropdown-menu').on('show.bs.dropdown', function () {
337            $(this).children('.dropdown-menu').addClass('animations slideInUp');
338      });
339      $('.dropdown, .mega-dropdown, .dropdown-menu').on('hide.bs.dropdown', function () {
340            $(this).children('.dropdown-menu').removeClass('animations slideInUp');
341      });
342      // screens 
343      var screens = 992;
344      // Hover animate css only on desktop
345      if ( $(window).width() > screens ) {
346           $(function () {
347              // dropdown animate on hover mode
348              $('.hover-mode a.dropdown-toggle').hover(function() {
349                  $('.navbar-nav>li>.dropdown-menu').addClass('animations slideInUp');
350              });
351
352              // Hover tabs
353              $('.mega-hovers').off('click.bs.tab.data-bs-api', '[data-bs-hover="tab"]');
354              $('.mega-hovers').on('mouseenter.bs.tab.data-bs-api', '[data-bs-toggle="tab"], [data-bs-hover="tab"]', function () {
355                $(this).tab('show');
356              });
357
358          });
359      }
360  }
361  /**
362  * ------------------------------------------------------------------------
363  * Slider navigation function
364  * ------------------------------------------------------------------------
365  */
366  const Slider_mega = function() {
367      $('a[data-slide].navi-mega').click(function(e){
368          e.preventDefault();
369          e.stopPropagation();
370          // slide
371          $('#carouselmega').carousel( $(this).data('slide') );
372      });
373  }
374  /**
375  * ------------------------------------------------------------------------
376  * Sticky function
377  * ------------------------------------------------------------------------
378  */
379  const Sticky = function() {
380      $(".sticky-nav").stick_in_parent();
381      // if have scroll top
382      var myNav = document.getElementById("showbacktop");
383      if(myNav){
384        $(".sticky").stick_in_parent({offset_top: 70});
385      } else {
386        $(".sticky").stick_in_parent({offset_top: 10});
387     }
388  }
389  /**
390  * ------------------------------------------------------------------------
391  * Social share function
392  * ------------------------------------------------------------------------
393  */
394  const Social_windows = function () {
395      $('.blank-windows').click(function() {
396          var newwindow = window.open($(this).prop('href'), '', 'height=300,width=500');
397          if (window.focus) {
398              newwindow.focus();
399          }
400          return false;
401      });
402  }
403  /**
404  * ------------------------------------------------------------------------
405  * Progress scroll line function
406  * ------------------------------------------------------------------------
407  */
408  const Progress_scroll = function () {
409      // progress line
410      $(window).scroll(function () {
411          var s = $(window).scrollTop(),
412              d = $(document).height(),
413              c = $(window).height();
414          var scrollPercent = (s / (d-c)) * 100;
415          var position = scrollPercent;
416          $("#progress-bar").attr('value', position);
417      });
418  }
419  /**
420  * ------------------------------------------------------------------------
421  * Lazy load images function
422  * ------------------------------------------------------------------------
423  */
424  const Lazy_load = function () {
425    // lazy load in all
426    var lazyLoadInstance = new LazyLoad({
427        elements_selector: ".lazy",
428        callback_reveal: function (el) {
429            if ( el.complete && el.naturalWidth !== 0 ) {
430              el.classList.remove('loading'),
431              el.classList.add('loaded');
432            }
433        }
434    });
435    // lazy load in tabs
436    $('a[data-toggle="tabajax"]').on('shown.bs.tab', function () {
437         $('.tab-content>.active', function () {
438            lazyLoadInstance.update();
439         });
440    });
441    // lazy load slider
442    $('.carousel').on('slid.bs.carousel', function () {
443        lazyLoadInstance.update();
444    });
445    $('.owl-carousel').on('translated.owl.carousel', function(event) {
446        lazyLoadInstance.update();
447    });
448  }
449  /**
450  * ------------------------------------------------------------------------
451  * Mobile Menu function
452  * ------------------------------------------------------------------------
453  */
454  const Mobile_menu = function () {
455    // Push mobile menu
456    $('.back-menu').click(function() {
457        $('.menu-mobile').removeClass('pushstart-open pushend-open');
458        $('body').removeClass('sidenav-start-open sidenav-end-open');
459    });
460    // push menu to left
461    $('#showStartPush').click(function () {
462        $('body').toggleClass('sidenav-start-open');
463        $('.push-start').toggleClass('pushstart-open');
464    });
465    // push menu to right
466    $('#showEndPush').click(function () {
467        $('body').toggleClass('sidenav-end-open');
468        $('.push-end').toggleClass('pushend-open');
469    });
470  }
471  /**
472  * ------------------------------------------------------------------------
473  * Owl carousel js function
474  * ------------------------------------------------------------------------
475  */
476  const Owl_carousel = function () {
477    $('#owl-carousel1,#owl-carousela1,#owl-carousela2,#owl-carousela3,#owl-carousela4,#owl-carousela5,#owl-carousela6,#owl-carousela7,#owl-carousela8,#owl-carousela9').owlCarousel({
478        margin:10,
479        responsiveClass:true,
480        items:1,
481        dots: false,
482        nav:true
483    }),
484    $('#owl-carousel2,#owl-carouselb1,#owl-carouselb2,#owl-carouselb3,#owl-carouselb4,#owl-carouselb5,#owl-carouselb6,#owl-carouselb7,#owl-carouselb8,#owl-carouselb9').owlCarousel({
485        margin:10,
486        responsiveClass:true,
487        dots: false,
488        responsive:{
489            0:{
490                items:1,
491                nav:true
492            },
493            576:{
494                items:2,
495                nav:true
496            }
497        }
498    }),
499    $('#owl-carousel3,#owl-carouselc1,#owl-carouselc2,#owl-carouselc3,#owl-carouselc4,#owl-carouselc5,#owl-carouselc6,#owl-carouselc7,#owl-carouselc8,#owl-carouselc9').owlCarousel({
500        margin:10,
501        responsiveClass:true,
502        dots: false,
503        responsive:{
504            0:{
505                items:1,
506                nav:true
507            },
508            576:{
509                items:2,
510                nav:true
511            },
512            992:{
513                items:3,
514                nav:true
515            }
516        }
517    }),
518    $('#owl-carousel4,#owl-carouseld1,#owl-carouseld2,#owl-carouseld3,#owl-carouseld4,#owl-carouseld5,#owl-carouseld6,#owl-carouseld7,#owl-carouseld8,#owl-carouseld9').owlCarousel({
519        margin:10,
520        responsiveClass:true,
521        dots: false,
522        responsive:{
523            0:{
524                items:1,
525                nav:true
526            },
527            576:{
528                items:2,
529                nav:true
530            },
531            992:{
532                items:4,
533                nav:true
534            }
535        }
536    }),
537    $('#owl-carousel11,#owl-carousel12,#owl-carousel13,#owl-carousel14,#owl-carousel15,#owl-carouselz1,#owl-carouselz2,#owl-carouselz3,#owl-carouselz4,#owl-carouselz5,#owl-carouselz6,#owl-carouselz7,#owl-carouselz8,#owl-carouselz9').owlCarousel({
538        margin:10,
539        items:1,
540        nav:true,
541        loop:true
542    }),
543    $('#owl-auto').owlCarousel({
544          margin:10,
545          items:1,
546          nav:true,
547          loop:true,
548          autoplay:true,
549          autoplayTimeout:5000,
550          autoplayHoverPause:true
551      }),
552    $('#owl-ticker').owlCarousel({
553        margin:10,
554        items:1,
555        nav:false,
556        loop:true,
557        dots: false,
558        autoplay:true,
559        autoplayTimeout:5000,
560        autoplayHoverPause:true
561    }),
562    $('#owl-ticker2').owlCarousel({
563        margin:10,
564        items:1,
565        nav:false,
566        loop:true,
567        animateIn: 'slideInUp',
568        dots: false,
569        autoplay:true,
570        autoplayTimeout:5000,
571        autoplayHoverPause:true
572    });
573  }
574  /**
575  * ------------------------------------------------------------------------
576  * Youtube Playlist function
577  * ------------------------------------------------------------------------
578  */
579  const Youtube_playlist = function() {  
580    $(".playlist-title li a").click(function() {
581        $(this).parent().addClass('active').siblings().removeClass('active');
582    });
583  }
584  /**
585  * ------------------------------------------------------------------------
586  * Messages chat function
587  * ------------------------------------------------------------------------
588  */
589  const Messages_chat = function () {
590    $('#send-message').on('submit', function (event) {
591        event.preventDefault();
592        var message = $('.messages-me').first().clone();
593        message.find('p').text($('#input-me').val());
594        $('#input-me').val('');
595        message.prependTo('.messages-list');
596        message.find('.minutes').text("0");
597    });
598  }
599  /**
600  * ------------------------------------------------------------------------
601  * Bootstrap function
602  * ------------------------------------------------------------------------
603  */
604  const Bootstrap_module = function() {
605    // Tooltip
606    const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
607    if ( tooltipTriggerList != null) {
608      tooltipTriggerList.map(function (tooltipTriggerEl) {
609        return new bootstrap.Tooltip(tooltipTriggerEl)
610      });
611    }
612
613    // validation
614    const formsx = document.querySelectorAll('.needs-validation')
615    if ( formsx != null) {
616      // Loop over them and prevent submission
617      Array.prototype.slice.call(formsx)
618      .forEach(function (form) {
619        form.addEventListener('submit', function (event) {
620          if (!form.checkValidity()) {
621            event.preventDefault()
622            event.stopPropagation()
623          }
624
625          form.classList.add('was-validated')
626        }, false)
627      });
628    }
629
630    // popovers
631    const popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'));
632    if ( popoverTriggerList != null) {
633      popoverTriggerList.map(function (popoverTriggerEl) {
634        return new bootstrap.Popover(popoverTriggerEl)
635      });
636    }
637
638    const toastElList = [].slice.call(document.querySelectorAll('.toast'));
639    if ( toastElList != null) {
640      toastElList.map(function (toastEl) {
641        return new bootstrap.Toast(toastEl, option)
642      });
643    }
644  }
645  /**
646  * ------------------------------------------------------------------------
647  * Custom JS function
648  * ------------------------------------------------------------------------
649  */
650  const Custom = function () {
651
652    
653      // Insert your custom javascript in here
654  }
655
656  /**
657   * ------------------------------------------------------------------------
658   * Launch Functions
659   * ------------------------------------------------------------------------
660   */
661   
662  Back_to_top();
663  Showbacktop();
664  Block_loadcontent();
665  Suggestion_post();
666  Hamburger();
667  Dropdown_submenu();
668  Vertical_tabs();
669  Dropdown_animate();
670  Slider_mega();
671  Sticky();
672  Social_windows();
673  Progress_scroll();
674  Lazy_load();
675  Mobile_menu();
676  Owl_carousel();
677  Messages_chat();
678  Youtube_playlist();
679  Bootstrap_module();
680  Custom();
681
682})();

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.