1'use strict'; 2 3var bt_initTheme; 4 5function bt_refresh_cart() { 6 jQuery( '.btCartWidgetIcon' ).off('click').on( 'click', function ( e ) { 7 jQuery(this).parent().parent().toggleClass( 'on' ); 8 jQuery('body').toggleClass( 'btCartDropdownOn' ); 9 }); 10 jQuery('.verticalMenuCartToggler').off('click').on( 'click', function() { 11 jQuery(this).closest('.widget_shopping_cart_content').removeClass('on'); 12 jQuery('body').removeClass('.btCartDropdownOn'); 13 }); 14} 15 16(function( $ ) { 17 18 function initFancySelect() { 19 if ( typeof $.fn.fancySelect === 'function' ) { 20 $( '.no-touch .btSidebar select, .no-touch select.orderby, .no-touch #btSettingsPanelContent select, .no-touch .wpcf7-form select:not([multiple])' ).fancySelect().on( 'change.fs', function() { 21 $( this ).trigger( 'change.$' ); 22 }); 23 } 24 } 25 26 function loadInitActions() { 27 // remove preloader 28 if(!$( 'body' ).hasClass( 'btRemovePreloader' )) { 29 $( 'body' ).addClass( 'btRemovePreloader' ); 30 if ( typeof bt_bb_animate_elements === 'function' ) { 31 bt_bb_animate_elements(); 32 } 33 } 34 35 // trigger custom load event 36 setTimeout( function() { $( window ).trigger( 'btload' ); window.boldthemes_loaded = true; }, 500 ); 37 38 // gmaps with img overlay, iframes 39 $( window ).trigger( 'resize' ); 40 } 41 42 function initFooter() { 43 $( '#boldSiteFooterWidgetsRow' ).attr( 'data-width', $( '#boldSiteFooterWidgetsRow' ).children().length ).children().addClass('bt_bb_column'); 44 } 45 46 function initModernizrAndDetectBrowser() { 47 48 // Browser detect 49 50 var doc = document.documentElement; 51 doc.setAttribute('data-useragent', navigator.userAgent); 52 53 // IE startsWith/endsWith compatibility 54 55 if ( ! String.prototype.startsWith ) { 56 String.prototype.startsWith = function(searchString, position) { 57 position = position || 0; 58 return this.lastIndexOf(searchString, position) === position; 59 }; 60 } 61 62 if ( ! String.prototype.endsWith ) { 63 String.prototype.endsWith = function(searchString, position) { 64 var subjectString = this.toString(); 65 if (position === undefined || position > subjectString.length) { 66 position = subjectString.length; 67 } 68 position -= searchString.length; 69 var lastIndex = subjectString.indexOf(searchString, position); 70 return lastIndex !== -1 && lastIndex === position; 71 }; 72 } 73 } 74 75 function initPreloader() { 76 // delay click to allow on page leave screen 77 $( 'body.bodyPreloader .mainHeader .menu' ).off('click').on( 'click', 'a', function() { 78 var href = $( this ).attr( 'href' ); 79 if ( 80 href !== undefined && 81 ! href.startsWith( '#' ) && 82 ! href.startsWith( 'mailto' ) && 83 ! href.startsWith( 'callto' ) && 84 ! $( this ).hasClass( 'lightbox' ) && 85 ! $( this ).hasClass( 'add_to_cart_button' ) && 86 $( this ).attr( 'target' ) != '_blank' 87 ) { 88 $( 'body' ).removeClass( 'btRemovePreloader' ); 89 setTimeout( function() { window.location = href }, 750 ); 90 return false; 91 } 92 }); 93 } 94 95 function initRefreshCart() { 96 $( '.cart-contents' ).each(function() { 97 bt_refresh_cart(); 98 }); 99 var cart_node = jQuery( '.widget_shopping_cart' )[0]; 100 if ( cart_node !== undefined ) { 101 var config = { attributes: true, childList: true, subtree: true }; 102 var callback = function( mutationsList, observer ) { 103 // for ( var mutation of mutationsList ) { 104 for (var index = 0; index < mutationsList.length; index) { 105 var mutation = mutationsList[index]; 106 if ( mutation.type == 'childList' ) { 107 jQuery( '.btCartWidgetIcon' ).off( 'click' ).on( 'click', function ( e ) { jQuery( this ).parent().parent().toggleClass( 'on' ); jQuery('body').toggleClass( 'btCartDropdownOn' ); }); 108 jQuery( '.verticalMenuCartToggler' ).off( 'click' ).on( 'click', function ( e ) { jQuery( this ).closest( '.widget_shopping_cart_content' ).removeClass( 'on' ); jQuery('body').removeClass('.btCartDropdownOn'); }); 109 } 110 index++; 111 } 112 }; 113 var observer = new MutationObserver( callback ); 114 observer.observe( cart_node, config ); 115 } 116 } 117 118 function shopEqualHeights() { 119 if ( $( 'ul.products li.product .btWooShopLoopItemInner' ).length > 1 ) { 120 var maxHeight = Math.max.apply(null, $( 'ul.products li.product .btWooShopLoopItemInner' ).map(function () { 121 return $(this).outerHeight(); 122 }).get()); 123 $( 'ul.products li.product .btWooShopLoopItemInner' ).css( 'min-height', maxHeight + 'px' ); 124 } 125 } 126 127 function initTheme() { 128 initFancySelect(); 129 initFooter(); 130 initModernizrAndDetectBrowser(); 131 initPreloader(); 132 initRefreshCart(); 133 loadInitActions(); 134 135 } 136 137 // LOAD 138 $( window ).on( 'load', function() { 139 loadInitActions(); 140 }); 141 142 // READY 143 144 $( document ).ready(function() { 145 initRefreshCart(); 146 }); 147 148 // RESIZE 149 150 $( window ).resize(function() { 151 if ( $( 'ul.products li.product .btWooShopLoopItemInner' ).length > 1 ) { 152 $("ul.products li.product .btWooShopLoopItemInner").css('min-height', 'auto'); 153 shopEqualHeights(); 154 } 155 }); 156 157 initFancySelect(); 158 initFooter(); 159 initModernizrAndDetectBrowser(); 160 initPreloader(); 161 shopEqualHeights(); 162 163 bt_initTheme = initTheme; 164 165})( jQuery ); 166
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.