PageSourceSearch

https://transhumanist-party.org/wp-content/themes/nisargpro/js/nisargpro.js?ver=7.1.2

js transhumanist-party.org collected 2026-09-24 21:44:34 UTC 3,878 bytes, 101 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	$(window).resize(function(){
53		setHeight($("#navigation_menu").height());
54	});
55	$(window).ready(function(){
56		setHeight($("#navigation_menu").height());
57	});
58
59    /**
60     * Hide or show search box.
61     */
62     
63    $('.main-navigation').on('click tap', '#desktop-search-icon',function ( event ) {
64        event.stopPropagation();
65        $('#navbar-search-box').toggleClass('display-searchbox');
66        if( $('.main-navigation .menu-item-search i').hasClass($toggle_class) ) {
67            $('.main-navigation .menu-item-search i').removeClass($toggle_class);
68            if($toggle_class === 'fa-search') {
69                $toggle_class = 'fa-times';
70            } else {
71                $toggle_class = 'fa-search';
72            }
73            $('.menu-item-search i').addClass($toggle_class);
74        }
75    }); 
76    $toggle_class = 'fa-search';
77    $('#desktop-search-icon').on('click tap', function ( event ) {
78        event.stopPropagation();
79        $('#navbar-search-box').toggleClass('display-searchbox');
80        if( $('.menu-item-search i').hasClass($toggle_class) ) {
81            $('.menu-item-search i').removeClass($toggle_class);
82            if($toggle_class === 'fa-search') {
83                $toggle_class = 'fa-times';
84            } else {
85                $toggle_class = 'fa-search';
86            }
87            $('.menu-item-search i').addClass($toggle_class);
88        }
89    });
90    $( '#goToTop' ).on( 'click', function() {
91        $('html, body').animate( { scrollTop : 0 }, 800 );
92        return false;
93    });
94    $( window ).on( 'scroll', function() {
95        if ($(this).scrollTop() >= 800 ) {
96            $('#goToTop').fadeIn(350);
97        } else {
98            $('#goToTop').fadeOut(350);
99        }
100    });
101})(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.