(function () { function customGetCookie(name) { const match = document.cookie.match( "(^|;) ?" + name + "=([^;]*)(;|$)" ); return match ? match[2] : null; } function customSetCookie(name, value, domain, days) { let cookie = name + "=" + value + ";domain=" + domain + ";path=/;"; if (days) { const date = new Date(); date.setTime(date.getTime() + 24 * 60 * 60 * 1000 * days); cookie += "expires=" + date.toGMTString(); + ";"; } document.cookie = cookie; } function acceptCookies() { customSetCookie("olx-cookies-accept", "1", '.olx.com.br'); const cookieNoticeContainer = document.getElementById( "cookie-notice-container" ); cookieNoticeContainer.style.opacity = "0"; cookieNoticeContainer.style.transform = "translate(0, 100%)"; setTimeout(() => cookieNoticeContainer.remove(), 300); }; function getCookieNoticeStyle() { return ` .cookie-notice-container { display: flex; flex-direction: row; align-items: center; -webkit-font-smoothing: antialiased; justify-content: center; left: 0; } @keyframes cookie-notice-fade-up { 0% { opacity: 0; transform: translate(0, 100%); } 100% { opacity: 1; transform: none; } } .cookie-notice-box { display: flex; align-items: flex-start; justify-content: center; z-index: 10000000; position: fixed; align-items: center; opacity: 1; border-radius: 8px; font-size: 14px; font-family: 'Nunito Sans', 'lato', 'sans-serif', 'Arial', 'Helvetica Neue', 'HelveticaNeue', 'Helvetica'; font-weight: 400; animation-name: cookie-notice-fade-up; animation-duration: 0.5s; flex-direction: row; bottom: 24px; height: 64px; width: 85vw; padding: 0 24px 0 24px; } .cookie-notice-box-olx { background-color: #4A4A4A; } .cookie-notice-disclaimer { display: flex; flex-direction: row; align-items: center; justify-content: center; margin-right: 16px; vertical-align: middle; color: #ffffff; } .cookie-notice-parag { margin: 0; font-family: 'Nunito Sans', 'lato', 'sans-serif', 'Arial', 'Helvetica Neue', 'HelveticaNeue', 'Helvetica'; font-style: normal; font-weight: 400; font-size: 14px; line-height: 20px; } .cookie-notice-link { color: #ffffff; } .cookie-notice-link:hover { color: #ffffff; } .cookie-notice-ok-button { display: flex; flex-direction: row; align-items: center; justify-content: center; height: 32px; min-width: 100px; color: #ffffff; border-radius: 100px; font-family: 'Nunito Sans', 'lato', 'sans-serif', 'Arial', 'Helvetica Neue', 'HelveticaNeue', 'Helvetica'; font-style: normal; font-weight: 600; font-size: 14px; line-height: 20px; border: 1px solid transparent; flex: none; order: 0; align-self: center; flex-grow: 0; cursor: pointer; } .cookie-notice-ok-button-olx { background-color: #F28000; } .cookie-notice-ok-button-olx:hover { background-color: #F99D21; } @media all and (max-width: 768px) { .cookie-notice-box { flex-direction: column; height: auto; bottom: 76px; margin: 0 auto; padding: 16px 24px 16px 24px; -webkit-backface-visibility: hidden; backface-visibility: hidden; } .cookie-notice-ok-button { flex: 1; width: -moz-available; width: -webkit-fill-available; width: fill-available; margin: 16px 0 0 0; } .cookie-notice-disclaimer { margin-right: 0px; } }`; } if (navigator.userAgent.match(/OLX-Source/)) { return; } const acceptedCookies = customGetCookie("olx-cookies-accept") || false; if (acceptedCookies) { return; } const head = document.getElementsByTagName('HEAD')[0]; // Create new style element const style = document.createElement('style'); // Append link element to HTML head head.appendChild(style); style.appendChild(document.createTextNode(getCookieNoticeStyle())); function createCustomHTMLFragment(htmlStr) { const fragment = document.createDocumentFragment(); const auxiliarElement = document.createElement("div"); auxiliarElement.innerHTML = htmlStr; while (auxiliarElement.firstChild) { fragment.appendChild(auxiliarElement.firstChild); } return fragment; } const fragment = createCustomHTMLFragment( `` ); const container = document.getElementById("cookie-notice-container"); if (container) { return; } document.body.appendChild(fragment); const cookieButton = document.getElementById("cookie-notice-ok-button"); const cookieBox = document.getElementById("cookie-notice-box"); cookieButton.onclick = acceptCookies; cookieButton.classList.add("cookie-notice-ok-button"); cookieButton.classList.add("cookie-notice-ok-button-olx"); cookieBox.classList.add("cookie-notice-box"); cookieBox.classList.add("cookie-notice-box-olx"); })();