PageSourceSearch

http://www.tup31.com/wp-content/themes/islemag/js/script.all_ver-1.0.1.js

js tup31.com collected 2026-10-05 23:14:37 UTC 6,512 bytes, 235 lines download raw bytes

1/* global screenReaderText */
2
3jQuery( document ).ready(
4	function() {
5
6		var islemag_sticky = jQuery( '.islemag-sticky' );
7
8		if ( typeof islemag_sticky !== 'undefined' ) {
9
10			if ( islemag_sticky.length ) {
11
12				var islemag_sticky_offset = jQuery( '.islemag-sticky' ).offset();
13
14				if (typeof islemag_sticky_offset !== 'undefined') {
15
16					var stickyNavTop = jQuery( '.islemag-sticky' ).offset().top;
17
18					var stickyNav = function () {
19						var scrollTop    = jQuery( window ).scrollTop();
20						var window_width = jQuery( window ).outerWidth( true );
21
22						if (scrollTop > stickyNavTop && window_width > 991) {
23							jQuery( '.islemag-sticky' ).addClass( 'sticky-menu' );
24						} else {
25							jQuery( '.islemag-sticky' ).removeClass( 'sticky-menu' );
26						}
27
28					};
29
30				}
31			}
32
33		}
34
35		if ( ! stickyMenu.disable_sticky ) {
36			stickyNav();
37		}
38		jQuery( window ).scroll(
39			function() {
40				if ( ! stickyMenu.disable_sticky ) {
41					stickyNav();
42				}
43			}
44		);
45	}
46);
47
48jQuery( window ).on(
49	'resize', function(){
50
51		// Search Box
52		var top_navbar = jQuery( '.navbar-top' ).height();
53		if ( top_navbar > 40 ) {
54			var searchbox_margin = ( top_navbar - 53 ) * -1;
55			jQuery( '#header-search-form' ).css( 'margin-top', searchbox_margin );
56		} else {
57			jQuery( '#header-search-form' ).css( 'margin-top', '15px' );
58		}
59
60	}
61);
62
63jQuery( document ).ready(
64	function() {
65
66		// Search box
67		var top_navbar = jQuery( '.navbar-top' ).height();
68		if ( top_navbar > 38 ) {
69			var searchbox_margin = ( top_navbar - 53 ) * -1;
70			jQuery( '#header-search-form' ).css( 'margin-top', searchbox_margin );
71		} else {
72			jQuery( '#header-search-form' ).css( 'margin-top', searchbox_margin );
73		}
74
75		jQuery( '.navbar-btn' ).click(
76			function(){
77				jQuery( '#header-search-form' ).fadeToggle( 'fast', 'linear' );
78			}
79		);
80
81		/**
82	* Provides helper functions to enhance the theme experience.
83	*/
84		( function( $ ) {
85			var body = $( 'body' ), _window = $( window ),	nav, button, menu;
86
87			button = $( '.menu-toggle' );
88			menu   = $( '.nav-menu' );
89
90			function initMainNavigation( container ) {
91
92				// Add dropdown toggle that display child menu items.
93				container.find( '.menu-item-has-children > a' ).after( '<button class="dropdown-toggle" aria-expanded="false">' + screenReaderText.expand + '</button>' );
94				container.find( '.page_item_has_children > a' ).after( '<button class="dropdown-toggle" aria-expanded="false">' + screenReaderText.expand + '</button>' );
95
96				// Toggle buttons and submenu items with active children menu items.
97				container.find( '.current-menu-ancestor > button' ).addClass( 'toggled-on' );
98				container.find( '.current-menu-ancestor > .sub-menu' ).addClass( 'toggled-on' );
99
100				// Add menu items with submenus to aria-haspopup="true".
101				container.find( '.menu-item-has-children' ).attr( 'aria-haspopup', 'true' );
102
103				container.find( '.dropdown-toggle' ).click(
104					function( e ) {
105						var _this = $( this );
106						e.preventDefault();
107						_this.toggleClass( 'toggled-on' );
108						_this.next( '.children, .sub-menu' ).toggleClass( 'toggled-on' );
109						_this.attr( 'aria-expanded', _this.attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' );
110						_this.html( _this.html() === screenReaderText.expand ? screenReaderText.collapse : screenReaderText.expand );
111					}
112				);
113			}
114			initMainNavigation( $( '.main-navigation' ) );
115
116			/**
117	   * Enables menu toggle for small screens.
118	   */
119			( function() {
120
121				button.on(
122					'click.islemag', function() {
123						nav  = $( this ).parent();
124						menu = nav.find( '.nav-menu' );
125
126						nav.toggleClass( 'toggled-on' );
127						if ( nav.hasClass( 'toggled-on' ) ) {
128							$( this ).attr( 'aria-expanded', 'true' );
129							menu.attr( 'aria-expanded', 'true' );
130						} else {
131							$( this ).attr( 'aria-expanded', 'false' );
132							menu.attr( 'aria-expanded', 'false' );
133						}
134					}
135				);
136
137				// Fix sub-menus for touch devices.
138				if ( 'ontouchstart' in window ) {
139					menu.find( '.menu-item-has-children > a, .page_item_has_children > a' ).on(
140						'touchstart.islemag', function( e ) {
141							var el = $( this ).parent( 'li' );
142
143							if ( ! el.hasClass( 'focus' ) ) {
144								e.preventDefault();
145								el.toggleClass( 'focus' );
146								el.siblings( '.focus' ).removeClass( 'focus' );
147							}
148						}
149					);
150				}
151
152				// Better focus for hidden submenu items for accessibility.
153				menu.find( 'a' ).on(
154					'focus.islemag blur.islemag', function() {
155						$( this ).parents( '.menu-item, .page_item' ).toggleClass( 'focus' );
156					}
157				);
158			} )();
159
160			/**
161			 * @summary Add or remove ARIA attributes.
162			 * Uses jQuery's width() function to determine the size of the window and add
163			 * the default ARIA attributes for the menu toggle if it's visible.
164			 * @since Twenty Thirteen 1.5
165			 */
166			function onResizeARIA() {
167				if ( 643 > _window.width() ) {
168					button.attr( 'aria-expanded', 'false' );
169					menu.attr( 'aria-expanded', 'false' );
170					button.attr( 'aria-controls', 'primary-menu' );
171				} else {
172					button.removeAttr( 'aria-expanded' );
173					menu.removeAttr( 'aria-expanded' );
174					button.removeAttr( 'aria-controls' );
175				}
176			}
177
178			_window
179			.on( 'load.islemag', onResizeARIA )
180			.on(
181				'resize.islemag', function() {
182					onResizeARIA();
183				}
184			);
185
186			/**
187		 * Makes "skip to content" link work correctly in IE9 and Chrome for better
188		 * accessibility.
189		 *
190		 * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
191		 */
192			  _window.on(
193				  'hashchange.islemag', function() {
194					var element = document.getElementById( location.hash.substring( 1 ) );
195
196					if ( element ) {
197                        if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) {
198							element.tabIndex = -1;
199						}
200
201						element.focus();
202					}
203				  }
204			  );
205
206			/**
207		 * Handles toggling the navigation menu for small screens and enables tab
208		 * support for dropdown menus.
209		 */
210			( function() {
211				var container, button, menu;
212
213				container = document.getElementById( 'site-navigation' );
214				if ( ! container ) {
215					return;
216				}
217
218				menu = container.getElementsByTagName( 'ul' )[0];
219
220				// Hide menu toggle button if menu is empty and return early.
221				if ( 'undefined' === typeof menu ) {
222					button.style.display = 'none';
223					return;
224				}
225
226				menu.setAttribute( 'aria-expanded', 'false' );
227				if ( -1 === menu.className.indexOf( 'nav-menu' ) ) {
228					menu.className += ' nav-menu';
229				}
230
231			} )();
232
233		} )( jQuery );
234	}
235);

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.