// set all the relative to parts colors if (debug) console.log('start colors'); (function() { const colors = [ '#5595a1', '#5f9796', '#65998d', '#6f9b80', '#799e75', '#83a16b', '#8ba460', '#95a358', '#9ca151', '#a59d4a', '#af9944', '#b8963d', '#c19238', '#cb8e31', '#cb6f31', '#d86145' ]; const sprays = [ '/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page001.png', '/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page002.png', '/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page003.png', '/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page004.png', '/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page005.png', '/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page006.png', '/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page007.png', '/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page008.png', '/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page009.png', '/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page010.png', '/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page011.png', '/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page012.png', '/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page013.png', '/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page014.png', '/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page015.png', '/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page016.png' ]; let allPages = document.querySelectorAll('.pagedjs_page'); let atelierColor = ''; let bgColor = 'rgb(245, 245, 245)'; let atelierIndex = 0; for (let page of allPages) { if (page.firstElementChild.classList.contains('atelier_cover_page')) { atelierColor = colors[atelierIndex]; if (atelierColor == undefined) atelierColor = colors[colors.length]; atelierIndex++; } if (page.firstElementChild.classList.contains('partie_cover_page')) atelierIndex = 0; let pageCounter = page.querySelector('.pagedjs_margin-left-middle') if (pageCounter) pageCounter.style.color = atelierColor; let citations = page.querySelectorAll('.citation'); for (let citation of citations) { // dessiner et colorer les guillemets if (citation.innerText.charAt(0) === '“') citation.innerText = citation.innerText.substring(1); if (citation.innerText.charAt(citation.innerText.length - 1) === '”') { citation.innerText = citation.innerText.substring(0, citation.innerText.length - 1); } let guillemetOuvrant = document.createElement('div'); guillemetOuvrant.innerText = '“'; guillemetOuvrant.style.color = atelierColor; guillemetOuvrant.classList.add('guillement_ouvrant'); citation.prepend(guillemetOuvrant); let guillemetFermant = document.createElement('div'); guillemetFermant.innerText = '”'; guillemetFermant.style.color = atelierColor; guillemetFermant.classList.add('guillement_fermant'); citation.append(guillemetFermant); } let atelierTitle = page.querySelector('h3'); if (atelierTitle) atelierTitle.style.color = atelierColor; let bibliographie = page.querySelector('.bibliographie'); if (bibliographie) { bibliographie.style.color = atelierColor; // set bg et sprays let bibliographiePage = bibliographie.closest('.pagedjs_page'); bibliographiePage.style.backgroundColor = bgColor; if (bibliographiePage.classList.contains('pagedjs_left_page')) { let sprayImg = document.createElement('img'); sprayImg.setAttribute('src', sprays[atelierIndex - 1]); sprayImg.style.height = "242mm"; sprayImg.style.width = "60mm"; sprayImg.style.position = "absolute"; sprayImg.style.top = "-22mm"; sprayImg.style.right = "-20mm"; sprayImg.style.mixBlendMode = "multiply"; sprayImg.style.opacity = "0.75"; if (!bibliographiePage.nextElementSibling.querySelector('.bibliographie')) { bibliographiePage.nextElementSibling.style.backgroundColor = bgColor; } bibliographiePage.nextElementSibling.querySelector('.pagedjs_page_content').appendChild(sprayImg); } } let h4 = page.querySelector('h4'); if (h4 && h4?.nextElementSibling?.classList.contains('bibliographie')) { h4.style.color = atelierColor; } let serpentins = document.querySelectorAll('img[alt="serpentin"]'); for (let serpentin of serpentins) { let page = serpentin.closest('.pagedjs_page'); let nextPage = page.nextElementSibling; page.style.backgroundColor = "rgb(245, 245, 245)"; nextPage.style.backgroundColor = "rgb(245, 245, 245)"; } let links = page.querySelectorAll('a'); for (let link of links) { link.style.color = atelierColor; } let notesNumber = page.querySelectorAll('.note, .note_texte_number'); for (let note of notesNumber) { note.style.color = atelierColor; } if (atelierColor) { let lightColor = `${atelierColor}1a`; let encarts = page.querySelectorAll('.lampe, .latour, .lampe_nohead, .latour_nohead, .encart-split'); for (let encart of encarts) { encart.style.backgroundColor = lightColor; } } } })(); if (debug) console.log('end colors');