PageSourceSearch

https://solorma.net/wp-content/themes/twentythirteen/js/functions_ver-20150330.js

js solorma.net collected 2026-09-30 12:33:01 UTC 4,312 bytes, 142 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 * Functionality specific to Twenty Thirteen.
12 *
13 * Provides helper functions to enhance the theme experience.
14 */
15
16( function( $ ) {
17	var body    = $( 'body' ),
18	    _window = $( window ),
19		nav, button, menu;
20
21	nav = $( '#site-navigation' );
22	button = nav.find( '.menu-toggle' );
23	menu = nav.find( '.nav-menu' );
24
25	/**
26	 * Adds a top margin to the footer if the sidebar widget area is higher
27	 * than the rest of the page, to help the footer always visually clear
28	 * the sidebar.
29	 */
30	$( function() {
31		if ( body.is( '.sidebar' ) ) {
32			var sidebar   = $( '#secondary .widget-area' ),
33			    secondary = ( 0 === sidebar.length ) ? -40 : sidebar.height(),
34			    margin    = $( '#tertiary .widget-area' ).height() - $( '#content' ).height() - secondary;
35
36			if ( margin > 0 && _window.innerWidth() > 999 ) {
37				$( '#colophon' ).css( 'margin-top', margin + 'px' );
38			}
39		}
40	} );
41
42	/**
43	 * Enables menu toggle for small screens.
44	 */
45	( function() {
46		if ( ! nav || ! button ) {
47			return;
48		}
49
50		// Hide button if menu is missing or empty.
51		if ( ! menu || ! menu.children().length ) {
52			button.hide();
53			return;
54		}
55
56		button.on( 'click.twentythirteen', function() {
57			nav.toggleClass( 'toggled-on' );
58			if ( nav.hasClass( 'toggled-on' ) ) {
59				$( this ).attr( 'aria-expanded', 'true' );
60				menu.attr( 'aria-expanded', 'true' );
61			} else {
62				$( this ).attr( 'aria-expanded', 'false' );
63				menu.attr( 'aria-expanded', 'false' );
64			}
65		} );
66
67		// Fix sub-menus for touch devices.
68		if ( 'ontouchstart' in window ) {
69			menu.find( '.menu-item-has-children > a, .page_item_has_children > a' ).on( 'touchstart.twentythirteen', function( e ) {
70				var el = $( this ).parent( 'li' );
71
72				if ( ! el.hasClass( 'focus' ) ) {
73					e.preventDefault();
74					el.toggleClass( 'focus' );
75					el.siblings( '.focus' ).removeClass( 'focus' );
76				}
77			} );
78		}
79
80		// Better focus for hidden submenu items for accessibility.
81		menu.find( 'a' ).on( 'focus.twentythirteen blur.twentythirteen', function() {
82			$( this ).parents( '.menu-item, .page_item' ).toggleClass( 'focus' );
83		} );
84	} )();
85
86	/**
87	 * @summary Add or remove ARIA attributes.
88	 * Uses jQuery's width() function to determine the size of the window and add
89	 * the default ARIA attributes for the menu toggle if it's visible.
90	 * @since Twenty Thirteen 1.5
91	 */
92	function onResizeARIA() {
93		if ( 643 > _window.width() ) {
94			button.attr( 'aria-expanded', 'false' );
95			menu.attr( 'aria-expanded', 'false' );
96			button.attr( 'aria-controls', 'primary-menu' );
97		} else {
98			button.removeAttr( 'aria-expanded' );
99			menu.removeAttr( 'aria-expanded' );
100			button.removeAttr( 'aria-controls' );
101		}
102	}
103
104	_window
105		.on( 'load.twentythirteen', onResizeARIA )
106		.on( 'resize.twentythirteen', function() {
107			onResizeARIA();
108	} );
109
110	/**
111	 * Makes "skip to content" link work correctly in IE9 and Chrome for better
112	 * accessibility.
113	 *
114	 * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
115	 */
116	_window.on( 'hashchange.twentythirteen', function() {
117		var element = document.getElementById( location.hash.substring( 1 ) );
118
119		if ( element ) {
120			if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) {
121				element.tabIndex = -1;
122			}
123
124			element.focus();
125		}
126	} );
127
128	/**
129	 * Arranges footer widgets vertically.
130	 */
131	if ( $.isFunction( $.fn.masonry ) ) {
132		var columnWidth = body.is( '.sidebar' ) ? 228 : 245;
133
134		$( '#secondary .widget-area' ).masonry( {
135			itemSelector: '.widget',
136			columnWidth: columnWidth,
137			gutterWidth: 20,
138			isRTL: body.is( '.rtl' )
139		} );
140	}
141} )( jQuery );
142}

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.