PageSourceSearch

https://www.visionofhumanity.org/wp-content/themes/voh/assets/js/custom.js?ver=1743145920

js visionofhumanity.org collected 2026-09-24 08:28:40 UTC 3,596 bytes, 122 lines download raw bytes

1(function ($) {
2
3    // Handle navbar close
4    function handleNavbarCollapse() {
5        if ($(window).innerWidth() <= 991) {
6            $('.header-top-search').prependTo('.navbar-collapse');
7        }
8
9        if ($(window).innerWidth() < 630) {
10            $('.header-top-subscribe').appendTo('.navbar-collapse');
11        }
12    }
13
14    function responsiveMenuToggle() {
15        $('.hamburger-icon').on('click', function(e) {
16            e.preventDefault();
17            $(this).toggleClass('close-icon');
18            $('body').toggleClass('body-fix');
19            $('.header-bottom').toggleClass('nav-open');
20            $('.header-search').removeClass('search-open');
21        })
22    }
23
24    function searchBoxToggle() {
25        $('.search-btn').on('click', function(e) {
26            e.preventDefault();
27            $(this).find('span').hide();
28            $('#searchBox').addClass('show-search');
29        });
30    }
31
32
33    function initMatchHeights() {
34        $('.banner-equal').matchHeight();
35        $('.form-equal').matchHeight();
36        $('.news-title').matchHeight();
37    }
38
39    function eventSliderLeft() {
40        $('.events-slider-left').slick({
41            slidesToShow: 1,
42            slidesToScroll: 1,
43            arrows: false,
44            fade: true,
45            autoplay: true,
46            asNavFor: '.events-slider-right-content'
47        });
48    }
49
50    function eventSliderRight() {
51        $('.events-slider-right-content').slick({
52            slidesToShow: 1,
53            slidesToScroll: 1,
54            asNavFor: '.events-slider-left',
55            dots: true,
56            autoplay: true,
57            focusOnSelect: true,
58            arrows: false
59        });
60    }
61
62    /**
63     * Smooth scroll animation to anchor links.
64     */
65    function handleSmoothScrollAnchorLinks() {
66        $(document).on('click', 'a[href^="#"]', function(event) {
67            event.preventDefault();
68            var elm = $($.attr(this, 'href'));
69            if (elm.length) {
70                $('html, body').animate({
71                    scrollTop: elm.offset().top - 100
72                }, 500);
73            }
74        });
75    }
76
77    // Fix
78    function fixMeAtTheTop() {
79        var elm = $('.page-content-filter');
80        if (elm.length) {
81            var fixmeTop = elm.offset().top;
82            $(window).scroll(function() { // assign scroll event listener
83                var currentScroll = $(window).scrollTop(); // get current position
84                if (currentScroll >= fixmeTop) { // apply position: fixed if you
85                    $('.page-content-filter').css({ // scroll to that element or below it
86                        position: 'fixed',
87                        top: '0',
88                        left: '0',
89                        width: '100%'
90                    });
91                } else { // apply position: static
92                    $('.page-content-filter').css({ // if you scroll above it
93                        position: 'static'
94                    });
95                }
96            });
97        }
98    }
99
100    function hideEmptyParagraph() {
101        $('p').each(function() {
102            var $this = $(this);
103            if ($this.html().replace(/\s|&nbsp;/g, '').length == 0)
104                $this.remove();
105        });
106    }
107
108    // Run!
109    responsiveMenuToggle();
110    searchBoxToggle();
111    handleNavbarCollapse();
112    initMatchHeights();
113    handleSmoothScrollAnchorLinks();
114    fixMeAtTheTop();
115    eventSliderLeft();
116    eventSliderRight();
117    hideEmptyParagraph();
118
119    jQuery(window).resize(function() {
120        handleNavbarCollapse();
121    });
122})(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.