PageSourceSearch

http://parisandco.fr/wp-content/themes/estato/js/header.misc.js?ver=6.8.10

js parisandco.fr collected 2026-10-04 13:26:44 UTC 11,339 bytes, 340 lines download raw bytes

1'use strict';
2
3var bt_enquire = {};
4
5bt_enquire.sizes = {};
6
7(function( $ ) {
8	
9	bt_enquire.register = function( size, handler ) {
10		size = parseInt( size.split( ':' )[1] );
11		bt_enquire.sizes[ size ] = {};
12		bt_enquire.sizes[ size ].handler = handler;
13	}
14
15	bt_enquire.handle = function() {
16		var width = ( window.innerWidth > 0 ) ? window.innerWidth : screen.width;
17		$.each( bt_enquire.sizes, function( size, obj ) {
18			if ( width <= size ) {
19				if ( obj.state != 'matched' ) {
20					obj.handler.match();
21					obj.state = 'matched';
22				}
23			} else {
24				if ( obj.state == 'matched' ) {
25					obj.handler.unmatch();
26					obj.state = 'unmatched';
27				}
28			}
29		});
30	}
31
32	var verticalMenuScroll = null;
33
34	$( document ).ready(function() {
35		
36		var isTouchDevice = ( 'ontouchstart' in window ) || ( navigator.MaxTouchPoints > 0 ) || ( navigator.msMaxTouchPoints > 0 );
37		
38		if ( isTouchDevice ) {
39			$( 'html' ).addClass( 'touch' );
40			$( 'html' ).removeClass( 'no-touch' );
41		} else {
42			$( 'html' ).addClass( 'no-touch' );
43			$( 'html' ).removeClass( 'touch' );
44		}
45		
46		$( '.btLogoArea' ).css( 'opacity', '1' );
47		
48		var hasCentralMenu = $( 'body' ).hasClass( 'btMenuCenterEnabled' );
49		var verticalMenuEnabled = $( 'body' ).hasClass( 'btMenuVerticalLeftEnabled' ) || $( 'body' ).hasClass( 'btMenuVerticalRightEnabled' );
50		
51		var belowMenu = $( 'body' ).hasClass( 'btBelowMenu' );
52		var touchDevice = $( 'html' ).hasClass( 'touch' );
53		window.btStickyEnabled = $( 'body' ).hasClass( 'btStickyEnabled' );
54		window.btStickyOffset = 250;
55		var swapHeaderStyle = belowMenu && window.btStickyEnabled && ( $( '.btAltLogo' ).length > 0 || $( '.btTextLogo' ).length > 0 ); // If alt logo exists we will swap header skin
56
57		var skinToSwap = $( 'body' ).hasClass( 'btDarkSkin' ) ? "btLightSkin" : "btDarkSkin";
58		$( '.btPageWrap .btAltLogo' ).hide( );
59		$( '.btPageWrap .btMainLogo' ).show( );
60		
61		
62
63		
64		if ( ! $( '.logo img' ).length ) {
65			$( '.logo' ).addClass( 'boldthemes_logo_text' );
66		}
67
68		function divide_menu() {
69			if ( ! hasCentralMenu ) return false;
70			var logoWidth = $( '.mainHeader .logo' ).height() * $( '.mainHeader .logo .btMainLogo' ).data( 'hw' );
71			if ( $( '.boldthemes_logo_text' ).length ) {
72				logoWidth = $( '.boldthemes_logo_text' ).width();
73			}
74			$( '.menuPort nav' ).addClass( 'leftNav' );
75			$( '.menuPort' ).append( '<nav class="rightNav"><ul></ul></nav>' );
76			var halfItems = Math.ceil( $( '.mainHeader nav.leftNav ul>li:not(li li)' ).length * .5 );
77			$( '.mainHeader nav.rightNav > ul' ).append( $( '.mainHeader nav.leftNav > ul > li' ).slice ( halfItems ) );
78			$( '.mainHeader nav.leftNav > ul > li' ).slice ( halfItems ).remove();
79			
80			$( '.mainHeader .logo' ).css( 'transform', 'translateX(' + Math.round(-logoWidth * .5) + 'px)' );
81			$( '.mainHeader nav.leftNav' ).css( 'margin-right', Math.round(logoWidth * .5) + 'px' );
82			$( '.mainHeader nav.rightNav' ).css( 'margin-left', Math.round(logoWidth * .5) + 'px' );
83		}
84
85		function undivide_menu() {
86			if ( ! hasCentralMenu ) return false;
87			$( '.mainHeader nav.leftNav>ul:not(ul ul)' ).append( $( '.mainHeader nav.rightNav ul>li:not(li li)' ) );
88			$( '.mainHeader nav.rightNav' ).remove();
89			$( '.mainHeader .leftNav' ).removeAttr( 'style' );
90			$( '.menuPort nav' ).removeClass( 'leftNav' );
91			$( '.mainHeader .logo' ).removeAttr( 'style' );
92		}
93
94		/* Vertical menu setup */
95
96		function init_menu() {
97			if ( verticalMenuEnabled ) {
98				if ( $( 'body' ).hasClass( 'btMenuVerticalLeftEnabled' )) $( 'body' ).addClass( 'btMenuVerticalLeft btMenuVertical' );
99				if ( $( 'body' ).hasClass( 'btMenuVerticalRightEnabled' )) $( 'body' ).addClass( 'btMenuVerticalRight btMenuVertical' );
100				move_menu_to_vertical();
101			} else {
102				$( 'body' ).removeClass( 'btMenuVerticalLeft btMenuVerticalRight btMenuVertical btMenuVerticalOn' );
103				if ( $( 'body' ).hasClass( 'btMenuRightEnabled' )) $( 'body' ).addClass( 'btMenuRight btMenuHorizontal' );
104				if ( $( 'body' ).hasClass( 'btMenuLeftEnabled' )) $( 'body' ).addClass( 'btMenuLeft btMenuHorizontal' );
105				if ( $( 'body' ).hasClass( 'btMenuCenterEnabled' )) $( 'body' ).addClass( 'btMenuCenter btMenuHorizontal' );				
106			}	
107			
108		}
109
110		function move_menu_to_vertical() {
111			$( '.menuPort' ).prependTo( 'body' );
112			$( '.mainHeader .logo' ).clone().prependTo( '.menuPort' );
113			$( '.menuPort' ).prepend( '<div class="btCloseVertical"></div>');
114			$( '.btCloseVertical' ).on( 'click', function() {
115				$( 'body' ).toggleClass( 'btMenuVerticalOn' );
116			});
117
118			$( '.mainHeader .topBar' ).appendTo( '.menuPort' );
119			$( '.mainHeader .topBarInLogoArea' ).appendTo( '.menuPort' );
120			
121			$( 'body' ).removeClass( 'btStickyHeaderActive' );
122			if ( ! belowMenu ) $( '.btContentWrap' ).css( 'padding-top', $( '.mainHeader' ).outerHeight() +'px');
123			$( 'li.current-menu-ancestor, li.current_menu_item').each(function() {
124				$( this ).find( '.subToggler' ).first().addClass( 'on' ).next().next().show();
125			});
126			
127			// Vertical Menu Desktop Scroll
128
129			$( '.btMenuVertical .menuPort' ).wrapInner( '<div class="menuScrollPort"></div>' );
130			
131			if ( $( 'body' ).hasClass( 'btMenuVertical' ) && $( 'html' ).hasClass( 'no-touch' ) ) {
132
133				if ( verticalMenuScroll === null ) {
134					verticalMenuScroll = new IScroll( '.no-touch .btMenuVertical .menuPort', {
135						scrollbars: true,
136						mouseWheel: true,
137						click: true,
138						interactiveScrollbars: true,
139						shrinkScrollbars: 'scale',
140						fadeScrollbars: true
141					});
142				}
143			}
144		}
145
146		function reset_menu_to_original() {
147
148			if ( verticalMenuScroll !== null ) {
149				verticalMenuScroll.destroy();
150				verticalMenuScroll = null;	
151			}
152
153			$('.menuPort .menuScrollPort').contents().unwrap();
154			
155			init_menu();
156			
157			$( '.menuPort .sub-menu' ).removeAttr( 'style' );
158			
159			$( '.menuPort .logo' ).remove();
160			$( '.menuPort .btCloseVertical' ).remove();
161
162			if( $('.btBelowLogoArea').length == 0 ) {
163				$( '.menuPort' ).appendTo( '.btLogoArea' );	
164			} else {
165				$( '.menuPort' ).appendTo( '.btBelowLogoArea' );	
166			}
167			$( '.menuPort .topBar' ).prependTo( '.mainHeader > .port' );
168			$( '.mainHeader .topBarInLogoArea' ).insertAfter( '.mainHeader .logo' );
169			
170			$( 'body' ).removeClass( 'btStickyHeaderActive' );
171			divide_menu();
172			if ( ! belowMenu ) $( '.btContentWrap' ).css( 'padding-top', $( '.mainHeader' ).outerHeight() +'px');
173		}
174
175		/* activate sticky */
176		
177		window.boldthemes_activate_sticky = function() {
178			var fromTop = $( window ).scrollTop();
179			if ( window.btStickyEnabled ) {
180				if ( fromTop > window.btStickyOffset ) {
181					$( 'body' ).addClass( 'btStickyHeaderActive' );
182					if( swapHeaderStyle ) {
183						$( '.mainHeader' ).removeClass( skinToSwap );
184						$( '.btPageWrap .btAltLogo' ).hide( );
185						$( '.btPageWrap .btMainLogo' ).show( );
186					}
187					setTimeout( function() { $( 'body' ).addClass( 'btStickyHeaderOpen' ) }, 100 );
188				} else {
189					$( 'body' ).removeClass( 'btStickyHeaderOpen btStickyHeaderActive' );
190					if( swapHeaderStyle ) {
191						$( '.mainHeader' ).addClass( skinToSwap );	
192						if ( swapHeaderStyle )	{
193							$( '.btPageWrap .btAltLogo' ).show( );	
194							$( '.btPageWrap .btMainLogo' ).hide( );
195						}
196					}
197				}
198			}
199		}
200
201		/* Wide menu setup btMenuWideDropdown */
202
203		$('li.btMenuWideDropdown').addClass(function(){
204			return "btMenuWideDropdownCols-" + $(this).children('ul').children('li').length;
205		});
206		
207		$( 'li.btMenuWideDropdown' ).each(function() {
208			var maxChildItems = 0;
209			$(this).find( '> ul > li > ul' ).each(function( index ) {
210				if ( $( this ).children().length > maxChildItems ) {
211					maxChildItems = $( this ).children().length;
212				}
213			});
214			$(this).find( '> ul > li > ul' ).each(function( index ) {
215				var bt_menu_base_length = $( this ).children().length;
216				if ( bt_menu_base_length < maxChildItems ) {
217					for ( var i = 0; i < maxChildItems - bt_menu_base_length; i++ ) {
218						$( this ).append( '<li><a class="btEmptyElement">&nbsp;</a></li>' );
219					} 
220				}
221			});
222		});
223
224		/* Show hide menu */
225
226		$( '.btHorizontalMenuTrigger' ).on( 'click', function () {
227			$( '.mainHeader' ).toggleClass( 'btShowMenu' );
228			return false;
229		});
230
231		/* responsive menu toggler */
232
233		$( '.btVerticalMenuTrigger' ).on( 'click', function () {
234			$( 'body' ).toggleClass( 'btMenuVerticalOn' );
235		});
236
237		/* Top tools search */
238		
239		$('.btTopBox .btSearchInner').prependTo('body').addClass( 'btFromTopBox' );
240
241		$( '.btSearch .btIco, .btSearchInnerClose' ).on( 'click', function () {
242			$( 'body' ).toggleClass( 'btTopToolsSearchOpen' );
243			return false;
244		});
245
246		/* Vertical menu setup */
247		
248		init_menu();
249		setTimeout( function() { $( '.menuPort' ).css( 'visibility', 'visible' ); }, 400 );
250
251		/* Load enquire */
252
253		// turn on responsive menu for all touch devices
254
255		var responsiveResolution = '1199';
256
257		bt_enquire.register( 'screen and (max-width:' + responsiveResolution + 'px)', {
258			match: function() {
259				/* Force vertical menu */
260				if ( ! verticalMenuEnabled ) {
261					undivide_menu();
262					$( 'body' ).addClass( 'btMenuVerticalLeft btMenuVertical' ).removeClass( 'btMenuLeft btMenuCenter btMenuRight btMenuHorizontal btMenuVerticalRight' );
263					move_menu_to_vertical();
264				}
265			},
266			unmatch: function () {
267				if ( ! verticalMenuEnabled ) {
268					reset_menu_to_original();
269				}
270			}
271		});
272		
273		/* menu split */
274		
275		if ( hasCentralMenu ) divide_menu();
276
277		// move content bellow menu
278
279		if ( ! belowMenu ) {
280			$( '.btContentWrap' ).css( 'padding-top', $( '.mainHeader' ).outerHeight() +'px');
281			$( window ).resize(function() {
282				$( '.btContentWrap' ).css( 'padding-top', $( '.mainHeader' ).outerHeight() +'px');
283			});
284			$( window ).scroll(function() {
285				$( '.btContentWrap' ).css( 'padding-top', $( '.mainHeader' ).outerHeight() +'px');
286			});			
287		} else {
288			if ( swapHeaderStyle ) {
289				$( '.mainHeader' ).addClass( skinToSwap );
290				$( '.btPageWrap .btAltLogo' ).show();	
291				$( '.btPageWrap .btMainLogo' ).hide();
292			}
293		}
294
295		/* responsive menu sub togglers */
296		$( '.menuPort ul ul' ).parent().prepend( '<div class="subToggler"></div>');
297
298		$( '.menuPort ul li' ).on( 'mouseover mouseout', function (e) {
299			if ( $( 'body' ).hasClass( 'btMenuVertical' ) || $( 'html' ).hasClass( 'touch' ) ) {
300				return false;
301			}
302			e.preventDefault();
303			$( this ).siblings().removeClass( 'on' );
304			$( this ).toggleClass( 'on' );
305		});
306
307		$( 'div.subToggler' ).on( 'click', function(e) {
308			var parent = $( this ).parent();
309			parent.siblings().removeClass( 'on' );
310			parent.toggleClass( 'on' );
311			if ( $( 'body' ).hasClass( 'btMenuVertical' ) ) {
312				parent.find( 'ul' ).first().slideToggle( 200 );
313				setTimeout(function () {
314					if ( verticalMenuScroll !== null ) {
315						verticalMenuScroll.refresh();
316					}
317				}, 280 );
318			}
319		});
320		
321		bt_enquire.handle();
322		
323		$( window ).resize(function() {
324			
325			bt_enquire.handle();
326			
327		});
328
329	});
330	
331	$( window ).on( 'load', function() {
332
333		boldthemes_activate_sticky();
334		$( window ).scroll(function(){
335			boldthemes_activate_sticky();
336		});
337
338	});	
339
340})( 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.