PageSourceSearch

https://houstontruckaccident.lawyer/wp-content/themes/broadsheet/js/main.js?ver=1.0

js houstontruckaccident.lawyer collected 2026-10-08 23:07:28 UTC 3,948 bytes, 192 lines download raw bytes

1/**
2 * main.js v1
3 * Created by Ben Gillbanks <http://www.binarymoon.co.uk/>
4 * Available under GPL2 license
5 */
6
7; ( function( $ ) {
8
9	// js mobile detection
10
11	var is_touch_device = function() {
12
13		return ( ( 'ontouchstart' in window ) || ( navigator.MaxTouchPoints > 0 ) || ( navigator.msMaxTouchPoints > 0 ) );
14
15	};
16
17
18	$( document ).ready( function() {
19
20		// attachment page navigation
21		if ( $( 'body' ).hasClass( 'attachment' ) ) {
22
23			$( document ).keydown( function( e ) {
24
25				if ( $( 'textarea, input' ).is( ':focus' ) ) {
26					return;
27				}
28
29				var url = false;
30
31				switch ( e.which ) {
32					// left arrow key (previous attachment)
33					case 37:
34						url = $( '.image-previous a' ).attr( 'href' );
35						break;
36
37					// right arrow key (next attachment)
38					case 39:
39						url = $( '.image-next a' ).attr( 'href' );
40						break;
41
42				}
43
44				if ( url ) {
45					window.location = url;
46				}
47			} );
48
49		}
50
51		// Masonry
52		$( window ).on(
53			'load',
54			function() {
55
56				// Arrange footer widgets
57				if ( $.isFunction( $.fn.masonry ) ) {
58
59					var $footer_widgets = null;
60
61					$footer_widgets = $( 'footer#footer .footer-widgets' ).masonry(
62						{
63							itemSelector: '.widget',
64							gutter: 0,
65							isOriginLeft: !$( 'body' ).is( '.rtl' )
66						}
67					);
68
69					// Update again once images have loaded.
70					$footer_widgets.imagesLoaded(
71						function() {
72
73							$footer_widgets.masonry( 'layout' );
74
75						}
76					);
77
78					// Reflow widgets after 2 seconds to ensure the correct position
79					// due to dynamic widgets like facebook and twitter loading.
80					setTimeout(
81						function() {
82							$footer_widgets.masonry( 'layout' );
83						},
84						2000
85					);
86
87					// Reflow Footer Widgets if changed in the Customizer.
88					if ( 'undefined' !== typeof wp && wp.customize && wp.customize.selectiveRefresh ) {
89
90						wp.customize.selectiveRefresh.bind(
91							'sidebar-updated',
92							function( sidebarPartial ) {
93								if ( 'sidebar-2' === sidebarPartial.sidebarId ) {
94									$footer_widgets.masonry( 'reloadItems' );
95									$footer_widgets.masonry( 'layout' );
96								}
97							}
98						);
99
100					}
101
102					$( 'body.archive .testimonials' ).imagesLoaded( function() {
103						$( 'body.archive .testimonials' ).masonry( {
104							itemSelector: '.testimonial',
105							gutter: 0,
106							isOriginLeft: !$( 'body' ).is( '.rtl' )
107						} );
108					} );
109				}
110
111			}
112		);
113
114		// Allow menu items to trigger properly on touch devices
115		$.fn.touchTwice = function() {
116
117			if ( !is_touch_device() ) {
118				return;
119			}
120
121			this.each( function() {
122
123				// Current clicked item
124				var $curItem = false;
125
126				// Element clicked
127				$( this ).on( 'click', function( e ) {
128
129					var $item = $( this );
130
131					// The item clicked is not the currently active item so cancel the default behaviour
132					if ( $item[ 0 ] !== $curItem[ 0 ] ) {
133
134						e.preventDefault();
135						$curItem = $item;
136
137					}
138
139				} );
140
141				// On click outside of menu - reset menu
142				$( document ).on( 'click touchstart MSPointerDown', function( e ) {
143
144					var resetItem = true;
145					var $parents = $( e.target ).parents();
146
147					// Ensure it's not the menu being clicked
148					for ( var i = 0; i < $parents.length; i++ ) {
149
150						// It's a child of the menu so let's not reset now
151						if ( $parents[ i ] === $curItem[ 0 ] ) {
152							resetItem = false;
153						}
154
155					}
156
157					if ( resetItem ) {
158						$curItem = false;
159					}
160
161				} );
162
163			} );
164
165			return this;
166
167		};
168
169
170		// Load slides
171		if ( $.isFunction( $.fn.elementalSlides ) ) {
172			$( '.primary-wrapper' ).elementalSlides( {
173				'nav_arrows': true
174			} );
175		}
176
177		// responsive navigation
178		$( '.menu-toggle' ).on( 'click', function() {
179			$( this ).parent().toggleClass( 'menu-on' );
180		} );
181
182		// Add focus class on touch devices
183		$( '.menu' ).find( 'a' ).on( 'focus blur', function() {
184			$( this ).parents().toggleClass( 'focus' );
185		} );
186
187		// Allow
188		$( '.menu li:has(ul)' ).touchTwice();
189
190	} );
191
192} )( 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.