PageSourceSearch

https://www.globalfundforwomen.org/wp-content/themes/gffw-theme/js/script.js?ver=1.2

js globalfundforwomen.org collected 2026-10-01 09:04:08 UTC 5,061 bytes, 134 lines download raw bytes

1(function($) {
2    const newURL = window.location.protocol + "//" + window.location.host + window.location.pathname;
3
4    window.onscroll = function() {
5        var currentScrollPos = window.pageYOffset;
6        // 20 is an arbitrary number here, just to make you think if you need the prevScrollpos variable:
7        if (currentScrollPos > 40) {
8          // I am using 'display' instead of 'top':
9          $('.fl-page-header-up-navigation').show();
10        } else {
11          $(".fl-page-header-up-navigation").hide();
12        }
13    }
14
15    $('.share-facebook').bind('click', function(e){
16        e.preventDefault();
17        FB.ui({
18            method: 'share',
19            href: newURL,
20        }, function(response){});
21    });
22
23    // Trigger share to facebook custom button
24    $('.fl-button-group-button-60ff22c480c00-0 .fl-button').bind('click', function(e){
25        e.preventDefault();
26        FB.ui({
27            method: 'share',
28            href: newURL,
29        }, function(response){});
30    });
31
32    $('.share-link').bind('click', function(e){
33        e.preventDefault();
34        navigator.clipboard.writeText(newURL)
35            .then(() => {
36                var share = document.getElementById('shareModal');
37                var shareBody = share.querySelector('.modal-body');
38                var notice = document.createElement("span");
39                notice.innerHTML = "Link Copied";
40                notice.classList.add('notice');
41                shareBody.appendChild(notice);
42                setTimeout(function(){
43                    notice.remove()
44                },3000);
45
46             })
47            .catch((error) => { alert(`Copy failed! ${error}`) })
48    });
49
50    // Add data layer events for analytics tracking
51    const attachDataLayerEvent = function(data) {
52        window.dataLayer = window.dataLayer || [];
53        window.dataLayer.push(data);
54    };
55    
56    window.addEventListener("load", () => {
57        document.querySelectorAll('[data-click-item]').forEach((el) => {
58            el.addEventListener('click', () => {
59                attachDataLayerEvent({
60                    event: 'click_event',
61                    click_item: el.dataset.clickItem,
62                    click_text: el.textContent.trim(),
63                    nav_link: el.dataset.navLink,
64                    element_location: el.dataset.elementLocation
65                });
66            });
67        });
68    });
69
70	/**
71	 * Update how the main menu works on mobile devices.
72	 *
73	 * UberMenu normally expands the menu when tapping the text. This function
74	 * changes the behaviour so that tapping the text will go to the section
75	 * instead.
76	 */
77	$( '.ubermenu-main .ubermenu-target-title' ).on( 'click touchstart', function ( e ) {
78		// Only run if the menu is in mobile mode.
79		if ( $( this ).closest( '.ubermenu-main' ).hasClass( 'ubermenu-mobile-view' ) ) {
80			e.stopPropagation();
81            e.preventDefault();
82
83			// Mobile chrome will still try to open the submenu as ubmermenu
84			// fires before this. Have to manually remove the elements :(
85			$( this ).closest( 'li' ).addClass( 'force-ubermenu-caret' );
86			$( this ).closest( 'li' ).find( '.ubermenu-submenu' ).remove();
87			$( this ).closest( 'li' ).find( '.ubermenu-sub-indicator-close' ).remove();
88			$( this ).closest( 'li' ).removeClass( 'ubermenu-active' );
89
90            const closestAnchor = $( this ).closest( 'a');
91            if (closestAnchor[0]) {
92                // add data layer event for mobile nav trigger
93                attachDataLayerEvent({
94                    event: 'click_event',
95                    click_item: closestAnchor[0].dataset.clickItem,
96                    click_text: closestAnchor[0].textContent.trim(),
97                    nav_link: closestAnchor[0].dataset.navLink,
98                    element_location: closestAnchor[0].dataset.elementLocation
99                });
100            }
101			document.location = closestAnchor.attr( 'href' );
102		}
103	} );
104
105    // Disable body scroll when mobile menu is open
106    $( '.ubermenu-responsive-toggle' ).on( 'ubermenutoggledopen' , function(e) {
107        // When the modal is shown, we want a fixed body
108        document.body.style.position = 'fixed';
109        document.body.style.width = '100%';
110        document.body.style.top = `-${window.scrollY}px`;
111    } );
112
113    // Enable body scroll when mobile menu is hidden
114    $( '.ubermenu-responsive-toggle' ).on( 'ubermenutoggledclose' , function(e) {
115        const scrollY = document.body.style.top;
116        document.body.style.position = '';
117        document.body.style.top = '';
118        document.body.style.removeProperty('width');
119        window.scrollTo(0, parseInt(scrollY || '0') * -1);
120    } );
121
122    // Autofocus search input
123    $('#searchModal').on('shown.bs.modal', function () {
124        $('.fl-search-input').trigger('focus')
125    })
126
127})( jQuery );
128
129var changemakers = document.querySelectorAll('.gffw-featured-changemakers');
130
131changemakers?.forEach(function(changemaker) {
132  // Turned back on for now
133	// changemaker.closest('div.fl-row').style.display = 'none';
134});

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.