PageSourceSearch

https://www.1966batfan.com/wp-content/themes/boston-pro/assets/js/theme.js

js 1966batfan.com collected 2026-10-02 12:41:38 UTC 7,647 bytes, 274 lines download raw bytes

1/**
2 * File skip-link-focus-fix.js.
3 *
4 * Helps with accessibility for keyboard only users.
5 *
6 * Learn more: https://git.io/vWdr2
7 */
8( function() {
9	var isWebkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1,
10	    isOpera  = navigator.userAgent.toLowerCase().indexOf( 'opera' )  > -1,
11	    isIe     = navigator.userAgent.toLowerCase().indexOf( 'msie' )   > -1;
12
13	if ( ( isWebkit || isOpera || isIe ) && document.getElementById && window.addEventListener ) {
14		window.addEventListener( 'hashchange', function() {
15			var id = location.hash.substring( 1 ),
16				element;
17
18			if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) {
19				return;
20			}
21
22			element = document.getElementById( id );
23
24			if ( element ) {
25				if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) {
26					element.tabIndex = -1;
27				}
28
29				element.focus();
30			}
31		}, false );
32	}
33})();
34
35/**
36 * File navigation.js.
37 *
38 * Handles toggling the navigation menu for small screens and enables TAB key
39 * navigation support for dropdown menus.
40 */
41( function() {
42	var container, button, menu, links, subMenus, i, len;
43
44	container = document.getElementById( 'site-navigation' );
45	if ( ! container ) {
46		return;
47	}
48
49	button = container.getElementsByTagName( 'button' )[0];
50	if ( 'undefined' === typeof button ) {
51		return;
52	}
53
54	menu = container.getElementsByTagName( 'ul' )[0];
55
56	// Hide menu toggle button if menu is empty and return early.
57	if ( 'undefined' === typeof menu ) {
58		button.style.display = 'none';
59		return;
60	}
61
62	menu.setAttribute( 'aria-expanded', 'false' );
63	if ( -1 === menu.className.indexOf( 'nav-menu' ) ) {
64		menu.className += ' nav-menu';
65	}
66
67	button.onclick = function() {
68		if ( -1 !== container.className.indexOf( 'toggled' ) ) {
69			container.className = container.className.replace( ' toggled', '' );
70			button.setAttribute( 'aria-expanded', 'false' );
71			menu.setAttribute( 'aria-expanded', 'false' );
72		} else {
73			container.className += ' toggled';
74			button.setAttribute( 'aria-expanded', 'true' );
75			menu.setAttribute( 'aria-expanded', 'true' );
76		}
77	};
78
79	// Get all the link elements within the menu.
80	links    = menu.getElementsByTagName( 'a' );
81	subMenus = menu.getElementsByTagName( 'ul' );
82
83	// Set menu items with submenus to aria-haspopup="true".
84	for ( i = 0, len = subMenus.length; i < len; i++ ) {
85		subMenus[i].parentNode.setAttribute( 'aria-haspopup', 'true' );
86	}
87
88	// Each time a menu link is focused or blurred, toggle focus.
89	for ( i = 0, len = links.length; i < len; i++ ) {
90		links[i].addEventListener( 'focus', toggleFocus, true );
91		links[i].addEventListener( 'blur', toggleFocus, true );
92	}
93
94	/**
95	 * Sets or removes .focus class on an element.
96	 */
97	function toggleFocus() {
98		var self = this;
99
100		// Move up through the ancestors of the current link until we hit .nav-menu.
101		while ( -1 === self.className.indexOf( 'nav-menu' ) ) {
102
103			// On li elements toggle the class .focus.
104			if ( 'li' === self.tagName.toLowerCase() ) {
105				if ( -1 !== self.className.indexOf( 'focus' ) ) {
106					self.className = self.className.replace( ' focus', '' );
107				} else {
108					self.className += ' focus';
109				}
110			}
111
112			self = self.parentElement;
113		}
114	}
115
116	/**
117	 * Toggles `focus` class to allow submenu access on tablets.
118	 */
119	( function( container ) {
120		var touchStartFn, i,
121			parentLink = container.querySelectorAll( '.menu-item-has-children > a, .page_item_has_children > a' );
122
123		if ( 'ontouchstart' in window ) {
124			touchStartFn = function( e ) {
125				var menuItem = this.parentNode, i;
126
127				if ( ! menuItem.classList.contains( 'focus' ) ) {
128					e.preventDefault();
129					for ( i = 0; i < menuItem.parentNode.children.length; ++i ) {
130						if ( menuItem === menuItem.parentNode.children[i] ) {
131							continue;
132						}
133						menuItem.parentNode.children[i].classList.remove( 'focus' );
134					}
135					menuItem.classList.add( 'focus' );
136				} else {
137					menuItem.classList.remove( 'focus' );
138				}
139			};
140
141			for ( i = 0; i < parentLink.length; ++i ) {
142				parentLink[i].addEventListener( 'touchstart', touchStartFn, false );
143			}
144		}
145	}( container ) );
146} )();
147
148// Call owl carousel for featured content.
149jQuery( document ).ready( function( $ ){
150
151    var slider_autoplay = false;
152    if ( Boston_Pro.slider.autoplay == 1 ) {
153        slider_autoplay = parseInt( Boston_Pro.slider.delay );
154        if ( isNaN( slider_autoplay ) ) {
155            slider_autoplay = 5000;
156        }
157    }
158
159    var slider_speed = parseInt( Boston_Pro.slider.speed );
160    if ( isNaN( slider_speed ) ) {
161        slider_autoplay = 200;
162    }
163
164	jQuery('.featured_posts').owlCarousel( {
165		autoPlay: slider_autoplay,
166        slideSpeed: slider_speed,
167		items : 3,
168		itemsDesktop: 2,
169		itemsDesktopSmall: [979,2],
170		paginationNumbers: false,
171        stopOnHover: true,
172	} );
173
174    jQuery('.featured_posts_slider').owlCarousel( {
175        autoPlay: slider_autoplay,
176        slideSpeed: slider_speed,
177        items : 1,
178        itemsDesktop: 1,
179        itemsDesktopSmall :1,
180        itemsTablet : 1,
181        itemsTabletSmall : 1,
182        itemsMobile : 1,
183        singleItem : 1,
184        autoHeight : true,
185
186        paginationNumbers: false,
187        pagination: false,
188        navigation: true,
189        stopOnHover: true,
190        navigationText : ['<span class="genericon genericon-previous"></span>', '<span class="genericon genericon-next"></span>'],
191    } );
192
193    jQuery('.footer-instagram-feed .instagram-pics').each( function(){
194        var c = $( this );
195        var ni = c.attr( 'data-number' ) || 8;
196        var n, dmn = 6, mn = 5;
197        // Responsive mobile
198        if ( ni > 8 ) {
199            n = 8;
200        } else {
201            n = ni;
202        }
203        // Responsive tablet
204        if( n > 6 ) {
205            dmn = 6;
206        } else {
207            dmn = n;
208        }
209        // Responsive mobile
210        if( mn > 5 ) {
211            mn = 5;
212        } else {
213            mn = n;
214        }
215
216        c.owlCarousel( {
217            autoPlay: false,
218            items : n,
219            itemsDesktop: [1199, n],
220            itemsDesktopSmall: [979, dmn],
221            itemsTablet : [768, dmn],
222            itemsTabletSmall : false,
223            itemsMobile : [479, mn],
224            paginationNumbers: false,
225            pagination : false,
226        } );
227
228    } );
229
230
231    // Sticky header
232    if ( Boston_Pro.header_fixed == 1 ) {
233        var top_bar = $('.site-topbar');
234        top_bar.wrap('<div class="site-topbar-wrap">');
235        var top_bar_wrap = top_bar.parent();
236        top_bar_wrap.css({
237            height: top_bar.outerHeight() + 'px',
238            display: 'block',
239        });
240
241        $( window ).on('resize', function () {
242            top_bar_wrap.removeAttr('style');
243            top_bar_wrap.css({
244                height: top_bar.outerHeight() + 'px',
245                display: 'block',
246            });
247        });
248
249        $( window ).on("scroll", function () {
250            var fromTop = $(document).scrollTop();
251            var _top = 0;
252            var is_fixed_admin = false;
253            if ( $('#wpadminbar').length > 0 ) {
254                _top = $('#wpadminbar').outerHeight();
255                if ('fixed' == $('#wpadminbar').css('position')) {
256                    is_fixed_admin = true;
257                }
258            }
259            if ( fromTop > _top ) {
260                top_bar_wrap.addClass('fixed');
261                if (is_fixed_admin) {
262                    top_bar.css('top', _top + 'px');
263                } else {
264                    top_bar.css('top', '0px');
265                }
266            } else {
267                top_bar_wrap.removeClass('fixed');
268                top_bar.css('top', '0');
269            }
270        });
271    }
272
273
274} );

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.