PageSourceSearch

https://clairac.com/wp-content/themes/template_old_sun/js/sun.js

js clairac.com collected 2026-09-25 06:47:13 UTC 5,050 bytes, 152 lines download raw bytes

1jQuery(document).ready(($) => {
2    const width = $(window).width();
3    const banner = $('#alert-banner');
4
5    let scrollState = 'top';
6    let menuState = 'closed';
7    let menuWidth = $('#quartuary-menu').width() * - 1;
8    let negativealertHeight = banner.outerHeight() * - 1;
9    const logoSizeScrolled = '170px';
10    const logoSizeUnScrolled = '130px';
11
12
13    const create_cookie = (name, value, days) => {
14        const curr_date = new Date();
15        curr_date.setTime(curr_date.getTime() + (days * 86400000)); //86400000 = 1 jour en millisecondes
16        let expires = "expires=" + curr_date;
17        document.cookie = name + "=" + value + ";" + expires + ";path=/;SameSite=Lax";
18    }
19
20    const get_cookie = (c_name) => {
21        let name = c_name + "=";
22        let decodedCookie = decodeURIComponent(document.cookie);
23        let cookie_fragment = decodedCookie.split(';');
24
25        for (let i = 0; i < cookie_fragment.length; i++) {
26            let cookie = cookie_fragment[i];
27
28            while (cookie.charAt(0) == ' ') {
29                cookie = cookie.substring(1);
30            }
31            if (cookie.indexOf(name) == 0) {
32                return cookie.substring(name.length, cookie.length);
33            }
34        }
35        return '';
36    }
37
38    if (get_cookie('is_alert_hidden')) {
39        banner.css('display', 'none');
40    }
41
42    [...$('.menu-item-has-children > a')].forEach((e) => {
43        try {
44            e.removeAttribute('href');
45        } catch (e) {}
46    });
47
48    $(window).scroll(() => {
49        let scrollPos = $(window).scrollTop();
50        if (scrollPos !== 0 && scrollState === 'top' && width > 1024) {
51
52            if (scrollPos <= $(window).height() / 2) {
53                $('.main-navigation').addClass('shadow');
54            }
55
56            if ($('body').hasClass('home')) {
57                $('.site-branding > a').animate({
58                    'width': logoSizeUnScrolled,
59                    'height': logoSizeUnScrolled,
60                    // 'margin-top': '5px'
61                });
62            } else {
63                $('.site-branding > a').animate({
64                    'width': logoSizeUnScrolled,
65                    'height': logoSizeUnScrolled,
66                    // 'margin-top': '0.1em'
67                });
68            }
69            scrollState = 'scrolled';
70        } else if (scrollPos === 0 && scrollState === 'scrolled' && width > 1024) {
71
72            if (scrollPos >= $(window).height() / 2) {
73                $('.main-navigation').addClass('shadow');
74            }
75
76            //position de base
77            $('.main-navigation').removeClass('shadow');
78            if ($('body').hasClass('home')) {
79                $('.site-branding > a').animate({
80                    'width': logoSizeScrolled,
81                    'height': logoSizeScrolled,
82                    // 'margin-top': '1.5em'
83                });
84            } else {
85                $('.site-branding > a').animate({
86                    'width': logoSizeScrolled,
87                    'height': logoSizeScrolled,
88                    // 'margin-top': '1.5em'
89                });
90            }
91            scrollState = 'top';                
92        } 
93    });
94
95    [...$('img, iframe, canvas, svg, link, object, script, video, embed')].forEach((e) => {
96        try {
97            e.removeAttr('onerror onload');
98        } catch(e) {}
99    });
100    
101    const cat = [...$('.wsp-category-title a')];
102    cat.forEach(e => {
103        if (e.innerText === 'Uncategorized') {
104            e.remove();
105        }
106    });
107
108    if (width < 800) {
109        [...$('#primary-menu li.menu-item-has-children')].forEach(e => {
110            e.children[0].classList.add('chevron');
111            e.children[0].removeAttribute('href');
112            e.children[0].addEventListener("click", () => {
113                $("#"+e.id+" > ul.sub-menu ").toggleClass('collapse');
114                $("#"+e.id+" > a").toggleClass("rotate");
115                return;
116            });
117        });
118    }
119
120    $(window).load(() => {
121        
122        if (width < 500) {
123            $('.menu-acces-rapide-container').click(() => {
124                // $('#quartuary-menu').toggle('block');
125                if (menuState === 'closed') {
126                    $('#quartuary-menu').animate({
127                        'right': '0',
128                    }, () => {
129                        menuState = 'open';
130                    });
131                } else if (menuState === 'open') {
132                    $('#quartuary-menu').animate({
133                        'right': menuWidth,
134                    }, () => {
135                        menuState = 'closed';
136                    }); 
137                }
138            });
139        }
140
141        if (!get_cookie('is_alert_hidden')) {
142            $('#alert-banner:not(#alert-banner *)').click(() => {
143                create_cookie('is_alert_hidden', true, 1);
144                banner.animate({
145                    'margin-bottom': negativealertHeight - 20,
146                });
147            });
148        }
149
150        // console.log($.fn.jquery);
151    });
152});

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.