/* Copyright 2014 Google Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ (function(window) { if (!!window.cookieChoices) return window.cookieChoices; var document = window.document; var cookieChoices = (function() { var cookieConsentId = 'cookie-bar-2026'; function _createHeaderElement(cookieText, buttonText) { var cookieConsentElement = document.createElement('div'); cookieConsentElement.id = cookieConsentId; // Barre flottante cookieConsentElement.style.position = 'fixed'; cookieConsentElement.style.top = '25px'; cookieConsentElement.style.left = '20px'; cookieConsentElement.style.right = '20px'; cookieConsentElement.style.backgroundColor = '#FDF2DC'; cookieConsentElement.style.color = '#000000'; cookieConsentElement.style.padding = '8px 15px'; cookieConsentElement.style.borderRadius = '8px'; cookieConsentElement.style.boxShadow = '0 6px 20px rgba(0,0,0,0.2)'; cookieConsentElement.style.fontFamily = '-apple-system, BlinkMacSystemFont, sans-serif'; cookieConsentElement.style.fontSize = '14px'; cookieConsentElement.style.lineHeight = '1.4'; cookieConsentElement.style.display = 'flex'; cookieConsentElement.style.justifyContent = 'center'; cookieConsentElement.style.alignItems = 'center'; cookieConsentElement.style.zIndex = '10001'; cookieConsentElement.style.opacity = '0'; cookieConsentElement.style.transform = 'translateY(-20px)'; cookieConsentElement.style.transition = 'opacity 0.3s ease, transform 0.3s ease'; // Texte centré var textSpan = document.createElement('span'); textSpan.textContent = cookieText; textSpan.style.flex = '1'; textSpan.style.textAlign = 'center'; cookieConsentElement.appendChild(textSpan); // Bouton OK // Bouton OK en texte simple var okButton = document.createElement('span'); okButton.textContent = buttonText; okButton.style.marginLeft = '10px'; okButton.style.color = '#000000'; // même couleur que le texte okButton.style.fontWeight = 'bold'; okButton.style.fontSize = '15px'; okButton.style.cursor = 'pointer'; okButton.style.flex = '0 0 auto'; okButton.style.textDecoration = 'no'; // optionnel, pour indiquer que c'est cliquable okButton.onclick = function() { cookieConsentElement.remove(); clearTimeout(autoHide); // annule la disparition automatique si click }; cookieConsentElement.appendChild(okButton); // Disparition automatique après 5 secondes var autoHide = setTimeout(function(){ cookieConsentElement.style.opacity = '0'; cookieConsentElement.style.transform = 'translateY(-20px)'; setTimeout(function(){ cookieConsentElement.remove(); }, 300); }, 10000); // ← temps en ms return cookieConsentElement; } function _showCookieConsent(cookieText, buttonText) { var oldBar = document.getElementById(cookieConsentId); if(oldBar) oldBar.remove(); var bar = _createHeaderElement(cookieText, buttonText); document.body.appendChild(bar); function showBar() { bar.style.opacity = '1'; bar.style.transform = 'translateY(0)'; window.removeEventListener('scroll', showBar); } window.addEventListener('scroll', showBar); } var exports = {}; exports.showCookieConsentBar = _showCookieConsent; return exports; })(); window.cookieChoices = cookieChoices; })(this);