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:not(.dropdown_product_cat, .woocommerce-widget-layered-nav-dropdown), .no-touch #btSettingsPanelContent select, .no-touch .wpcf7-form select:not([multiple]):not(.skipFancy)' ).fancySelect(); 21 } 22 } 23 24 function initDateInputCheck() { 25 $( '.wpcf7-form .wpcf7-date' ).on( 'change', function( i, obj ) { 26 if( $( this ).val() != '' ) { 27 $( this ).addClass( 'bt-date-input-has-value' ); 28 } else { 29 $( this ).removeClass( 'bt-date-input-has-value' ); 30 } 31 }); 32 } 33 34 function loadInitActions() { 35 // remove preloader 36 if(!$( 'body' ).hasClass( 'btRemovePreloader' )) { 37 $( 'body' ).addClass( 'btRemovePreloader' ); 38 if ( typeof bt_bb_animate_elements === 'function' ) { 39 bt_bb_animate_elements(); 40 } 41 } 42 43 // trigger custom load event 44 setTimeout( function() { $( window ).trigger( 'btload' ); window.boldthemes_loaded = true; }, 500 ); 45 46 // gmaps with img overlay, iframes 47 $( window ).trigger( 'resize' ); 48 } 49 50 function initFooter() { 51 $( '#boldSiteFooterWidgetsRow' ).attr( 'data-width', $( '#boldSiteFooterWidgetsRow' ).children().length ).children().addClass('bt_bb_column'); 52 } 53 54 function initModernizrAndDetectBrowser() { 55 56 // Browser detect 57 58 var doc = document.documentElement; 59 doc.setAttribute('data-useragent', navigator.userAgent); 60 61 // IE startsWith/endsWith compatibility 62 63 if ( ! String.prototype.startsWith ) { 64 String.prototype.startsWith = function(searchString, position) { 65 position = position || 0; 66 return this.lastIndexOf(searchString, position) === position; 67 }; 68 } 69 70 if ( ! String.prototype.endsWith ) { 71 String.prototype.endsWith = function(searchString, position) { 72 var subjectString = this.toString(); 73 if (position === undefined || position > subjectString.length) { 74 position = subjectString.length; 75 } 76 position -= searchString.length; 77 var lastIndex = subjectString.indexOf(searchString, position); 78 return lastIndex !== -1 && lastIndex === position; 79 }; 80 } 81 } 82 83 function initPreloader() { 84 // delay click to allow on page leave screen 85 $( 'body.bodyPreloader .mainHeader .menu' ).off('click').on( 'click', 'a', function() { 86 var href = $( this ).attr( 'href' ); 87 if ( 88 href !== undefined && 89 ! href.startsWith( '#' ) && 90 ! href.startsWith( 'mailto' ) && 91 ! href.startsWith( 'callto' ) && 92 ! $( this ).hasClass( 'lightbox' ) && 93 ! $( this ).hasClass( 'add_to_cart_button' ) && 94 $( this ).attr( 'target' ) != '_blank' 95 ) { 96 $( 'body' ).removeClass( 'btRemovePreloader' ); 97 setTimeout( function() { window.location = href }, 750 ); 98 return false; 99 } 100 }); 101 } 102 103 function initRefreshCart() { 104 $( '.cart-contents' ).each(function() { 105 bt_refresh_cart(); 106 }); 107 var cart_node = jQuery( '.widget_shopping_cart' )[0]; 108 if ( cart_node !== undefined ) { 109 var config = { attributes: true, childList: true, subtree: true }; 110 var callback = function( mutationsList, observer ) { 111 // for ( var mutation of mutationsList ) { 112 for (var index = 0; index < mutationsList.length; index) { 113 var mutation = mutationsList[index]; 114 if ( mutation.type == 'childList' ) { 115 jQuery( '.btCartWidgetIcon' ).off( 'click' ).on( 'click', function ( e ) { jQuery( this ).parent().parent().toggleClass( 'on' ); jQuery('body').toggleClass( 'btCartDropdownOn' ); }); 116 jQuery( '.verticalMenuCartToggler' ).off( 'click' ).on( 'click', function ( e ) { jQuery( this ).closest( '.widget_shopping_cart_content' ).removeClass( 'on' ); jQuery('body').removeClass('.btCartDropdownOn'); }); 117 } 118 index++; 119 } 120 }; 121 var observer = new MutationObserver( callback ); 122 observer.observe( cart_node, config ); 123 } 124 } 125 126 function shopEqualHeights() { 127 $( '.btContent ul.products' ).each(function() { 128 if ( $( this ).find( 'li.product .btWooShopLoopItemInner' ).length > 1 ) { 129 var maxHeight = Math.max.apply( null, $( this ).find( 'li.product .btWooShopLoopItemInner' ).map( function () { 130 return $( this ).outerHeight(); 131 }).get()); 132 $( this ).find( 'li.product .btWooShopLoopItemInner' ).css( 'min-height', maxHeight + 'px' ); 133 } 134 }); 135 136 } 137 138 function initTheme() { 139 initFancySelect(); 140 initDateInput(); 141 initFooter(); 142 initModernizrAndDetectBrowser(); 143 initPreloader(); 144 initRefreshCart(); 145 loadInitActions(); 146 } 147 148 // LOAD 149 $( window ).on( 'load', function() { 150 loadInitActions(); 151 }); 152 153 // READY 154 155 $( document ).ready(function() { 156 initRefreshCart(); 157 }); 158 159 // RESIZE 160 161 $( window ).on( 'resize', function() { 162 if ( $( 'ul.products li.product .btWooShopLoopItemInner' ).length > 1 ) { 163 $("ul.products li.product .btWooShopLoopItemInner").css('min-height', 'auto'); 164 shopEqualHeights(); 165 } 166 }); 167 168 // CATEEGORIES DROPDOWN 169 170 function boldthemes_onCatChange() { 171 if ( boldthemes_dropdown.options[boldthemes_dropdown.selectedIndex].value > 0 ) { 172 var home_url = document.querySelector( ".logo a" ).href; 173 if ( boldthemes_dropdown !== null ) location.href = home_url + '?cat=' + boldthemes_dropdown.options[boldthemes_dropdown.selectedIndex].value; 174 } 175 } 176 177 var boldthemes_dropdown = document.querySelector( ".widget_categories #cat" ); 178 179 if ( boldthemes_dropdown !== null ) { 180 boldthemes_dropdown.onchange = boldthemes_onCatChange; 181 } 182 183 initFancySelect(); 184 initDateInputCheck(); 185 initFooter(); 186 initModernizrAndDetectBrowser(); 187 initPreloader(); 188 shopEqualHeights(); 189 190 bt_initTheme = initTheme; 191 192})( jQuery ); 193
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.