1(function($) { 2 "use strict"; 3 var GaviasTheme = { 4 init: function(){ 5 this.handleWindow(); 6 this.initResponsive(); 7 this.initCarousel(); 8 this.menuMobile(); 9 this.postMasonry(); 10 this.scrollTop(); 11 this.stickyMenu(); 12 this.other(); 13 }, 14 15 handleWindow: function(){ 16 var body = document.querySelector('body'); 17 if (window.innerWidth > body.clientWidth + 6) { 18 body.classList.add('has-scrollbar'); 19 body.setAttribute('style', '--scroll-bar: ' + (window.innerWidth - body.clientWidth) + 'px'); 20 } else { 21 body.classList.remove('has-scrollbar'); 22 } 23 24 setTimeout(function(){ 25 if($('body').hasClass('conult-body-loading')){ 26 $('body').removeClass('conult-body-loading'); 27 $('.conult-page-loading').fadeOut(50); 28 } 29 }, 360); 30 }, 31 32 initResponsive: function(){ 33 var _event = $.event, 34 $special, resizeTimeout; 35 $special = _event.special.debouncedresize = { 36 setup: function () { 37 $(this).on("resize", $special.handler); 38 }, 39 teardown: function () { 40 $(this).off("resize", $special.handler); 41 }, 42 handler: function (event, execAsap) { 43 var context = this, 44 args = arguments, 45 dispatch = function () { 46 event.type = "debouncedresize"; 47 _event.dispatch.apply(context, args); 48 }; 49 if (resizeTimeout) { 50 clearTimeout(resizeTimeout); 51 } 52 execAsap ? dispatch() : resizeTimeout = setTimeout(dispatch, $special.threshold); 53 }, 54 threshold: 150 55 }; 56 }, 57 58 initCarousel: function(){ 59 var _default = { 60 items: 3, 61 items_lg: 3, 62 items_md: 2, 63 items_sm: 2, 64 items_xs: 1, 65 items_xx: 1, 66 space_between: 30, 67 effect: 'slide', 68 loop: 1, 69 speed: 600, 70 autoplay: 1, 71 autoplay_delay: 6000, 72 autoplay_hover: 0, 73 navigation: 1, 74 pagination: 1, 75 pagination_type: 'bullets', 76 dynamic_bullets: 0 77 }; 78 79 $('.init-carousel-swiper-theme').each(function(){ 80 var $target = $(this); 81 var settings = $target.data('carousel'); 82 83 settings = $.extend(!0, _default, settings); 84 85 //-- Autoplay 86 var _autoplay = false; 87 if(settings.autoplay){ 88 _autoplay = { 89 delay: settings.autoplay_delay, 90 disableOnInteraction: false, 91 pauseOnMouseEnter: settings.autoplay_hover, 92 } 93 } 94 //-- Pagination 95 var _pagination = false; 96 if(settings.pagination){ 97 _pagination = { 98 el: $target.parent().find('.swiper-pagination')[0], 99 type: settings.pagination_type, 100 clickable: true, 101 dynamicBullets: false 102 } 103 } 104 //-- Navigation 105 var _navigation = false; 106 if(settings.navigation){ 107 _navigation = { 108 nextEl: $target.parents('.swiper-slider-wrapper').find('.swiper-nav-next')[0], 109 prevEl: $target.parents('.swiper-slider-wrapper').find('.swiper-nav-prev')[0], 110 hiddenClass: 'hidden' 111 } 112 } 113 console.log($target[0]); 114 var swiper = new Swiper($target[0], { 115 loop: settings.loop, 116 spaceBetween: 30, 117 autoplay: _autoplay, 118 speed: settings.speed, 119 grabCursor: true, 120 breakpoints: { 121 0: { 122 slidesPerView: 1 123 }, 124 390: { 125 slidesPerView: settings.items_xx 126 }, 127 640: { 128 slidesPerView: settings.items_xs 129 }, 130 768: { 131 slidesPerView: settings.items_sm 132 }, 133 1024: { 134 slidesPerView: settings.items_md 135 }, 136 1200: { // when window width is >= 1200px 137 slidesPerView: settings.items_lg, 138 }, 139 1400: { // when window width is >= 1200px 140 slidesPerView: settings.items, 141 } 142 }, 143 pagination: _pagination, 144 navigation: _navigation, 145 observer: true, 146 observeParents: true, 147 }); 148 149 if(settings.autoplay_hover && settings.autoplay){ 150 $target.hover(function() { 151 swiper.autoplay.stop(); 152 }, function() { 153 swiper.autoplay.start(); 154 }); 155 } 156 }) 157 }, 158 159 menuMobile: function(){ 160 $('.gva-offcanvas-content ul.gva-mobile-menu > li:has(ul)').addClass("has-sub"); 161 $('.gva-offcanvas-content ul.gva-mobile-menu > li:has(ul) > a').after('<span class="caret"></span>'); 162 $( document ).on('click', '.gva-offcanvas-content ul.gva-mobile-menu > li > .caret', function(e){ 163 e.preventDefault(); 164 var checkElement = $(this).next(); 165 $('.gva-offcanvas-content ul.gva-mobile-menu > li').removeClass('menu-active'); 166 $(this).closest('li').addClass('menu-active'); 167 168 if((checkElement.is('.submenu-inner')) && (checkElement.is(':visible'))){ 169 $(this).closest('li').removeClass('menu-active'); 170 checkElement.slideUp('normal'); 171 } 172 if((checkElement.is('.submenu-inner')) && (!checkElement.is(':visible'))){ 173 $('.gva-offcanvas-content ul.gva-mobile-menu .submenu-inner:visible').slideUp('normal'); 174 checkElement.slideDown('normal'); 175 } 176 if (checkElement.is('.submenu-inner')){ 177 return false;
178 } else { 179 return true; 180 } 181 }) 182 183 $( document ).on( 'click', '.canvas-menu.gva-offcanvas > a.dropdown-toggle', function(e){ 184 e.preventDefault(); 185 var $style = $(this).data('canvas'); 186 if($('.gva-offcanvas-content' + $style).hasClass('open')){ 187 $('.gva-offcanvas-content' + $style).removeClass('open'); 188 $('#gva-overlay').removeClass('open'); 189 $('#wp-main-content').removeClass('blur'); 190 }else{ 191 $('.gva-offcanvas-content' + $style).addClass('open'); 192 $('#gva-overlay').addClass('open'); 193 $('#wp-main-content').addClass('blur'); 194 } 195 }); 196 197 $( document ).on( 'click', '#gva-overlay, .top-canvas a.control-close-mm', function(e){ 198 e.preventDefault(); 199 $(this).removeClass('open'); 200 $('#gva-overlay').removeClass('open'); 201 $('.gva-offcanvas-content').removeClass('open'); 202 $('#wp-main-content').removeClass('blur'); 203 }) 204 $( document ).on( 'click', '.close-canvas', function(e) { 205 e.preventDefault(); 206 $('.gva-offcanvas-content').removeClass('open'); 207 $('#gva-overlay').removeClass('open'); 208 $('#wp-main-content').removeClass('blur'); 209 }) 210 211 if( ('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0) || (navigator.MaxTouchPoints > 0) ) { 212 var link_id = ''; 213 $('.gva-nav-menu .menu-item > a').on('click', function(e) { 214 e.preventDefault(); 215 if ($(this).parent().find('.submenu-inner').length == 0) { 216 window.location.href = $(this).attr('href'); 217 return; 218 } 219 if ($(this).attr('data-link_id') == link_id) { 220 window.location.href = $(this).attr('href'); 221 return; 222 } 223 if($(window).width() < 1024){ 224 $('.gva-offcanvas-content ul.gva-mobile-menu > li').removeClass('menu-active'); 225 $('.gva-offcanvas-content ul.gva-mobile-menu .submenu-inner:visible').slideUp('normal'); 226 $(this).parent().find('> .submenu-inner').slideDown(); 227 $(this).closest('li').addClass('menu-active'); 228 } 229 link_id = $(this).attr('data-link_id'); 230 e.preventDefault(); 231 return; 232 }); 233 } 234 }, 235 236 postMasonry: function(){ 237 var $container = $('.post-masonry-style'); 238 $container.imagesLoaded( function(){ 239 $container.masonry({ 240 itemSelector : '.item-masory', 241 gutterWidth: 0, 242 columnWidth: 1, 243 }); 244 }); 245 }, 246 247 scrollTop: function(){ 248 var offset = 300; 249 var duration = 500; 250 251 jQuery(window).scroll(function() { 252 if (jQuery(this).scrollTop() > offset) { 253 jQuery('.return-top').fadeIn(duration); 254 } else { 255 jQuery('.return-top').fadeOut(duration); 256 } 257 }); 258 259 $( document ).on('click', '.return-top', function(event){ 260 event.preventDefault(); 261 jQuery('html, body').animate({scrollTop: 0}, duration); 262 return false; 263 }); 264 }, 265 266 stickyMenu: function(){ 267 if( $('.gv-sticky-menu').length > 0 ){ 268 $( ".gv-sticky-menu" ).wrap( "<div class='gv-sticky-wrapper'></div>" ); 269 270 var headerHeight = $('.gv-sticky-menu').height(); 271 var menu = $('.gv-sticky-wrapper'); 272 273 $(window).on('scroll', function () { 274 if ($(window).scrollTop() > menu.offset().top) { 275 menu.addClass('is-fixed'); 276 menu.css('height', headerHeight); 277 } else { 278 menu.removeClass('is-fixed'); 279 menu.css('height', 'auto'); 280 } 281 }); 282 } 283 }, 284 285 progress_animation: function(){ 286 $("[data-progress-animation]").each(function() { 287 var $this = $(this); 288 $this.appear(function() { 289 var delay = ($this.attr("data-appear-animation-delay") ? $this.attr("data-appear-animation-delay") : 1); 290 if(delay > 1) $this.css("animation-delay", delay + "ms"); 291 setTimeout(function() { $this.animate({width: $this.attr("data-progress-animation")}, 800);}, delay); 292 }, {accX: 0, accY: -50}); 293 }); 294 }, 295 296 other: function(){ 297 $('.popup-video').magnificPopup({ 298 type: 'iframe',
299 fixedContentPos: false 300 }); 301 302 $( document ).on( 'click', '.yith-wcwl-add-button.show a', function() { 303 $(this).addClass('loading'); 304 }); 305 306 $(document).on('click', '.gva-search > a.control-search', function(){ 307 let _btn = $(this); 308 if(_btn.hasClass('search-open')){ 309 _btn.parents('.gva-search').removeClass('open'); 310 _btn.removeClass('search-open'); 311 }else{ 312 _btn.parents('.gva-search').addClass('open'); 313 _btn.addClass('search-open'); 314 setTimeout(function(){ 315 _btn.parent('.main-search').find('.gva-search input.input-search').first().focus(); 316 }, 100); 317 } 318 }); 319 320 $(document).on('click', '.mini-cart-header .mini-cart', function(e){ 321 e.preventDefault(); 322 $(this).parent('.mini-cart-inner').addClass('open'); 323 }); 324 $(document).on('click', '.mini-cart-header .minicart-overlay', function(e){ 325 e.preventDefault(); 326 $(this).parent('.mini-cart-inner').removeClass('open'); 327 }); 328 329 $('.scroll-link[href*="#"]:not([href="#"])').click(function() { 330 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 331 var target = $(this.hash); 332 target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); 333 if (target.length) { 334 $('html, body').animate({ 335 scrollTop: target.offset().top - 100 336 }, 1500); 337 return false; 338 } 339 } 340 }); 341 342 $('.conult-post-share.style-2 .btn-control-share').on('click', function(e){ 343 e.preventDefault(); 344 var wrapper = $(this).parents('.conult-post-share'); 345 if(wrapper.hasClass('open')){ 346 wrapper.removeClass('open'); 347 }else{ 348 wrapper.addClass('open'); 349 } 350 }); 351 352 $('.gva-portfolio-grid .portfolio-filter').each(function(){ 353 $(this).find('.btn-filter').each(function(){ 354 let _btn = $(this); 355 let filter = _btn.attr('data-filter'); 356 let items = _btn.parents('.gva-portfolio-grid').find('.isotope-items').first(); 357 _btn.find('.count').first().html('[' + items.find('> ' + filter).length + ']'); 358 }); 359 }); 360 361 var scrollToTop = function() { 362 var scrollTo = $('#wp-main-content').offset().top - 100; 363 $('html, body').stop().animate({ 364 scrollTop: scrollTo 365 }, 400); 366 }; 367 368 } 369 } 370 371 $(window).on('load', function(){ 372 $(document).on('click', '.minicart-close', function(e){ 373 e.preventDefault(); 374 $(this).parents('.cart').removeClass('open'); 375 }) 376 377 if($('.product-single-inner .flex-control-nav').length){ 378 $('.product-single-inner .flex-control-nav').wrap('<div class="swiper-container product-thumbnail-swiper"></div>'); 379 $('.product-single-inner .flex-control-nav').after('<div class="swiper-nav-next"></div><div class="swiper-nav-prev"></div>'); 380 $('.product-single-inner .flex-control-nav').addClass('swiper-wrapper'); 381 $('.product-single-inner .flex-control-nav > li').addClass('swiper-slide'); 382 var swiper = new Swiper('.product-single-inner .product-thumbnail-swiper', { 383 pagination: '.swiper-pagination', 384 slidesPerView: 'auto', 385 paginationClickable: true, 386 spaceBetween: 10, 387 navigation: { 388 nextEl: '.swiper-nav-next', 389 prevEl: '.swiper-nav-prev' 390 }, 391 breakpoints: { 392 0: { 393 slidesPerView: 2 394 }, 395 390: { 396 slidesPerView: 2 397 }, 398 640: { 399 slidesPerView: 3 400 }, 401 768: { 402 slidesPerView: 4 403 }, 404 1024: { 405 slidesPerView: 4 406 }, 407 1400: { 408 slidesPerView: 4, 409 } 410 } 411 }); 412 }; 413 }); 414 415 $(document).ready(function(){ 416 GaviasTheme.init(); 417 }) 418 419})(jQuery); 420;;;; 421; 422;;
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.