PageSourceSearch

https://ardikapercha.com/wp-content/themes/twentyfourteen/js/functions_ver-20171218.js

js ardikapercha.com collected 2026-09-27 06:58:42 UTC 6,776 bytes, 222 lines download raw bytes

1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{
2let window = _____WB$wombat$assign$function_____("window");
3let self = _____WB$wombat$assign$function_____("self");
4let document = _____WB$wombat$assign$function_____("document");
5let location = _____WB$wombat$assign$function_____("location");
6let top = _____WB$wombat$assign$function_____("top");
7let parent = _____WB$wombat$assign$function_____("parent");
8let frames = _____WB$wombat$assign$function_____("frames");
9let opens = _____WB$wombat$assign$function_____("opens");
10/**
11 * Theme functions file.
12 *
13 * Contains handlers for navigation, accessibility, header sizing
14 * footer widgets and Featured Content slider
15 *
16 */
17( function( $ ) {
18	var body    = $( 'body' ),
19		_window = $( window ),
20		nav, button, menu;
21
22	nav = $( '#primary-navigation' );
23	button = nav.find( '.menu-toggle' );
24	menu = nav.find( '.nav-menu' );
25
26	// Enable menu toggle for small screens.
27	( function() {
28		if ( ! nav.length || ! button.length ) {
29			return;
30		}
31
32		// Hide button if menu is missing or empty.
33		if ( ! menu.length || ! menu.children().length ) {
34			button.hide();
35			return;
36		}
37
38		button.on( 'click.twentyfourteen', function() {
39			nav.toggleClass( 'toggled-on' );
40			if ( nav.hasClass( 'toggled-on' ) ) {
41				$( this ).attr( 'aria-expanded', 'true' );
42				menu.attr( 'aria-expanded', 'true' );
43			} else {
44				$( this ).attr( 'aria-expanded', 'false' );
45				menu.attr( 'aria-expanded', 'false' );
46			}
47		} );
48	} )();
49
50	/*
51	 * Makes "skip to content" link work correctly in IE9 and Chrome for better
52	 * accessibility.
53	 *
54	 * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
55	 */
56	_window.on( 'hashchange.twentyfourteen', function() {
57		var hash = location.hash.substring( 1 ), element;
58
59		if ( ! hash ) {
60			return;
61		}
62
63		element = document.getElementById( hash );
64
65		if ( element ) {
66			if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) {
67				element.tabIndex = -1;
68			}
69
70			element.focus();
71
72			// Repositions the window on jump-to-anchor to account for header height.
73			window.scrollBy( 0, -80 );
74		}
75	} );
76
77	$( function() {
78		// Search toggle.
79		$( '.search-toggle' ).on( 'click.twentyfourteen', function( event ) {
80			var that    = $( this ),
81				wrapper = $( '#search-container' ),
82				container = that.find( 'a' );
83
84			that.toggleClass( 'active' );
85			wrapper.toggleClass( 'hide' );
86
87			if ( that.hasClass( 'active' ) ) {
88				container.attr( 'aria-expanded', 'true' );
89			} else {
90				container.attr( 'aria-expanded', 'false' );
91			}
92
93			if ( that.is( '.active' ) || $( '.search-toggle .screen-reader-text' )[0] === event.target ) {
94				wrapper.find( '.search-field' ).focus();
95			}
96		} );
97
98		/*
99		 * Fixed header for large screen.
100		 * If the header becomes more than 48px tall, unfix the header.
101		 *
102		 * The callback on the scroll event is only added if there is a header
103		 * image and we are not on mobile.
104		 */
105		if ( _window.width() > 781 ) {
106			var mastheadHeight = $( '#masthead' ).height(),
107				toolbarOffset, mastheadOffset;
108
109			if ( mastheadHeight > 48 ) {
110				body.removeClass( 'masthead-fixed' );
111			}
112
113			if ( body.is( '.header-image' ) ) {
114				toolbarOffset  = body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0;
115				mastheadOffset = $( '#masthead' ).offset().top - toolbarOffset;
116
117				_window.on( 'scroll.twentyfourteen', function() {
118					if ( _window.scrollTop() > mastheadOffset && mastheadHeight < 49 ) {
119						body.addClass( 'masthead-fixed' );
120					} else {
121						body.removeClass( 'masthead-fixed' );
122					}
123				} );
124			}
125		}
126
127		// Focus styles for menus.
128		$( '.primary-navigation, .secondary-navigation' ).find( 'a' ).on( 'focus.twentyfourteen blur.twentyfourteen', function() {
129			$( this ).parents().toggleClass( 'focus' );
130		} );
131	} );
132
133	/**
134	 * Add or remove ARIA attributes.
135	 *
136	 * Uses jQuery's width() function to determine the size of the window and add
137	 * the default ARIA attributes for the menu toggle if it's visible.
138	 *
139	 * @since Twenty Fourteen 1.4
140	 */
141	function onResizeARIA() {
142		if ( 781 > _window.width() ) {
143			button.attr( 'aria-expanded', 'false' );
144			menu.attr( 'aria-expanded', 'false' );
145			button.attr( 'aria-controls', 'primary-menu' );
146		} else {
147			button.removeAttr( 'aria-expanded' );
148			menu.removeAttr( 'aria-expanded' );
149			button.removeAttr( 'aria-controls' );
150		}
151	}
152
153	_window
154		.on( 'load.twentyfourteen', onResizeARIA )
155		.on( 'resize.twentyfourteen', function() {
156			onResizeARIA();
157	} );
158
159	_window.on( 'load', function() {
160		var footerSidebar,
161			isCustomizeSelectiveRefresh = ( 'undefined' !== typeof wp && wp.customize && wp.customize.selectiveRefresh );
162
163		// Arrange footer widgets vertically.
164		if ( typeof $.fn.masonry === 'function' ) {
165			footerSidebar = $( '#footer-sidebar' );
166			footerSidebar.masonry( {
167				itemSelector: '.widget',
168				columnWidth: function( containerWidth ) {
169					return containerWidth / 4;
170				},
171				gutterWidth: 0,
172				isResizable: true,
173				isRTL: $( 'body' ).is( '.rtl' )
174			} );
175
176			if ( isCustomizeSelectiveRefresh ) {
177
178				// Retain previous masonry-brick initial position.
179				wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function( placement ) {
180					var copyPosition = (
181						placement.partial.extended( wp.customize.widgetsPreview.WidgetPartial ) &&
182						placement.removedNodes instanceof jQuery &&
183						placement.removedNodes.is( '.masonry-brick' ) &&
184						placement.container instanceof jQuery
185					);
186					if ( copyPosition ) {
187						placement.container.css( {
188							position: placement.removedNodes.css( 'position' ),
189							top: placement.removedNodes.css( 'top' ),
190							left: placement.removedNodes.css( 'left' )
191						} );
192					}
193				} );
194
195				// Re-arrange footer widgets after selective refresh event.
196				wp.customize.selectiveRefresh.bind( 'sidebar-updated', function( sidebarPartial ) {
197					if ( 'sidebar-3' === sidebarPartial.sidebarId ) {
198						footerSidebar.masonry( 'reloadItems' );
199						footerSidebar.masonry( 'layout' );
200					}
201				} );
202			}
203		}
204
205		// Initialize audio and video players in Twenty_Fourteen_Ephemera_Widget widget when selectively refreshed in Customizer.
206		if ( isCustomizeSelectiveRefresh && wp.mediaelement ) {
207			wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function() {
208				wp.mediaelement.initialize();
209			} );
210		}
211
212		// Initialize Featured Content slider.
213		if ( body.is( '.slider' ) ) {
214			$( '.featured-content' ).featuredslider( {
215				selector: '.featured-content-inner > article',
216				controlsContainer: '.featured-content'
217			} );
218		}
219	} );
220} )( jQuery );
221
222}

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.