PageSourceSearch

https://www.paulauster.co.uk/wp-content/themes/nisarg/js/nisarg.js?ver=7.0.6

js paulauster.co.uk collected 2026-09-24 22:32:41 UTC 2,267 bytes, 61 lines download raw bytes

1/**
2 * Functions to add dropdown caret at the end of navigation menu item with children
3 * and code to remove white between navigation menu and header image.
4 */
5
6(function($){
7    /**
8      * Add Carate-down at the end of menu item, if the menu item has children
9      */
10    function initMainNavigation( container ) {
11        // Add dropdown toggle that displays child menu items.
12        var dropdownToggle = $( '<button />', {
13            'class': 'dropdown-toggle',
14            'aria-expanded': false
15        } ).append( $( '<span />', {
16            'class': 'screen-reader-text',
17            text: screenReaderText.expand
18        } ) );
19
20        container.find( '.menu-item-has-children > a' ).after( dropdownToggle );
21
22        // Toggle buttons and submenu items with active children menu items.
23        container.find( '.current-menu-ancestor > button' ).addClass( 'toggled-on' );
24        container.find( '.current-menu-ancestor > .sub-menu' ).addClass( 'toggled-on' );
25
26        // Add menu items with submenus to aria-haspopup="true".
27        container.find( '.menu-item-has-children' ).attr( 'aria-haspopup', 'true' );
28
29        container.find( '.dropdown-toggle' ).click( function( e ) {
30            var _this            = $( this ),
31                screenReaderSpan = _this.find( '.screen-reader-text' );
32
33            e.preventDefault();
34            _this.toggleClass( 'toggled-on' );
35            _this.next( '.children, .sub-menu' ).toggleClass( 'toggled-on' );
36
37            // jscs:disable
38            _this.attr( 'aria-expanded', _this.attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' );
39            // jscs:enable
40            screenReaderSpan.text( screenReaderSpan.text() === screenReaderText.expand ? screenReaderText.collapse : screenReaderText.expand );
41        } );
42    }
43    initMainNavigation( $( '.main-navigation' ) );
44
45    /**
46      * Remove white space between menu and header image.
47      */
48    var setHeight = function (h) {	
49    	height = h;
50    	$("#cc_spacer").css("height", height + "px");
51	}
52
53	$(window).resize(function(){
54		setHeight($("#navigation_menu").height());
55	});
56
57	$(window).ready(function(){
58		setHeight($("#navigation_menu").height());
59	});
60})(jQuery);
61

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.