PageSourceSearch

https://livrecommelair.fr/resources/js/lowvisionbutton.js

js livrecommelair.fr collected 2026-10-07 16:39:20 UTC 3,992 bytes, 107 lines download raw bytes

1$(document).ready(function () {
2
3    let lowVisionLi = $('#low-vision-cookie');
4
5    function checkOrangeConfortPlusConsent() {
6        var uci42Cookie = getCookie("UCI42");
7        var uciBlCookie = getCookie("uci-bl");
8        if (uci42Cookie !== null || uciBlCookie !== null) {
9            return true;
10        } else {
11            return false;
12        }
13    }
14
15    function addLowVisionButton() {
16        var lowVisionLi = $('<li id="low-vision-cookie"></li>');
17
18        var lowVisionLink = $('<a href="#" class="far fa fa-eye-slash low-vision-button" id="uci_link"></a>');
19        lowVisionLink.append('<span></span>');
20
21        lowVisionLink.on('click', function (event) {
22            event.preventDefault();
23            clickLowVision();
24        });
25
26        lowVisionLi.append(lowVisionLink);
27
28        if ($(window).width() > 768 && $(window).width() < 1200) {
29            $('.catalog-navigation.desktop .catalog-navigation-top ul.navbar-right > li:first-child').after(lowVisionLi);
30        } else if ($(window).width() > 1200) {
31            $('.catalog-navigation.desktop #searchbar ul.navbar-right > li:first-child').after(lowVisionLi);
32        }
33    }
34
35    function removeLowVisionButton() {
36        $('#low-vision-cookie').remove();
37    }
38
39    function clickLowVision() {
40        let MutationObserver = window.MutationObserver ,
41            eventListenerSupported = window.addEventListener;
42        const clickEvent = new MouseEvent('click', {
43            bubbles: true,
44            cancelable: true,
45            view: window
46        });
47        let isConsent = checkOrangeConfortPlusConsent();
48        if (!isConsent) {
49            tarteaucitron.userInterface.openPanel();
50            const modal = $('#tarteaucitron')[0];
51            const toolBarOrangeConfort = $('#cdu_toolbar')[0]
52            if (modal) {
53                let obs = new MutationObserver(function(mutations, observer){
54                    mutations.forEach((mutation) => {
55                        if (mutation.type === 'attributes' && mutation.attributeName === 'style') {
56                            const displayStyle = window.getComputedStyle(modal).display;
57
58                            if (displayStyle === 'none') {
59                                isConsent = checkOrangeConfortPlusConsent();
60                                if (isConsent) {
61                                    const buttonOrangeConfort = $('#uci_link')[0];
62                                    if (buttonOrangeConfort) {
63                                        buttonOrangeConfort.click();
64                                    }
65                                }
66                                observer.disconnect();
67                            }
68                        }
69                    });
70                });
71
72                obs.observe(modal, { attributes: true, attributeFilter: ['style'],  childList: true,
73                    subtree: true });
74
75            }
76        }
77    }
78
79        function checkCookieChanges() {
80            var currentUci42Cookie = getCookie("UCI42");
81            var currentUciBlCookie = getCookie("uci-bl");
82            if (currentUci42Cookie != null || currentUciBlCookie != null) {
83                removeLowVisionButton();
84            }
85        }
86
87
88        if (checkOrangeConfortPlusConsent() === false) {
89            if (lowVisionLi.length === 0) {
90                addLowVisionButton();
91            }
92
93            $(window).resize(function () {
94                if (lowVisionLi) {
95                    if ($(window).width() > 768 && $(window).width() < 1200) {
96                        $('.catalog-navigation.desktop .catalog-navigation-top ul.navbar-right > li:first-child').after(lowVisionLi);
97                    } else if ($(window).width() > 1200) {
98                        $('.catalog-navigation.desktop #searchbar ul.navbar-right > li:first-child').after(lowVisionLi);
99                    }
100                }
101
102            });
103        }
104
105        setInterval(checkCookieChanges, 1000);
106
107    });

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.