PageSourceSearch

https://akdoc.com/wp-content/themes/medicare/js/header.misc.js?ver=7.0.4

js akdoc.com collected 2026-10-06 11:05:38 UTC 12,184 bytes, 360 lines download raw bytes

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