1'use strict'; 2 3var bt_initTheme; 4 5window.onunload = function(){}; 6 7window.addEventListener("pageshow", function(evt){ 8 if(evt.persisted){ 9 setTimeout(function(){ 10 window.location.reload(); 11 },10); 12 } 13}, false); 14 15function bt_refresh_cart() { 16 jQuery( '.btCartWidgetIcon' ).unbind('click').on( 'click', function ( e ) { 17 jQuery(this).parent().parent().toggleClass( 'on' ); 18 jQuery('body').toggleClass( 'btCartDropdownOn' ); 19 }); 20 jQuery('.verticalMenuCartToggler').unbind('click').on( 'click', function(){ 21 jQuery(this).closest('.widget_shopping_cart_content').removeClass('on'); 22 jQuery('body').removeClass('.btCartDropdownOn'); 23 }); 24} 25 26(function( $ ) { 27 28 function initFancySelect() { 29 if ( typeof $.fn.fancySelect === 'function' ) { 30 $( '.no-touch .btSidebar select, .no-touch select.orderby, .no-touch #btSettingsPanelContent select, .no-touch .wpcf7-form select:not([multiple])' ).fancySelect().on( 'change.fs', function() { 31 $( this ).trigger( 'change.$' ); 32 }); 33 } 34 } 35 36 function loadInitActions() { 37 // remove preloader 38 if(!$( 'body' ).hasClass( "btRemovePreloader" )) { 39 $( 'body' ).addClass( 'btRemovePreloader' ); 40 } 41 42 // trigger custom load event 43 setTimeout( function() { $( window ).trigger( 'btload' ); window.boldthemes_loaded = true; }, 500 ); 44 45 // gmaps with img overlay, iframes 46 $( window ).trigger( 'resize' ); 47 } 48 49 function initFooter() { 50 $( '#boldSiteFooterWidgetsRow' ).attr( 'data-width', $( '#boldSiteFooterWidgetsRow' ).children().length ).children().addClass('bt_bb_column'); 51 } 52 53 function initModernizrAndDetectBrowser() { 54 btModernizr.load([ 55 { 56 test: window.matchMedia 57 } 58 ]); 59 60 // Browser detect 61 62 var doc = document.documentElement; 63 doc.setAttribute('data-useragent', navigator.userAgent); 64 65 // IE startsWith/endsWith compatibility 66 67 if ( ! String.prototype.startsWith ) { 68 String.prototype.startsWith = function(searchString, position) { 69 position = position || 0; 70 return this.lastIndexOf(searchString, position) === position; 71 }; 72 } 73 74 if ( ! String.prototype.endsWith ) { 75 String.prototype.endsWith = function(searchString, position) { 76 var subjectString = this.toString(); 77 if (position === undefined || position > subjectString.length) { 78 position = subjectString.length; 79 } 80 position -= searchString.length; 81 var lastIndex = subjectString.indexOf(searchString, position); 82 return lastIndex !== -1 && lastIndex === position; 83 }; 84 } 85 } 86 87 function initPreloader() { 88 // delay click to allow on page leave screen 89 $( 'body.bodyPreloader .mainHeader .menu' ).unbind('click').on( 'click', 'a', function() { 90 var href = $( this ).attr( 'href' ); 91 if ( 92 href !== undefined && 93 ! href.startsWith( '#' ) && 94 ! href.startsWith( 'mailto' ) && 95 ! href.startsWith( 'callto' ) && 96 ! $( this ).hasClass( 'lightbox' ) && 97 ! $( this ).hasClass( 'add_to_cart_button' ) && 98 $( this ).attr( 'target' ) != '_blank' 99 ) { 100 $( 'body' ).removeClass( 'btRemovePreloader' ); 101 setTimeout( function() { window.location = href }, 750 ); 102 return false; 103 } 104 }); 105 } 106 107 function initRefreshCart() { 108 $( '.cart-contents' ).each(function() { 109 bt_refresh_cart(); 110 }); 111 } 112 113 function initTheme() { 114 initFancySelect(); 115 initFooter(); 116 initModernizrAndDetectBrowser(); 117 initPreloader(); 118 initRefreshCart(); 119 loadInitActions(); 120 } 121 122 // LOAD 123 $( window ).load(function() { 124 loadInitActions(); 125 }); 126 127 // READY 128 129 $( document ).ready(function() { 130 initRefreshCart(); 131 }); 132 133 initFancySelect(); 134 initFooter(); 135 initModernizrAndDetectBrowser(); 136 initPreloader(); 137 138 bt_initTheme = initTheme; 139 140})( jQuery ); 141
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.