PageSourceSearch

https://novargonaftes.gr/wp-content/themes/oxigeno/framework/js/misc.js?ver=6.1.14

js novargonaftes.gr collected 2026-10-01 15:34:26 UTC 4,918 bytes, 162 lines download raw bytes

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		var maxHeight = Math.max.apply(null, $("ul.products li.product .btWooShopLoopItemInner").map(function () {
120			return $(this).outerHeight();
121		}).get());
122		$("ul.products li.product .btWooShopLoopItemInner").css('min-height', maxHeight + 'px');
123	}
124	
125	function initTheme() {
126		initFancySelect();
127		initFooter();
128		initModernizrAndDetectBrowser();
129		initPreloader();
130		initRefreshCart();
131		loadInitActions();
132		
133	}
134	
135	// LOAD
136	$( window ).on( 'load', function() { 
137		loadInitActions();
138	});
139	
140	// READY
141	
142	$( document ).ready(function() {
143		initRefreshCart();
144	});
145	
146	// RESIZE
147	
148	$( window ).resize(function() {
149		$("ul.products li.product .btWooShopLoopItemInner").css('min-height', 'auto')
150		shopEqualHeights();
151	});
152
153	initFancySelect();
154	initFooter();
155	initModernizrAndDetectBrowser();
156	initPreloader();
157	shopEqualHeights();
158	
159	bt_initTheme = initTheme;
160  
161})( jQuery );
162

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.