PageSourceSearch

https://verbix.ai/blog/wp-content/themes/katen/js/custom.js?ver=6.8.10

js verbix.ai collected 2026-10-05 13:53:40 UTC 15,818 bytes, 469 lines download raw bytes

1(function($){
2  $(window).on('load', function(){
3      "use strict";
4      /*=========================================================================
5              Preloader
6      =========================================================================*/
7      $("#preloader").delay(750).fadeOut('slow');
8
9      /*=========================================================================
10              Social share toggle
11      =========================================================================*/
12      $(document).on("click", "button.toggle-button", function(e) {
13        $(this).next('.social-share .icons').toggleClass("visible");
14        $(this).toggleClass('icon-close').toggleClass('icon-share');
15      });
16
17      /*=========================================================================
18      Infinite Scroll
19      =========================================================================*/
20      var curPage = 1;
21      var pagesNum = $(".pagination").find("li:last-child a").text();   // Number of pages
22
23      var $container = $('.infinite-wrapper');
24      $container.infinitescroll({
25          itemSelector: '.post-item',
26          nextSelector: '.pagination li a',
27          navSelector: '.pagination',
28          extraScrollPx: 0,
29          bufferPx: 0,
30          maxPage: 999,
31          loading: {
32              finishedMsg: "You have reached the end!",
33              msgText: '',
34              speed: 'fast',
35              selector: '.load-more',
36          }
37      },
38      // trigger Masonry as a callback
39      function( newElements ) {
40
41        // Check last page
42        curPage++;
43        if(curPage == pagesNum) {
44          $( '.load-more' ).remove();
45        }
46      });
47
48      $container.infinitescroll( 'unbind' );
49
50      $( '.load-more .btn' ).on('click', function() {
51        $container.infinitescroll( 'retrieve' );
52        // display loading icon
53        $( '.load-more .btn i' ).css('display', 'inline-block');
54        $( '.load-more .btn i' ).addClass('fa-sharp fa-solid fa-spinner-third fa-spin');
55
56        $(document).ajaxStop(function () {
57          setTimeout(function(){
58                // hide loading icon
59            $( '.load-more .btn i' ).hide();
60          }, 1000);
61        });
62        return false;
63      });
64
65  });
66
67  $(document).ready(function() {
68      "use strict";
69
70      $(window).scroll(() => {
71
72          //get total height
73          let docHeight = $(".site-wrapper").height();
74
75          //get window height
76          let winHeight = $(window).height();
77
78          //calculate the view port
79          let viewport = docHeight - winHeight;
80
81          //get current scroll position
82          let scrollPos = $(window).scrollTop();
83
84          //get current scroll percent
85          let scrollPercent = (scrollPos / viewport) * 100;
86
87          //add the percent to the top progress bar
88          $(".reading-bar").css("width", scrollPercent + "%");
89      });
90
91      /*=========================================================================
92              Slick sliders
93      =========================================================================*/
94      $('.post-carousel-lg').slick({
95        dots: true,
96        arrows: true,
97        slidesToShow: 1,
98        slidesToScroll: 1,
99        fade: true,
100        cssEase: 'linear',
101        responsive: [
102          {
103            breakpoint: 768,
104            settings: {
105              slidesToShow: 1,
106              slidesToScroll: 1,
107              dots: true,
108              arrows: false,
109            }
110          }
111        ]
112      });
113
114      $('.post-gallery').slick({
115        dots: false,
116        arrows: true,
117        slidesToShow: 1,
118        slidesToScroll: 1,
119        fade: true,
120        cssEase: 'linear',
121        adaptiveHeight: false,
122        responsive: [
123          {
124            breakpoint: 768,
125            settings: {
126              slidesToShow: 1,
127              slidesToScroll: 1,
128              dots: false,
129              arrows: true,
130            }
131          }
132        ]
133      });
134
135      $('.post-carousel-featured').slick({
136        dots: true,
137        arrows: false,
138        slidesToShow: 5,
139        slidesToScroll: 2,
140        responsive: [
141          {
142            breakpoint: 1440,
143            settings: {
144              slidesToShow: 4,
145              slidesToScroll: 4,
146              dots: true,
147              arrows: false,
148            }
149          },
150          {
151            breakpoint: 1024,
152            settings: {
153              slidesToShow: 3,
154              slidesToScroll: 3,
155              dots: true,
156              arrows: false,
157            }
158          },
159          {
160            breakpoint: 768,
161            settings: {
162              slidesToShow: 2,
163              slidesToScroll: 2,
164              dots: true,
165              arrows: false,
166            }
167          }
168          ,
169          {
170            breakpoint: 576,
171            settings: {
172              slidesToShow: 1,
173              slidesToScroll: 1,
174              dots: true,
175              arrows: false,
176            }
177          }
178        ]
179      });
180
181      $('.post-carousel-twoCol').slick({
182        dots: false,
183        arrows: false,
184        slidesToShow: 2,
185        slidesToScroll: 1,
186        responsive: [
187          {
188            breakpoint: 768,
189            settings: {
190              slidesToShow: 2,
191              slidesToScroll: 2,
192              dots: false,
193              arrows: false,
194            }
195          },
196          {
197            breakpoint: 576,
198            settings: {
199              slidesToShow: 1,
200              slidesToScroll: 1,
201              dots: false,
202              arrows: false,
203            }
204          }
205        ]
206      });
207      // Custom carousel nav
208      $('.carousel-topNav-prev').click(function(){ 
209        $('.post-carousel-twoCol').slick('slickPrev');
210      } );
211      $('.carousel-topNav-next').click(function(){ 
212        $('.post-carousel-twoCol').slick('slickNext');
213      } );
214
215
216      $('.post-carousel-widget').slick({
217        dots: false,
218        arrows: false,
219        slidesToShow: 1,
220        slidesToScroll: 1,
221        responsive: [
222          {
223            breakpoint: 991,
224            settings: {
225              slidesToShow: 2,
226              slidesToScroll: 1,
227            }
228          },
229          {
230            breakpoint: 576,
231            settings: {
232              slidesToShow: 1,
233              centerMode: true,
234              slidesToScroll: 1,
235            }
236          }
237        ]
238      });
239      // Custom carousel nav
240      $('.carousel-botNav-prev').click(function(){ 
241        $('.post-carousel-widget').slick('slickPrev');
242      } );
243      $('.carousel-botNav-next').click(function(){ 
244        $('.post-carousel-widget').slick('slickNext');
245      } );
246
247      /*=========================================================================
248              Sticky header
249      =========================================================================*/
250      var $header = $(".header-default, .header-personal nav, .header-classic .header-bottom"),
251        $clone = $header.before($header.clone().addClass("clone"));
252
253      $(window).on("scroll", function() {
254        var fromTop = $(window).scrollTop();
255        $('body').toggleClass("down", (fromTop > 300));
256      });
257
258  });
259
260  $(function(){
261      "use strict";
262
263      //Create the cookie object
264        var cookieStorage = {
265          setCookie: function setCookie(key, value, time, path) {
266              var expires = new Date();
267              expires.setTime(expires.getTime() + time);
268              var pathValue = '';
269              if (typeof path !== 'undefined') {
270                  pathValue = 'path=' + path + ';';
271              }
272              document.cookie = key + '=' + value + ';' + pathValue + 'expires=' + expires.toUTCString();
273          },
274          getCookie: function getCookie(key) {
275              var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
276              return keyValue ? keyValue[2] : null;
277          },
278          removeCookie: function removeCookie(key) {
279              document.cookie = key + '=; Max-Age=0; path=/';
280          }
281      };
282
283      //Click on dark mode icon. Add dark mode classes and wrappers. Store user preference through sessions
284      $('.switcher-button').click(function() {
285          //Show either moon or sun
286          $('.switcher-button').toggleClass('active');
287          //If dark mode is selected
288          if ($('.switcher-button').hasClass('active')) {
289              //Add dark mode class to the body
290              $('body, header, .canvas-menu .logo').addClass('dark');
291              cookieStorage.setCookie('yonkovNightMode', 'true', 2628000000, '/');
292          } else {
293              $('body, header, .canvas-menu .logo').removeClass('dark');
294              setTimeout(function() {
295                  cookieStorage.removeCookie('yonkovNightMode');
296              }, 100);
297          }
298      })
299
300      //Check Storage. Display user preference 
301      if (cookieStorage.getCookie('yonkovNightMode')) {
302          $('body, header, .canvas-menu .logo').addClass('dark');
303          $('.switcher-button').addClass('active');
304      }
305
306      /*=========================================================================
307              Vertical Menu
308      =========================================================================*/
309      $( ".vertical-menu .sub-menu" ).before( '<i class="icon-arrow-down switch"></i>' );
310
311      $(".vertical-menu li i.switch").on( 'click', function() {
312          var $submenu = $(this).next(".vertical-menu .sub-menu");
313          $submenu.slideToggle(300);
314          $submenu.parent().toggleClass("openmenu");
315          $(this).toggleClass("rotated");
316      });
317
318      /*=========================================================================
319              Canvas Menu
320      =========================================================================*/
321      $("button.burger-menu").on( 'click', function() {
322        $(".canvas-menu").toggleClass("open");
323        $(".main-overlay").toggleClass("active");
324      });
325
326      $(".canvas-menu .btn-close, .main-overlay").on( 'click', function() {
327        $(".canvas-menu").removeClass("open");
328        $(".main-overlay").removeClass("active");
329      });
330
331      /*=========================================================================
332              Popups
333      =========================================================================*/
334      $("button.search").on( 'click', function() {
335        $(".search-popup").addClass("visible");
336      });
337
338      $(".search-popup .btn-close").on( 'click', function() {
339        $(".search-popup").removeClass("visible");
340      });
341
342      $(document).keyup(function(e) {
343            if (e.key === "Escape") { // escape key maps to keycode `27`
344              $(".search-popup").removeClass("visible");
345          }
346      });
347
348      /*=========================================================================
349              Tabs loader
350      =========================================================================*/
351      $('button[data-bs-toggle="tab"]').on( 'click', function() {
352        $(".tab-pane").addClass("loading");
353        $('.lds-dual-ring').addClass("loading");
354        setTimeout(function () {
355            $(".tab-pane").removeClass("loading");
356            $('.lds-dual-ring').removeClass("loading");
357        }, 500);
358      });
359
360      /*=========================================================================
361      Spacer with Data Attribute
362      =========================================================================*/
363      var list = document.getElementsByClassName('spacer');
364
365      for (var i = 0; i < list.length; i++) {
366        var size = list[i].getAttribute('data-height');
367        list[i].style.height = "" + size + "px";
368      }
369
370      /*=========================================================================
371      Background Image with Data Attribute
372      =========================================================================*/
373      var list = document.getElementsByClassName('data-bg-image');
374
375      for (var i = 0; i < list.length; i++) {
376        var bgimage = list[i].getAttribute('data-bg-image');
377        list[i].style.backgroundImage  = "url('" + bgimage + "')";
378      }
379
380      /*=========================================================================
381            Responsive Videos
382    =========================================================================*/
383    $(function() {
384      // Find all YouTube and Vimeo videos
385      var $allVideos = $("iframe[src*='www.youtube.com'], iframe[src*='player.vimeo.com']");
386
387      // Figure out and save aspect ratio for each video
388      $allVideos.each(function() {
389        $(this)
390          .data('aspectRatio', this.height / this.width)
391          // and remove the hard coded width/height
392          .removeAttr('height')
393          .removeAttr('width');
394      });
395
396      // When the window is resized
397      $(window).resize(function() {
398        // Resize all videos according to their own aspect ratio
399        $allVideos.each(function() {
400          var $el = $(this);
401          // Get parent width of this video
402          var newWidth = $el.parent().width();
403          $el
404            .width(newWidth)
405            .height(newWidth * $el.data('aspectRatio'));
406        });
407
408      // Kick off one resize to fix all videos on page load
409      }).resize();
410    });
411
412    document.addEventListener("DOMContentLoaded", function(){
413      // make it as accordion for smaller screens
414      if (window.innerWidth < 992) {
415      
416        // close all inner dropdowns when parent is closed
417        document.querySelectorAll('.navbar .dropdown').forEach(function(everydropdown){
418          everydropdown.addEventListener('hidden.bs.dropdown', function () {
419            // after dropdown is hidden, then find all submenus
420              this.querySelectorAll('.sub-menu').forEach(function(everysubmenu){
421                // hide every submenu as well
422                everysubmenu.style.display = 'none';
423              });
424          })
425        });
426      
427        document.querySelectorAll('.dropdown-menu a').forEach(function(element){
428          element.addEventListener('click', function (e) {
429              let nextEl = this.nextElementSibling;
430              if(nextEl && nextEl.classList.contains('sub-menu')) {	
431                // prevent opening link if link needs to open dropdown
432                e.preventDefault();
433                if(nextEl.style.display == 'block'){
434                  nextEl.style.display = 'none';
435                } else {
436                  nextEl.style.display = 'block';
437                }
438      
439              }
440          });
441        })
442      }
443      // end if innerWidth
444      }); 
445      // DOMContentLoaded  end
446
447  });
448})(jQuery);
449
450jQuery.event.special.touchstart = {
451  setup: function( _, ns, handle ) {
452      this.addEventListener("touchstart", handle, { passive: !ns.includes("noPreventDefault") });
453  }
454};
455jQuery.event.special.touchmove = {
456  setup: function( _, ns, handle ) {
457      this.addEventListener("touchmove", handle, { passive: !ns.includes("noPreventDefault") });
458  }
459};
460jQuery.event.special.wheel = {
461  setup: function( _, ns, handle ){
462      this.addEventListener("wheel", handle, { passive: true });
463  }
464};
465jQuery.event.special.mousewheel = {
466  setup: function( _, ns, handle ){
467      this.addEventListener("mousewheel", handle, { passive: true });
468  }
469};

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.