PageSourceSearch

https://shop.dailymaverick.co.za/wp-content/themes/storefront/assets/js/footer.js?ver=4.6.1

js dailymaverick.co.za collected 2026-09-24 07:50:07 UTC 1,590 bytes, 57 lines download raw bytes

1/**
2 * footer.js
3 *
4 * Adds a class required to reveal the search in the handheld footer bar.
5 * Also hides the handheld footer bar when an input is focused.
6 */
7( function () {
8	// Wait for DOM to be ready.
9	document.addEventListener( 'DOMContentLoaded', function () {
10		if (
11			document.getElementsByClassName( 'storefront-handheld-footer-bar' )
12				.length === 0
13		) {
14			return;
15		}
16
17		// Add class to footer search when clicked.
18		[].forEach.call(
19			document.querySelectorAll(
20				'.storefront-handheld-footer-bar .search > a'
21			),
22			function ( anchor ) {
23				anchor.addEventListener( 'click', function ( event ) {
24					anchor.parentElement.classList.toggle( 'active' );
25					event.preventDefault();
26				} );
27			}
28		);
29
30		// Add focus class to body when an input field is focused.
31		// This is used to hide the Handheld Footer Bar when an input is focused.
32		const footerBar = document.getElementsByClassName(
33			'storefront-handheld-footer-bar'
34		);
35		const forms = document.forms;
36		const isFocused = function ( focused ) {
37			return function ( event ) {
38				if ( !! focused && event.target.tabIndex !== -1 ) {
39					document.body.classList.add( 'sf-input-focused' );
40				} else {
41					document.body.classList.remove( 'sf-input-focused' );
42				}
43			};
44		};
45
46		if ( footerBar.length && forms.length ) {
47			for ( let i = 0; i < forms.length; i++ ) {
48				if ( footerBar[ 0 ].contains( forms[ i ] ) ) {
49					continue;
50				}
51
52				forms[ i ].addEventListener( 'focus', isFocused( true ), true );
53				forms[ i ].addEventListener( 'blur', isFocused( false ), true );
54			}
55		}
56	} );
57} )();

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.