import domReady from '@roots/sage/client/dom-ready'; import { customSearch } from './front/search.js'; import { customTimeline } from './front/timeline.js'; /** * Application entrypoint */ domReady(async () => { window.addEventListener('load', function() { setTimeout(function() { window.scrollTo(0, 0); }, 0); }); window.addEventListener('resize', function() { setTimeout(function() { window.scrollTo(0, 0); let editButtons = document.querySelectorAll(".edit-button"); for (let editButton of editButtons) { let editContainer = editButton.parentElement; editContainer.style.height = `${editContainer.previousElementSibling.offsetHeight}px`; } }, 0); }); // POUR LES LIENS D'EDITION/CONNEXION QUAND ON EST PAS CONNECTÉS let connectLinks = document.querySelectorAll('a.xoo-el-login-tgr'); for (let connectLink of connectLinks) { if (connectLink.previousElementSibling) { let penImg = connectLink.previousElementSibling; connectLink.classList.add('edit-button'); connectLink.innerText = ''; connectLink.append(penImg); } } // CLEANER LE TABLEAU let minHeadTh = document.querySelector("#main table thead tr th:first-of-type"); minHeadTh.style.width = `${100 / 8}%`; let otherHeadThs = document.querySelectorAll("#main table thead tr th:not(:first-of-type)"); for (let otherHeadTh of otherHeadThs) { otherHeadTh.style.width = `${100 / 8 * 1.75}%`; } let minTableTds = document.querySelectorAll("#main table tbody tr td:first-of-type"); for (let minTableTd of minTableTds) { if (minTableTd.parentNode.childElementCount != 1) { minTableTd.style.width = `${100 / 8}%`; } } let otherTableTds = document.querySelectorAll("#main table tbody tr td:not(:first-of-type)"); for (let otherTableTd of otherTableTds) { otherTableTd.style.width = `${100 / 8 * 1.75}%`; } let editButtons = document.querySelectorAll(".edit-button"); for (let editButton of editButtons) { let editContainer = editButton.parentElement; editContainer.style.height = `${editContainer.previousElementSibling.offsetHeight}px`; } // HEADER AU SCROLL let tableHead = document.querySelector("thead tr"); let tHeadHeight = tableHead.offsetHeight; tableHead.style.maxHeight = `${tHeadHeight}px`; let headerHeight = document.querySelector("header").offsetHeight; let titleLarge = document.querySelector('.brand span:nth-of-type(2)'); let titlesSmall = document.querySelectorAll('.brand span:not(.brand span:nth-of-type(2))'); let titleContainer = document.querySelector('.brand'); window.onscroll = () => { tableHead.style.minHeight = `${headerHeight + 72}px`; let scroll = window.scrollY; let headerNewHeight = tHeadHeight - scroll; if (headerNewHeight > 72) { tableHead.style.height = `${headerHeight + headerNewHeight}px`; titleContainer.style.lineHeight = "1.75rem"; titleLarge.style.fontSize = '35px'; for (let titleSmall of titlesSmall) { titleSmall.style.fontSize = '25px'; } } else { tableHead.style.height = tableHead.style.minHeight; titleContainer.style.lineHeight = "1.4rem"; titleLarge.style.fontSize = '24px'; for (let titleSmall of titlesSmall) { titleSmall.style.fontSize = '17px'; } } } // C'EST LA POUR LES PRIVACY POLICY // texte d'explication du login popup // et privacy policy let loginPopupText = document.getElementById('content_login_popup'); let privacyText = document.getElementById('content_privacy').innerHTML; loginPopupText = loginPopupText.innerHTML; let loginPopupTextWrapper = document.getElementsByClassName('xoo-el-sidebar'); if (loginPopupTextWrapper[0]) { loginPopupTextWrapper[0].innerHTML = `