PageSourceSearch

https://www.nlsm.ca/wp-content/themes/NextLevel/assets/js/script.js?ver=1677540256

js nlsm.ca collected 2026-10-10 00:23:47 UTC 4,008 bytes, 114 lines download raw bytes

1(function($) {
2    const initSemiStickyHeader = function(header, content) {
3        let last_scroll_top = 0,
4            tmp;
5        const offset = header.clientHeight;
6        const _processSemiStickyHeader = function() {
7            tmp = window.pageYOffset;
8            if(tmp < offset) {
9                header.classList.remove('sticky');
10                header.classList.remove('actv');
11            }
12            else {
13                header.classList.add('sticky');
14                if(tmp > last_scroll_top) header.classList.remove('actv');
15                else header.classList.add('actv');
16            }
17
18            last_scroll_top = tmp;
19        };
20        const _setSiteContentTopMargin = function() {
21            content.style.marginTop = header.clientHeight + 'px';
22        };
23
24        window.addEventListener('scroll', _processSemiStickyHeader);
25        window.addEventListener('resize', _processSemiStickyHeader);
26        window.addEventListener('resize', _setSiteContentTopMargin);
27        _processSemiStickyHeader();
28        _setSiteContentTopMargin();
29    };
30
31    const initSiteMenu = function() {
32        const nav = document.getElementById('mobile-nav');
33        if(!nav) return false;
34
35        $('.hamburger').click(function(e) {
36            document.body.classList.toggle('mm-opened');
37            e.currentTarget.classList.toggle('actv');
38        });
39
40        $('.mobile-menu .menu-item-has-children').click(function(e) {
41            e.currentTarget.classList.toggle('actv');
42        });
43
44        const header_menu = document.getElementById('header-menu');
45        if(header_menu) {
46            const clone = header_menu.cloneNode(true);
47            clone.id = 'mobile-header-menu';
48            nav.insertAdjacentElement('beforeend', clone);
49        }
50
51        const sm = document.querySelector('.site-footer .sm');
52        if(sm) {
53            nav.insertAdjacentElement('beforeend', sm.cloneNode(true));
54        }
55    };
56
57    const initSiteSearchForm = function() {
58        const form = document.querySelector('.site-search');
59        if(!form) return false;
60
61        const inp = form.querySelector('input');
62        form.querySelector('.toggle').onclick = function(e) {
63            form.classList.toggle('actv');
64            if(form.classList.contains('actv')) inp.focus();
65            else inp.blur();
66        };
67    };
68
69    const initBanner = function(site_header) {
70        const banner = document.querySelector('.sec-banner .full-width-slide-item');
71        if(!banner) return false;
72
73        let frame;
74        const _fixFullHeightBanner = function() {
75            if(frame) window.cancelAnimationFrame(frame);
76            window.requestAnimationFrame(function() {
77                document.documentElement.style.setProperty('--site_header_height', site_header.clientHeight + 'px');
78            });
79        };
80        window.addEventListener('resize', _fixFullHeightBanner);
81        _fixFullHeightBanner();
82    };
83
84    const initBlog = function() {
85        const images = document.querySelectorAll('.sec-post-cnt.type-post img');
86        if(!images.length) return false;
87
88        Array.prototype.forEach.call(images, function(el) {
89            const link = document.createElement('a');
90            link.href = el.src.replace(/^(.+?)(-\d+x\d+)(\..+)$/, '$1$3');
91            link.dataset.lightbox = 'gallery';
92            el.parentElement.insertBefore(link, el);
93            link.appendChild(el);
94        });
95    };
96
97	$(document).ready(function() {
98	    const site_header = document.getElementById('site-header'),
99	        site_content = document.getElementById('site-page');
100        initSemiStickyHeader(site_header, site_content);
101        initSiteMenu();
102	    initSiteSearchForm();
103        initBanner(site_header);
104        initBlog();
105
106        $('.manual-items h3').click(function(){
107            if ($(this).hasClass("actv")) {
108                $(this).removeClass('actv');
109            }else {
110                $(this).addClass('actv');
111            }
112        });
113	});
114})(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.