1(function($){ 2$(document).ready(function() { 3 4 'use strict'; 5 /** 6 * Init 7 */ 8 9 // iOS button fixes 10 var iOS = false, 11 p = navigator.platform; 12 13 if (p === 'iPad' || p === 'iPhone' || p === 'iPod') { 14 iOS = true; 15 } 16 if (iOS) { 17 $('input.button, input[type="text"],input[type="button"],input[type="password"],textarea, input.input-text').css('-webkit-appearance', 'none'); 18 $('input').css('border-radius', '0'); 19 } 20 21 // Remove animations on touch devices 22 function isTouchDevice(){ 23 return true == ("ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch); 24 } 25 26 if(isTouchDevice()===true) { 27 $("#animations-css").remove(); 28 } 29 30 $("body:not(.woocommerce-checkout) select").select2({ 31 allowClear: true, 32 minimumResultsForSearch: 10 33 }); 34 35 // Body class 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 41 // Add images backgrounds 42 $('.bjorn-post-image').each(function( index ) { 43 $(this).attr('style', ($(this).attr('data-style'))); 44 }); 45 $('.bjorn-next-post').each(function( index ) { 46 $(this).attr('style', ($(this).attr('data-style'))); 47 }); 48 $('.blog-post-list-layout .blog-post-thumb').each(function( index ) { 49 $(this).attr('style', ($(this).attr('data-style'))); 50 }); 51 $('.blog-style-4 .blog-post .blog-post-thumb').each(function( index ) { 52 $(this).attr('style', ($(this).attr('data-style'))); 53 }); 54 $('.post-content-wrapper').each(function( index ) { 55 $(this).attr('style', ($(this).attr('data-style'))); 56 }); 57 $('.blog-post-related.blog-post-related-loop .blog-post-related-item .blog-post-related-image').each(function( index ) { 58 $(this).attr('style', ($(this).attr('data-style'))); 59 }); 60 $('.bjorn-editorspick-post-image').each(function( index ) { 61 $(this).attr('style', ($(this).attr('data-style'))); 62 }); 63 $('.bjorn-popular-post-image').each(function( index ) { 64 $(this).attr('style', ($(this).attr('data-style'))); 65 }); 66 $('.sidebar .widget.widget_bjorn_text .bjorn-textwidget').each(function( index ) { 67 $(this).attr('style', ($(this).attr('data-style'))); 68 }); 69 $('.container-fluid.container-page-item-title').each(function( index ) { 70 $(this).attr('style', ($(this).attr('data-style'))); 71 }); 72 $('.widget-post-thumb-wrapper').each(function( index ) { 73 $(this).attr('style', ($(this).attr('data-style'))); 74 }); 75 $('.widget-post-thumbsmall-wrapper').each(function( index ) { 76 $(this).attr('style', ($(this).attr('data-style'))); 77 }); 78 $('.footer-html-block').each(function( index ) { 79 $(this).attr('style', ($(this).attr('data-style'))); 80 }); 81 82 83 // Move WooCommerce sale badge 84 $('.woocommerce.single span.onsale').prependTo($('.woocommerce div.product div.images.woocommerce-product-gallery')); 85 86 87 // Fullscreen search 88 $('.search-toggle-btn').on('click', function(e){ 89 90 $(document).keyup(function(e){ 91 if(e.keyCode === 27) 92 $('.search-fullscreen-wrapper').fadeOut(); 93 }); 94 95 $('.search-fullscreen-wrapper').fadeIn(); 96 $('.search-fullscreen-wrapper .search-fullscreen-form input[type="search"]').focus(); 97 $('.search-fullscreen-wrapper .search-fullscreen-form input[type="search"]').val(''); 98 }); 99 100 $('.search-close-btn').on('click', function(e){ 101 $('.search-fullscreen-wrapper').fadeOut(); 102 }); 103 104 // Top mobile menu 105 var topmenuopened = 0; 106 $( document ).on( "click", ".menu-top-menu-container-toggle", function(e) { 107 if(topmenuopened == 0) { 108 $(this).next().slideDown(); 109 topmenuopened = 1; 110 } else { 111 topmenuopened = 0; 112 $(this).next().slideUp(); 113 } 114 }); 115 116 // Mobile menu clicks 117 $('.nav li > a, .header-menu li > a').on('click', function(e){ 118 119 if($(window).width() < 767) { 120 121 if ( $(this).next(".sub-menu").length > 0 ) { 122 var sm = $(this).next(".sub-menu"); 123 124 if(sm.data('open') !== 1) 125 { 126 e.preventDefault(); 127 e.stopPropagation(); 128 sm.slideDown(); 129 130 sm.data('open', 1); 131 132 $(this).parent().addClass('mobile-submenu-opened'); 133 134 } 135 136 } 137 } else { 138 // Mobile menu clicks for touch devices 139 if(isTouchDevice()===true) { 140 141 if ( $(this).next(".sub-menu").length > 0 ) { 142 var sm = $(this).next(".sub-menu"); 143 144 if(sm.data('open') !== 1) 145 { 146 e.preventDefault(); 147 e.stopPropagation(); 148 sm.slideDown(); 149 150 sm.data('open', 1); 151 } 152 153 } 154 155 } 156 157 } 158 }); 159 160 // Float sidebar menu clicks
161 $('.sidebar .widget.widget_nav_menu a').on('click', function(e){ 162 163 if ( $(this).next(".sub-menu").length > 0 ) { 164 var sm = $(this).next(".sub-menu"); 165 166 if(sm.data('open') !== 1) 167 { 168 e.preventDefault(); 169 e.stopPropagation(); 170 sm.slideDown(); 171 172 sm.data('open', 1); 173 174 $(this).parent().addClass('mobile-submenu-opened'); 175 176 } 177 178 } 179 180 }); 181 182 // Offcanvas menu 183 function bjorn_offCanvasSidebarInit() { 184 $( ".st-sidebar-menu" ).wrapInner('<div class="nano"></div>'); 185 $( ".st-sidebar-menu .nano" ).wrapInner('<div class="nano-content"></div>'); 186 187 $(".st-sidebar-menu .nano").nanoScroller(); 188 189 $("html").addClass('offcanvassidebar'); 190 191 var wp_adminbar_height = 0; 192 193 if($("#wpadminbar").length > 0) { 194 wp_adminbar_height = $("#wpadminbar").height(); 195 } 196 197 $("html.offcanvassidebar .st-sidebar-content-inner").css("margin-top", wp_adminbar_height); 198 199 var container = $('#st-container'), //-sidebar 200 buttons = $("#st-sidebar-trigger-effects > a"), 201 // event type (if mobile use touch events) 202 eventtype = mobilecheck() ? 'touchstart' : 'click', 203 resetMenu = function() { 204 $(container).removeClass("st-sidebar-menu-open"); 205 $("html").removeClass('offcanvassidebar-open'); 206 setTimeout( function() { 207 $('.sg_widget_custom_box_left').fadeIn(); 208 }, 1000 ); 209 }, 210 bodyClickFn = function(evt) { 211 212 if( !hasParentClass( evt.target, 'st-sidebar-menu' ) ) { 213 resetMenu(); 214 $("html").unbind( eventtype, bodyClickFn ); 215 } 216 if( hasParentClass( evt.target, 'st-sidebar-menu-close-btn' )) { 217 resetMenu(); 218 $("html").unbind( eventtype, bodyClickFn ); 219 } 220 }; 221 222 buttons.each( function( i ) { 223 224 var el = $( this ); 225 226 var effect = el.attr( 'data-effect' ); 227 228 el.on( eventtype, function( ev ) { 229 ev.stopPropagation(); 230 ev.preventDefault(); 231 container.attr('class', 'st-sidebar-container');// clear 232 container.addClass(effect); 233 $("html").addClass('offcanvassidebar-open'); 234 $('.sg_widget_custom_box_left').fadeOut(); 235 setTimeout( function() { 236 237 container.addClass('st-sidebar-menu-open'); 238 }, 25 ); 239 $("html").on( eventtype, bodyClickFn ); 240 }); 241 } ); 242 243 } 244 245 if($("#st-sidebar-trigger-effects").length > 0) { 246 247 $( "body" ).wrapInner('<div id="st-container" class="st-sidebar-container"></div>'); 248 $( ".st-sidebar-container" ).wrapInner('<div class="st-sidebar-pusher"></div>'); 249 $( ".st-sidebar-pusher" ).wrapInner("<div class='st-sidebar-content'></div>"); 250 $( ".st-sidebar-content" ).wrapInner("<div class='st-sidebar-content-inner'></div>"); 251 252 $( ".st-sidebar-menu" ).insertBefore($(".st-sidebar-pusher")); 253 254 bjorn_offCanvasSidebarInit(); 255 } 256 257 /** 258 * Scroll functions 259 */ 260 // Vertical bar 261 if($(".bjorn-verticalbar").length > 0) { 262 var verticalbar_top_position = $('.header-menu-bg').height()+$('header').height()+$('.bjorn-blog-posts-slider').height()+$('.container-page-item-title').height()+30; 263 $(".bjorn-verticalbar").css('top', verticalbar_top_position); 264 $(".bjorn-verticalbar").show(); 265 266 var verticalbaroffset = $(".bjorn-verticalbar").offset().top; 267 var verticalbarfixed = 0; 268 var vboffset1 = 150; 269 var vboffset2 = 140; 270 } 271 272 $(window).scroll(function () { 273 274 var scrollonscreen = $(window).scrollTop() + $(window).height(); 275 276 // Scroll to top function 277 if(scrollonscreen > $(window).height() + 350){ 278 $('#top-link').css("bottom", "22px"); 279 } 280 else { 281 $('#top-link').css("bottom", "-60px"); 282 } 283 284 // Vertical bar 285 if($(".bjorn-verticalbar").length > 0) { 286 if(verticalbarfixed == 0) { 287 if($(".bjorn-verticalbar").offset().top < ($(window).scrollTop() + vboffset1)) { 288 $(".bjorn-verticalbar").addClass('fixed'); 289 verticalbarfixed = 1; 290 } 291 } else { 292 if(verticalbarfixed == 1) { 293 if($(".bjorn-verticalbar").offset().top < verticalbaroffset - vboffset2) { 294 $(".bjorn-verticalbar").removeClass('fixed'); 295 verticalbarfixed = 0; 296 } 297 298 } 299 } 300 } 301 302 }); 303 304 // Sticky header 305 function bjorn_stickyHeaderWorker() { 306 // Sticky header 307 if(isTouchDevice()==false) { 308 309 var scrolltop = $(document).scrollTop(); 310 311 if(scrolltop > $("header").height() + $('.header-menu-bg').height()) { 312 313 if((header_hided == 1) && (header_fixed == 1)) { 314 header_fixed = 0; 315 } 316 317 if(header_fixed == 0) { 318 319 320 321 header_fixed = 1; 322 323 $(".mainmenu-belowheader.sticky-header").addClass('fixed'); 324 325 $(".mainmenu-belowheader.sticky-header").css("top", -50 + wp_adminbar_height); 326 327 $(".mainmenu-belowheader.sticky-header").css("top", wp_adminbar_height); 328 329 330 $("header").css("margin-top", header_original_height + wp_adminbar_height - top_menu_height); 331 332 } 333 334 } else { 335 336 if(header_fixed == 1) { 337 338 $(".mainmenu-belowheader.sticky-header").css("top", -90 - wp_adminbar_height); 339 340 header_hided = 1; 341 342 if((scrolltop < ($(window).height()/2) -100)) { 343 344 $(".mainmenu-belowheader.sticky-header").removeClass('fixed'); 345 $("header").css("margin-top", 0); 346 347 header_fixed = 0; 348 header_hided = 0; 349 350 } 351 } 352 353 } 354 355 } 356 } 357 358 if($(".mainmenu-belowheader.sticky-header").length > 0) { 359 if($(window).width() > 767) { 360 361 var header_fixed = 0; 362 var header_original_height = $(".mainmenu-belowheader.sticky-header").height(); 363 var top_menu_height = 0; 364 var wp_adminbar_height = 0; 365 var header_hided = 0; 366 367 if($("#wpadminbar").length > 0) { 368 wp_adminbar_height = $("#wpadminbar").height(); 369 } 370 371 if($('.header-menu-bg').length > 0) { 372 top_menu_height = $('.header-menu-bg').height() - 15; 373 } 374 375 376 $(".mainmenu-belowheader.sticky-header").css("top", -90 - wp_adminbar_height); 377 378 // Run first time 379 bjorn_stickyHeaderWorker(); 380 381 // Run on scroll 382 $(window).scroll(function () { 383 384 bjorn_stickyHeaderWorker(); 385 386 }); 387 388 } 389 390 } 391 392 //scroll up event 393 $('#top-link, footer #footer-top-button').on('click', function(e){ 394 $('body,html').stop().animate({ 395 scrollTop:0 396 },800,'easeOutCubic') 397 return false;
398 }); 399 400 401/** 402* Resize events 403*/ 404 405 $(window).resize(function () { 406 407 }); 408 409/** 410* Other scripts 411*/ 412 413 414/** 415* Social share for posts 416*/ 417 418function bjorn_facebookShare(){ 419 window.open( 'https://www.facebook.com/sharer/sharer.php?u='+$(this).attr('href'), "facebookWindow", "height=380,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ) 420 return false; 421} 422function bjorn_googlePlusShare(){ 423 window.open( 'https://plus.google.com/share?url='+$(this).attr('href'), "googleplusWindow", "height=380,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ) 424 return false; 425} 426function bjorn_twitterShare(){ 427 428 var $page_title = encodeURIComponent($(this).attr('data-title')); 429 430 window.open( 'http://twitter.com/intent/tweet?text='+$page_title +' '+$(this).attr('href'), "twitterWindow", "height=370,width=600,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ) 431 return false; 432} 433function bjorn_pinterestShare(){ 434 var $sharingImg; 435 436 $sharingImg = $(this).attr('data-image'); 437 438 var $page_title = encodeURIComponent($(this).attr('data-title')); 439 440 window.open( 'http://pinterest.com/pin/create/button/?url='+$(this).attr('href')+'&media='+$sharingImg+'&description='+$page_title, "pinterestWindow", "height=620,width=600,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ) 441 return false; 442} 443if( $('a.facebook-share').length > 0 || $('a.twitter-share').length > 0 || $('a.pinterest-share').length > 0 || $('a.googleplus-share').length > 0) { 444 445 $('.facebook-share').on('click', bjorn_facebookShare); 446 447 $('.twitter-share').on('click', bjorn_twitterShare); 448 449 $('.pinterest-share').on('click', bjorn_pinterestShare); 450 451 $('.googleplus-share').on('click', bjorn_googlePlusShare); 452 453} 454// Common functions 455function hasParentClass( e, classname ) { 456 if(e === document) return false; 457 458 if( $( e ).hasClass( classname ) ) { 459 return true; 460 } 461 if( $( e ).parents().hasClass( classname ) ) { 462 return true; 463 } 464} 465 466function mobilecheck() { 467 var check = false; 468 (function(a){if(/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera); 469 return check; 470} 471 472}); 473})(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.