PageSourceSearch

https://templetonreligiontrust.org/wp-content/themes/templeton/js/homepage-2024.js?ver=1.0.11-1790920638

js templetonreligiontrust.org collected 2026-10-02 06:09:17 UTC 7,341 bytes, 219 lines download raw bytes

1window.otherGrantsRevealed = false;
2window.aofRevealed = false;
3
4window.aboutRevealed = false;
5window.typeTimer = null;
6window.typeCounter = 0;
7
8jQuery(document).ready(function() {
9    setupVideo();
10
11    window.setTimeout(function() {
12        jQuery('#home-banner-2024 .main-grant').css('opacity', 1.0);
13    }, 1000);
14
15    if (jQuery(window).scrollTop() < jQuery(window).height() < 50) {
16        jQuery('#home-banner-2024 .other-grants .grant').css('margin-top', jQuery('#home-banner-2024 .other-grants .image-panel').outerHeight() * 2);
17
18        window.setTimeout(function() {
19            if (!window.otherGrantsRevealed) {
20                revealOtherGrants();
21            }
22        }, 2500);
23    }
24    else {
25        window.otherGrantsRevealed = true;
26    }
27
28    window.setTimeout(function() {
29        revealFilterHeader();
30    }, 3000);
31
32    jQuery(window).on('scroll', function() {
33        scrollHomepage2024();
34    });
35    scrollHomepage2024();
36
37    jQuery(window).on('resize', function() {
38        resizeHomepage2024();
39    });
40    resizeHomepage2024();
41
42    jQuery('#areas-of-focus .carousel .slides').slick({
43        slidesToShow: 2,
44        slidesToScroll: 1,
45        arrows: false,
46    });
47
48    jQuery('#areas-of-focus .carousel .next-slide').on('click', function() {
49        jQuery('#areas-of-focus .carousel .slides').slick('slickNext');
50    });
51
52    jQuery('#areas-of-focus .carousel').on('afterChange', function(event, slick, currentSlide) {
53        jQuery(`#areas-of-focus .carousel .slide[slide-num != "${currentSlide}"]`).each(function() {
54            let slideEl = jQuery(this);
55            jQuery('.stretch-container', slideEl).removeClass('active');
56        });
57
58        jQuery(`#areas-of-focus .carousel .slide[slide-num="${currentSlide}"]`).each(function() {
59            let slideEl = jQuery(this);
60            jQuery('.stretch-container', slideEl).addClass('active');
61        });
62    });
63});
64
65function resizeHomepage2024() {
66    if (!window.otherGrantsRevealed) {
67        if (jQuery(window).width() < 1024) {
68            jQuery('#home-banner-2024 .other-grants').css('height', jQuery('#home-banner-2024 .other-grants .grant').outerHeight());
69        }
70        else {
71            jQuery('#home-banner-2024 .other-grants').css('height', jQuery('#home-banner-2024 .other-grants .image-panel').outerHeight());
72        }
73    }
74    else {
75        jQuery('#home-banner-2024 .other-grants').css('height', 'auto');
76    }
77
78    if (window.aboutRevealed) {
79        jQuery('#about .headline').css('height', 'auto');
80    }
81}
82
83function revealAreaOfFocus(el) {
84    jQuery(el).addClass('revealed');
85    jQuery('.color-panel', el).addClass('revealed');
86    window.setTimeout(function() {
87        jQuery('.bg-image-container', el).css({
88            'background-image': 'url(' + jQuery('.bg-image-container', el).attr('bg-image') + ')',
89            'opacity': 1.0
90        });
91        jQuery('.panel-content', el).css('opacity', 1.0);
92        jQuery('.panel', el).addClass('revealed');
93        jQuery('.panel-content .cutout', el).css('opacity', 1.0);
94    }, 400);
95}
96
97function revealAreasOfFocus(h, st) {
98    if (!window.aofRevealed) {
99        let aof = jQuery('#areas-of-focus');
100        if (st > aof.offset().top - h * 0.6 && st < aof.offset().top + aof.outerHeight() + h * 0.2) {
101            window.aofRevealed = true;
102            revealAreaOfFocus('#areas-of-focus .panels .panel:nth-child(1)');
103            window.setTimeout(function() {
104                revealAreaOfFocus('#areas-of-focus .panels .panel:nth-child(2)');
105                window.setTimeout(function() {
106                    revealAreaOfFocus('#areas-of-focus .panels .panel:nth-child(3)');
107                    window.setTimeout(function() {
108                        revealAreaOfFocus('#areas-of-focus .panels .panel:nth-child(4)');
109                    }, 250);
110                }, 250);
111            }, 250);
112        }
113    }
114}
115
116function revealFilterHeader() {
117    jQuery('.filter-header').css('opacity', 1.0);
118}
119
120function revealOtherGrant(num) {
121    jQuery('#home-banner-2024 .other-grants .grant:nth-child(' + num + ')').css('opacity', 1.0);
122    jQuery('#home-banner-2024 .other-grants .grant:nth-child(' + num + ')').css({
123        marginTop: 0,
124    });
125}
126
127function revealOtherGrants() {
128    window.otherGrantsRevealed = true;
129    revealOtherGrant(1);
130
131    window.setTimeout(function() {
132        revealOtherGrant(2);
133    }, 250);
134}
135
136function runAbout() {
137    window.typeTimer = window.setInterval(typeAbout, 25);
138}
139
140function scrollHomepage2024() {
141    let h = jQuery(window).height();
142    let st = jQuery(window).scrollTop();
143
144    if (!window.otherGrantsRevealed && st > h * 0.1) {
145        revealOtherGrants();
146    }
147
148    let fGrants = jQuery('#filtered-grants');
149
150    if (st > jQuery('.top', fGrants).offset().top - h * 0.75 && st < jQuery('.top', fGrants).offset().top + h * 0.5) {
151        jQuery('.top .grant .image-container', fGrants).addClass('revealed');
152        jQuery('.top .grant .info-container', fGrants).css('opacity', 1.0);
153    }
154
155    if (st > jQuery('.bottom', fGrants).offset().top - h * 0.75 && st < jQuery('.bottom', fGrants).offset().top + h * 0.5) {
156        jQuery('.bottom .grant .image-container', fGrants).addClass('revealed');
157        jQuery('.bottom .grant .info-container', fGrants).css('opacity', 1.0);
158    }
159
160    revealAreasOfFocus(h, st);
161
162    if (!window.aboutRevealed) {
163        let about = jQuery('#about');
164        if (st > about.offset().top - h * 0.8) {
165            window.aboutRevealed = true;
166            jQuery('.image-container', about).css({
167                margin: 0,
168                opacity: 1.0,
169            });
170            jQuery('.subheader', about).css('opacity', 1.0);
171            jQuery('.body', about).css('opacity', 1.0);
172            jQuery('button', about).css('opacity', 1.0);
173
174            jQuery('.headline', about).css('height', jQuery('.headline', about).css('height'));
175            jQuery('.headline .placeholder', about).hide();
176            runAbout();
177        }
178    }
179
180    if (jQuery(window).width() < 1200) {
181        if (jQuery(window).scrollTop() > jQuery('#areas-of-focus').offset().top - jQuery(window).height() * 0.5) {
182            jQuery(`#areas-of-focus .carousel .slide[slide-num="0"]`).each(function() {
183                jQuery('.stretch-container', this).addClass('active');
184            });
185        }
186    }
187    else {
188        if (jQuery(window).scrollTop() > jQuery('#areas-of-focus').offset().top - jQuery(window).height() * 0.25) {
189            animatePills('#areas-of-focus .panel .floating-pill', true);
190        }
191    }
192}
193
194function setupVideo() {
195    let banner = jQuery('#home-banner-2024.grants');
196    let video = jQuery('.video-loop', banner);
197
198    if (jQuery('source', video).length > 0) {
199        jQuery('.video-link', banner).on('mouseover', function() {
200            jQuery('.video-loop', banner).css('opacity', 1.0);
201            video[0].play();
202        });
203
204        jQuery('.video-link', banner).on('mouseout', function() {
205            jQuery('.video-loop', banner).css('opacity', 0);
206            video[0].pause();
207        });
208    }
209}
210
211function typeAbout() {
212    let text = jQuery('#about .headline').attr('text');
213
214    jQuery('#about .headline .typed').html(text.substring(0, window.typeCounter));
215
216    if (++window.typeCounter > text.length) {
217        clearInterval(window.typeTimer);
218    }
219}

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.