| 
					
				 | 
			
			
				@@ -6,22 +6,6 @@ class setMarginTexts extends Paged.Handler { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     afterPreview(pages) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // afficher correctement les éléments en marge 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let topLeftBoxes = document.querySelectorAll('.pagedjs_margin-left-top'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        for (let topLeftBox of topLeftBoxes) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            let contentDiv = topLeftBox.firstElementChild; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            contentDiv.append('Texte marge'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            contentDiv.style.marginTop = contentDiv.offsetWidth / 2 - contentDiv.offsetHeight / 2 + "px"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let bottomLeftBoxes = document.querySelectorAll('.pagedjs_margin-left-bottom'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        for (let bottomLeftBox of bottomLeftBoxes) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            let contentDiv = bottomLeftBox.firstElementChild; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            contentDiv.append('Texte marge'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            contentDiv.style.marginBottom = contentDiv.offsetWidth / 2 - contentDiv.offsetHeight / 2 + "px"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // cleaner pour que les paragraphes tombent sur la marge haute 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for(let i = 0; i < labeurs.length; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (labeurs[i] == labeurs[i].parentNode.firstElementChild 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -132,9 +116,21 @@ class setMarginTexts extends Paged.Handler { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 plainColor.style.top = "-22mm"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 encarts[i].parentNode.prepend(plainColor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (encarts[i].previousElementSibling === null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                encarts[i].style.marginTop = '0'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (encarts[i].hasAttribute('data-split-original')) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    encarts[i].parentElement.style.height = '214mm'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    encarts[i].style.paddingBottom = '0 !important'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    encarts[i].style.height = "100%"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    encarts[i].nextElementSibling.style.height = '22mm'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    encarts[i].nextElementSibling.style.bottom = '-22mm'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    encarts[i].nextElementSibling.style.right = '-28.5mm'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // TITRES 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // TITRES ATELIERS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let h3s = document.querySelectorAll('h3'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (let h3 of h3s) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (h3.nextSibling?.firstChild.tagName == "IMG") { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -175,14 +171,159 @@ class setMarginTexts extends Paged.Handler { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             h3.closest('.pagedjs_pagebox').querySelector('.pagedjs_margin-left').innerHTML = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            h3.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            .classList.add('atelier_cover_page'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let h4s = document.querySelectorAll('h4'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        for (let h4 of h4s) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (h4.nextElementSibling?.classList.contains('bibliographie')) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                h4.style.color = "#d98a29"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // SET COLORS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let colors = [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            '#5595a1', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            '#5f9796', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            '#65998d', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            '#6f9b80', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            '#799e75', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            '#83a16b', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            '#8ba460', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            '#95a358', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            '#9ca151', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            '#a59d4a', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            '#af9944', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            '#b8963d', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            '#b8963d', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            '#b8963d' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // TITRES PARTIES 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let h2s = document.querySelectorAll('h2'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (let i = 0; i < h2s.length; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (i != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let parentSheet = h2s[i].parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                parentSheet.style.backgroundColor = colors[i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                parentSheet.querySelector('.pagedjs_margin-left').innerHTML = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                parentSheet.parentElement.classList.add('partie_cover_page'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let nextPage = parentSheet.parentElement.nextElementSibling?.firstElementChild; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (nextPage) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    nextPage.style.backgroundColor = colors[i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let partieCount = document.createElement('div'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                partieCount.classList.add('partie_count'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let romanCount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                switch (i) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    case 1 : romanCount = 'I'; break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    case 2 : romanCount = 'II'; break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    case 3 : romanCount = 'III'; break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    case 4 : romanCount = 'IV'; break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    case 5 : romanCount = 'V'; break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    case 6 : romanCount = 'VI'; break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    case 7 : romanCount = 'VII'; break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    case 8 : romanCount = 'VIII'; break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    case 9 : romanCount = 'IX'; break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    case 10 : romanCount = 'X'; break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                partieCount.innerHTML = 'Partie<br>' + romanCount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                h2s[i].parentElement.prepend(partieCount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                h2s[i].nextElementSibling?.remove(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                h2s[i].parentElement.parentElement.parentElement.parentElement.style.display = 'flex'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                h2s[i].parentElement.parentElement.parentElement.parentElement.style.alignItems = 'center'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // afficher correctement les éléments en marge 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let topLeftBoxes = document.querySelectorAll('.pagedjs_margin-left-top'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (let topLeftBox of topLeftBoxes) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let contentDiv = topLeftBox.firstElementChild; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let textToPut; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let currentPage = contentDiv.parentElement.parentElement.parentElement.parentElement.parentElement; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(currentPage.id != "page-1") { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let previousPage = currentPage.previousElementSibling; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                while (previousPage) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (previousPage.classList.contains('atelier_cover_page')) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        textToPut = previousPage.querySelector('h3').innerText; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    previousPage = previousPage.previousElementSibling; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            contentDiv.append(textToPut); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            contentDiv.style.marginTop = contentDiv.offsetWidth / 2 - contentDiv.offsetHeight / 2 + "px"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let bottomLeftBoxes = document.querySelectorAll('.pagedjs_margin-left-bottom'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (let bottomLeftBox of bottomLeftBoxes) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let contentDiv = bottomLeftBox.firstElementChild; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let textToPut; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let currentPage = contentDiv.parentElement.parentElement.parentElement.parentElement.parentElement; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(currentPage.id != "page-1") { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let previousPage = currentPage.previousElementSibling; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                while (previousPage) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (previousPage.classList.contains('partie_cover_page')) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        textToPut = previousPage.querySelector('h2').innerText; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    previousPage = previousPage.previousElementSibling; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            contentDiv.append(textToPut); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            contentDiv.style.marginBottom = contentDiv.offsetWidth / 2 - contentDiv.offsetHeight / 2 + "px"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // set all colors 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let allPages = document.querySelectorAll('.pagedjs_page'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let partieColor = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let bgColor = 'rgb(250, 250, 250)'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (let page of allPages) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (page.classList.contains('partie_cover_page')) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                partieColor = page.firstElementChild.style.backgroundColor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let pageCounter = page.querySelector('.pagedjs_margin-left-middle') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (pageCounter) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                pageCounter.style.color = partieColor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let atelierTitle = page.querySelector('h3'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (atelierTitle) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                atelierTitle.style.color = partieColor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let bibliographie = page.querySelector('.bibliographie'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (bibliographie) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                bibliographie.style.color = partieColor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // set bg et sprays 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let bibliographiePage = bibliographie.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                bibliographiePage.style.backgroundColor = bgColor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                bibliographiePage.parentElement.nextElementSibling.firstElementChild.style.backgroundColor = bgColor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let sprayImg = document.createElement('img'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                sprayImg.setAttribute('src', '/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page001.png'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                sprayImg.style.height = "242mm"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                sprayImg.style.width = "60mm"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                sprayImg.style.position = "absolute"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                sprayImg.style.top = "-22mm"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                sprayImg.style.right = "-20mm"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                sprayImg.style.mixBlendMode = "multiply"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                bibliographiePage.parentElement.nextElementSibling.querySelector('.pagedjs_page_content').prepend(sprayImg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let h4 = page.querySelector('h4'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (h4 && h4?.nextElementSibling?.classList.contains('bibliographie')) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                h4.style.color = partieColor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let links = page.querySelectorAll('a'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (let link of links) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                link.style.color = partieColor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let lightColor = partieColor.slice(0, -1) + ', 0.1)'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let encarts = page.querySelectorAll('.lampe, .latour, .encart-split'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (let encart of encarts) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                encart.style.backgroundColor = lightColor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // all links open in a new tab 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let links = document.querySelectorAll('a'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (let link of links) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            link.setAttribute('target', '_blank'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // loading 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         document.querySelector('body').style.opacity = "1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         document.querySelector('body').style.overflow = "scroll"; 
			 |