1/** 2* Theme main theme Frontend JavaScript file 3*/ 4(function($){ 5$(document).ready(function() { 6 7 'use strict'; 8 9 // iOS buttons style fix 10 var platform = navigator.platform; 11 12 if (platform === 'iPad' || platform === 'iPhone' || platform === 'iPod') { 13 $('input.button, input[type="text"], input[type="button"], input[type="password"], textarea, input.input-text').css('-webkit-appearance', 'none'); 14 } 15 16 // Disable animations for touch devices 17 if(isTouchDevice()===true) { 18 $("#animations-css").remove(); 19 } 20 21 // Select restyling 22 $("select").select2({ 23 allowClear: true, 24 minimumResultsForSearch: 10 25 }); 26 27 // Init elements appear animations 28 AOS.init({ 29 once: true 30 }); 31 32 // Parallax 33 $(".inhype-parallax").parallax(); 34 35 // Add body class for title header with background 36 if($("body.single-post .container-page-item-title.with-bg, body.page .container-page-item-title.with-bg").length > 0) { 37 $("body").addClass('blog-post-header-with-bg'); 38 } 39 40 // Remove embed responsive container from Gutenberg elements, except Video 41 $('.wp-block-embed:not(.is-type-video) .embed-container').removeClass('embed-container'); 42 43 // Add images backgrounds 44 $('.inhype-post-image').each(function( index ) { 45 $(this).attr('style', ($(this).attr('data-style'))); 46 }); 47 $('.inhype-next-post').each(function( index ) { 48 $(this).attr('style', ($(this).attr('data-style'))); 49 }); 50 $('.sidebar .widget.widget_inhype_text .inhype-textwidget').each(function( index ) { 51 $(this).attr('style', ($(this).attr('data-style'))); 52 }); 53 $('.container-page-item-title').each(function( index ) { 54 $(this).attr('style', ($(this).attr('data-style'))); 55 }); 56 $('.container-page-item-title .page-item-single-image-column').each(function( index ) { 57 $(this).attr('style', ($(this).attr('data-style'))); 58 }); 59 $('.inhype-featured-categories-wrapper .inhype-featured-category').each(function( index ) { 60 $(this).attr('style', ($(this).attr('data-style'))); 61 }); 62 $('.inhype-featured-categories-wrapper .inhype-featured-category-bg').each(function( index ) { 63 $(this).attr('style', ($(this).attr('data-style'))); 64 }); 65 $('.inhype-featured-categories-wrapper .inhype-category-image').each(function( index ) { 66 $(this).attr('style', ($(this).attr('data-style'))); 67 }); 68 $('.sidebar .widget.widget_inhype_categories .post-categories-image').each(function( index ) { 69 $(this).attr('style', ($(this).attr('data-style'))); 70 }); 71 $('.sidebar .widget.widget_inhype_categories .post-categories-counter').each(function( index ) { 72 $(this).attr('style', ($(this).attr('data-style'))); 73 }); 74 $('.sidebar .widget.widget_inhype_categories .post-categories-bg').each(function( index ) { 75 $(this).attr('style', ($(this).attr('data-style'))); 76 }); 77 $('.inhype-post .post-categories .cat-dot').each(function( index ) { 78 $(this).attr('style', ($(this).attr('data-style'))); 79 }); 80 $('.footer-html-block').each(function( index ) { 81 $(this).attr('style', ($(this).attr('data-style'))); 82 }); 83 $('.post-review-block .post-review-criteria-value').each(function( index ) { 84 $(this).attr('style', ($(this).attr('data-style'))); 85 }); 86 $('.post-review-block .post-review-rating-total').each(function( index ) { 87 $(this).attr('style', ($(this).attr('data-style'))); 88 }); 89 $('.post-review-block .post-review-button-icon').each(function( index ) { 90 $(this).attr('style', ($(this).attr('data-style'))); 91 }); 92 $('.post-review-rating-badge').each(function( index ) { 93 $(this).attr('style', ($(this).attr('data-style'))); 94 }); 95 $('.post-review-block .post-review-image').each(function( index ) { 96 $(this).attr('style', ($(this).attr('data-style'))); 97 }); 98 99 100 // Move WooCommerce sale badge 101 $('.woocommerce.single span.onsale').prependTo($('.woocommerce div.product div.images.woocommerce-product-gallery')); 102 103 104 // Header search form behavior 105 var search_opened = false; 106 107 // Sync search fields 108 $('body').on('keyup', 'header.sticky-header:not(.fixed) .header-center-search-form .searchform input[type="search"]', function(e){ 109 $('header.sticky-header.fixed .header-center-search-form .searchform input[type="search"]').val($('header.sticky-header:not(.fixed) .header-center-search-form .searchform input[type="search"]').val()); 110 }); 111 112 $('body').on('keyup', 'header.sticky-header.fixed .header-center-search-form .searchform input[type="search"]', function(e){ 113 $('header.sticky-header:not(.fixed) .header-center-search-form .searchform input[type="search"]').val($('header.sticky-header.fixed .header-center-search-form .searchform input[type="search"]').val()); 114 }); 115 116 // Init regular search for search expanded in header 117 var search_regular = false;
118 119 if($('header[class*="header-layout-menu-below-header-left"] .search-toggle-btn').length && !$('header .header-center-custom-content').length) { 120 $('header[class*="header-layout-menu-below-header-left"] .search-toggle-btn').click(); 121 search_regular = true; 122 } 123 124 $('body').on('click', '.search-toggle-wrapper.search-header .search-toggle-btn', function(e){ 125 126 if(!search_regular) { 127 $(document).keyup(function(e){ 128 if(e.keyCode === 27) { 129 if(search_opened) { 130 search_opened = false; 131 132 $('.header-center-search-form .searchform input[type="search"]').animate({ 133 width: 0, 134 opacity: 0 135 }, 500, function() { 136 // Animation complete. 137 $('.header-center-search-form').hide(); 138 }); 139 } 140 } 141 }); 142 } 143 144 if($('.header-center-search-form .searchform input[type="search"]').val() !== '') { 145 $('.header-center-search-form .searchform .submit').click(); 146 } else { 147 if(!search_regular) { 148 if(search_opened) { 149 search_opened = false; 150 151 $('.header-center-search-form .searchform input[type="search"]').animate({ 152 width: 0, 153 opacity: 0 154 }, 500, function() { 155 // Animation complete. 156 $('.header-center-search-form').hide(); 157 }); 158 159 } else { 160 search_opened = true; 161 162 $('.header-center-search-form').show(); 163 $('.header-center-search-form .searchform input[type="search"]').animate({ 164 width: 230, 165 opacity: 1 166 }, 500, function() { 167 // Animation complete. 168 if($('header.sticky-header.fixed').css('display') == 'block') { 169 $('header.sticky-header.fixed .header-center-search-form .searchform input[type="search"]').focus(); 170 } else { 171 $('header.sticky-header:not(.fixed) .header-center-search-form .searchform input[type="search"]').focus(); 172 } 173 }); 174 175 } 176 } 177 } 178 }); 179 180 // Fullscreen search form behaviour 181 $('body').on('click', '.search-toggle-wrapper.search-fullscreen .search-toggle-btn', function(e){ 182 183 $(document).keyup(function(e){ 184 if(e.keyCode === 27) 185 $('.search-fullscreen-wrapper').fadeOut(); 186 }); 187 188 $('.search-fullscreen-wrapper').fadeIn(); 189 $('.search-fullscreen-wrapper .search-fullscreen-form input[type="search"]').focus(); 190 $('.search-fullscreen-wrapper .search-fullscreen-form input[type="search"]').val(''); 191 }); 192 193 $('.search-close-btn').on('click', function(e){ 194 $('.search-fullscreen-wrapper').fadeOut(); 195 }); 196 197 // Main menu toggle button 198 $('header .mainmenu-mobile-toggle').on('click', function(e){ 199 $('header .navbar-toggle').click(); 200 }); 201 202 // Top mobile menu 203 var topmenuopened = 0; 204 $( document ).on( "click", ".menu-top-menu-container-toggle", function(e) { 205 if(topmenuopened == 0) { 206 $(this).next().slideDown(); 207 topmenuopened = 1; 208 } else { 209 topmenuopened = 0; 210 $(this).next().slideUp(); 211 } 212 }); 213 214 // Mobile menu clicks for top and main menus 215 $('.nav li > a, .header-menu li > a').on('click', function(e){ 216 217 if($(window).width() < 991) { 218 219 // Open dropdown on click 220 if ( $(this).next(".sub-menu").length > 0 ) { 221 var sm = $(this).next(".sub-menu"); 222 223 if(sm.data('open') !== 1) { 224 e.preventDefault(); 225 e.stopPropagation(); 226 227 sm.slideDown(); 228 229 sm.data('open', 1); 230 231 $(this).parent().addClass('mobile-submenu-opened'); 232 233 } else { 234 // Close dropdown if no href in link 235 if($(this).attr('href') == '#') { 236 e.preventDefault(); 237 e.stopPropagation(); 238 239 sm.slideUp(); 240 241 sm.data('open', 0); 242 243 $(this).parent().removeClass('mobile-submenu-opened'); 244 } 245 } 246 247 } 248 } else { 249 // Mobile menu clicks for touch devices 250 if(isTouchDevice()===true) { 251 252 if ( $(this).next(".sub-menu").length > 0 ) { 253 var sm = $(this).next(".sub-menu"); 254 255 if(sm.data('open') !== 1) { 256 e.preventDefault(); 257 e.stopPropagation(); 258 259 sm.slideDown(); 260 261 sm.data('open', 1); 262 } 263 264 } 265 266 } 267 268 } 269 }); 270 271 // Prevent submenu items dropdowns goes out from screen 272 function alignMenuDropdowns() { 273 $('.mainmenu .sub-menu, .header-menu .sub-menu').parent().each(function( index ) { 274 var menu = $(this).find("ul.sub-menu"); 275 var menupos = $(menu).offset(); 276 var newpos = $(menu).width(); 277 278 if (menupos.left + menu.width() > $(window).width()) { 279 menu.css({ right: newpos }); 280 } 281 282 if(menupos.left < 0) { 283 menu.css({ right: -newpos }); 284 } 285 }); 286 } 287 288 // Align on load (and later on window resize) 289 alignMenuDropdowns(); 290 291 // Sidebar menu widget clicks
292 $('.sidebar .widget.widget_nav_menu a').on('click', function(e){ 293 294 if ( $(this).next(".sub-menu").length > 0 ) { 295 var sm = $(this).next(".sub-menu"); 296 297 if(sm.data('open') !== 1) 298 { 299 e.preventDefault(); 300 e.stopPropagation(); 301 sm.slideDown(); 302 303 sm.data('open', 1); 304 305 $(this).parent().addClass('mobile-submenu-opened'); 306 } 307 308 } 309 }); 310 311 // Cookie bar plugin restyle 312 if($('#catapult-cookie-bar').length > 0) { 313 $('#catapult-cookie-bar button').addClass('btn'); 314 } 315 316 /** 317 * Scroll related functions 318 */ 319 320 // Scroll to top button 321 var scrollonscreen = 0; 322 323 $(window).scroll(function () { 324 scrollonscreen = $(window).scrollTop() + $(window).height(); 325 326 if(scrollonscreen > $(window).height() + 350){ 327 $('.scroll-to-top').css("bottom", "60px"); 328 } 329 else { 330 $('.scroll-to-top').css("bottom", "-60px"); 331 } 332 333 }); 334 335 // Scroll to top animation 336 $('.scroll-to-top').on('click', function(e){ 337 $('body,html').stop().animate({ 338 scrollTop:0 339 },800,'easeOutCubic') 340 return false; 341 }); 342 343 // Sticky header 344 if($(window).width() > 991 && !isTouchDevice()) { 345 346 var $stickyheader = $('header.main-header.sticky-header'); 347 var STICKY_HEADER_OFFSET = 500; // Offest after header to show sticky version 348 349 if($stickyheader.length > 0) { 350 var $fixedheader = $stickyheader.clone(); 351 $fixedheader.insertAfter($stickyheader); 352 $fixedheader.addClass('fixed'); 353 354 if($("#wpadminbar").length > 0) { 355 $fixedheader.css('top', $("#wpadminbar").height()); 356 } 357 358 $(window).scroll(function() { 359 360 if ($(window).scrollTop() > $stickyheader.offset().top + STICKY_HEADER_OFFSET) { 361 $fixedheader.fadeIn(); 362 } else { 363 $fixedheader.fadeOut('fast'); 364 } 365 }); 366 } 367 } 368 369 // Sticky sidebar position for touch devices without fixed header 370 if(isTouchDevice()) { 371 $('.blog-enable-sticky-sidebar.blog-enable-sticky-header .content-block .sidebar').css('top', '40px'); 372 } 373 374 /** 375 * Resize events 376 */ 377 378 $(window).resize(function () { 379 alignMenuDropdowns(); 380 }); 381 382 /** 383 * Other scripts 384 */ 385 386 /** 387 * Common functions 388 */ 389 390 // Check for touch device 391 function isTouchDevice(){ 392 return true == ("ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch); 393 } 394 395}); 396})(jQuery); 397 398// Global functions 399'use strict'; 400 401/* Cookie functions */ 402function setCookie(name,value,days) { 403 if (days) { 404 var date = new Date(); 405 date.setTime(date.getTime()+(days*24*60*60*1000)); 406 var expires = "; expires="+date.toGMTString(); 407 } 408 else var expires = ""; 409 document.cookie = name+"="+value+expires+"; path=/"; 410} 411 412function getCookie(name) { 413 var value = "; " + document.cookie; 414 var parts = value.split("; " + name + "="); 415 if (parts.length == 2) return parts.pop().split(";").shift(); 416}
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.