PageSourceSearch

https://citizensclimatelobby.org/common/scripts/sitewide.js?v=1.12

js citizensclimatelobby.org collected 2026-10-01 09:07:04 UTC 3,784 bytes, 120 lines download raw bytes

1function insertUrlParameters(url, paramString) {
2    if (url.includes('?')) {
3        spliturl = url.split('?');
4        url = spliturl[0] + '?' + paramString + '&' + spliturl[1];
5    }
6    else {
7        url += '?' + paramString;
8    }
9    return url;
10}
11
12function stripEndQuotes(s) {
13    var t = s.length;
14    if (s.charAt(0) == '"') s = s.substring(1, t--);
15    if (s.charAt(--t) == '"') s = s.substring(0, t);
16    return s;
17}
18
19function createLineBreaksFromParagraphs(jQueryObject) {
20    var returnText = "";
21    jQueryObject.each(function (index) {
22        returnText += jQuery(this).html();
23        if (index < jQueryObject.length - 1) {
24            returnText += "<br />";
25        }
26    });
27    return returnText;
28}
29
30function createText(parentObject, selectorString) {
31    textContainer = parentObject.find(selectorString);
32    if (textContainer.hasClass("hidden")) {
33        returnText = "";
34    } else {
35        returnText = createLineBreaksFromParagraphs(textContainer.find("p"));
36    }
37    return returnText;
38}
39
40function getUrlVars() {
41    var vars = {};
42    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) {
43        vars[key] = value;
44    });
45    return vars;
46}
47
48function getUrlParam(parameter, defaultvalue) {
49    var urlparameter = defaultvalue;
50    if (window.location.href.indexOf(parameter + '=') > -1) {
51        urlparameter = getUrlVars()[parameter];
52    }
53    return urlparameter;
54}
55
56function setCookie(cname, cvalue, exdays) {
57    const d = new Date();
58    d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
59    let expires = "expires="+d.toUTCString();
60    document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
61}
62  
63function getCookie(cname) {
64    let name = cname + "=";
65    let ca = document.cookie.split(';');
66    for(let i = 0; i < ca.length; i++) {
67        let c = ca[i];
68        while (c.charAt(0) == ' ') {
69            c = c.substring(1);
70        }
71        if (c.indexOf(name) == 0) {
72            return c.substring(name.length, c.length);
73        }
74    }
75    return "";
76}
77
78function fixSmoothScrollLinks() {
79
80    jQuery('a.smooth-scroll-link').off('click');
81    console.log('reassigning click events');
82    jQuery('a.smooth-scroll-link').on('click', function(e) {
83                    
84        var linkHref = jQuery(this).attr('href');
85                        
86        if (linkHref.indexOf('#') === 0) {
87            var spacerHeight = jQuery(linkHref).height(),
88                headerHeight = 0;
89                
90            if (jQuery('.sticky-header').length > 0) {
91                headerHeight = jQuery('.sticky-header').height();
92            }
93            if (jQuery('#wpadminbar').length > 0) {
94                headerHeight = headerHeight + 28;
95            }
96
97            var stickyMenuHeight = 0;
98            
99            if (jQuery('div.sticky-menu-mobile').not(':hidden').length > 0) {
100                console.log('adding stickyMenuMobileHeight');
101                stickyMenuHeight = stickyMenuHeight + jQuery('div.sticky-menu-mobile').outerHeight();
102                console.log(stickyMenuHeight);
103            } else if (jQuery('div.sticky-menu').not(':hidden').length > 0) {
104                console.log('adding stickyMenuHeight');
105                stickyMenuHeight = stickyMenuHeight + jQuery('div.sticky-menu').outerHeight();
106                console.log(stickyMenuHeight);
107            }
108            console.log(spacerHeight, headerHeight, stickyMenuHeight);
109            jQuery('html, body').stop().animate({
110                scrollTop: jQuery(linkHref).offset().top + spacerHeight - headerHeight - stickyMenuHeight - 10
111            }, 1000, 'easeInOutExpo');
112            
113            e.preventDefault();
114            
115        } else {
116            return e;
117        }
118        
119    });  
120}

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.