removing compilation folders

This commit is contained in:
Antoine M 2023-10-05 16:18:31 +02:00
parent eb7121513e
commit 4a8d8c7f7e
6 changed files with 3 additions and 6242 deletions

3
.gitignore vendored
View File

@ -5,3 +5,6 @@
*/.DS_Store */.DS_Store
Makefile Makefile
init_script.sh init_script.sh
/css
/js
./css

View File

@ -1,25 +0,0 @@
/* body {
background: red !important;
} */
#menu-posts {
border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
}
#menu-posts-conseils {
border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
}
#toplevel_page_theme-general-settings {
border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
}
/* .wp-block-post-content,
.is-root-container {
background-color: red !imporatant;
}
.block-editor-block-list__block {
background-color: yellow !imporatant; */
/* } */

File diff suppressed because it is too large Load Diff

View File

@ -1,580 +0,0 @@
.container {
width: 100%;
padding-right: 1rem;
padding-left: 1rem
}
@media (min-width: 480px) {
.container {
max-width: 480px
}
}
@media (min-width: 600px) {
.container {
max-width: 600px;
padding-right: 2rem;
padding-left: 2rem
}
}
@media (min-width: 782px) {
.container {
max-width: 782px
}
}
@media (min-width: 960px) {
.container {
max-width: 960px;
padding-right: 0rem;
padding-left: 0rem
}
}
@media (min-width: 1280px) {
.container {
max-width: 1280px
}
}
@media (min-width: 1440px) {
.container {
max-width: 1440px
}
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0
}
.m-8 {
margin: 2rem
}
.my-3 {
margin-top: 0.75rem;
margin-bottom: 0.75rem
}
.mx-auto {
margin-left: auto;
margin-right: auto
}
.my-8 {
margin-top: 2rem;
margin-bottom: 2rem
}
.mb-8 {
margin-bottom: 2rem
}
.mb-4 {
margin-bottom: 1rem
}
.mb-1 {
margin-bottom: 0.25rem
}
.mb-12 {
margin-bottom: 3rem
}
.block {
display: block
}
.flex {
display: flex
}
.table {
display: table
}
.h-1 {
height: 0.25rem
}
.min-h-screen {
min-height: 100vh
}
.w-full {
width: 100%
}
.w-16 {
width: 4rem
}
.max-w-sm {
max-width: 24rem
}
.max-w-screen-md {
max-width: 782px
}
.flex-grow {
flex-grow: 1
}
.flex-col {
flex-direction: column
}
.items-center {
align-items: center
}
.justify-center {
justify-content: center
}
.rounded {
border-radius: 0.25rem
}
.border {
border-width: 1px
}
.\!border {
border-width: 1px !important
}
.border-b {
border-bottom-width: 1px
}
.border-primary {
--tw-border-opacity: 1;
border-color: rgb(47 1 84 / var(--tw-border-opacity))
}
.border-secondary {
--tw-border-opacity: 1;
border-color: rgb(223 30 30 / var(--tw-border-opacity))
}
.bg-primary {
--tw-bg-opacity: 1;
background-color: rgb(47 1 84 / var(--tw-bg-opacity))
}
.bg-secondary {
--tw-bg-opacity: 1;
background-color: rgb(223 30 30 / var(--tw-bg-opacity))
}
.bg-acoustique-coproprietes {
--tw-bg-opacity: 1;
background-color: rgb(36 94 242 / var(--tw-bg-opacity))
}
.bg-acoustique-coproprietes-light {
--tw-bg-opacity: 1;
background-color: rgb(223 241 255 / var(--tw-bg-opacity))
}
.bg-energies-urbanisme {
--tw-bg-opacity: 1;
background-color: rgb(2 126 80 / var(--tw-bg-opacity))
}
.bg-energies-urbanisme-light {
--tw-bg-opacity: 1;
background-color: rgb(227 255 240 / var(--tw-bg-opacity))
}
.bg-isolation-quotidien {
--tw-bg-opacity: 1;
background-color: rgb(194 69 3 / var(--tw-bg-opacity))
}
.bg-isolation-quotidien-light {
--tw-bg-opacity: 1;
background-color: rgb(255 251 236 / var(--tw-bg-opacity))
}
.bg-patrimoine-renovation {
--tw-bg-opacity: 1;
background-color: rgb(139 47 247 / var(--tw-bg-opacity))
}
.bg-patrimoine-renovation-light {
--tw-bg-opacity: 1;
background-color: rgb(248 242 255 / var(--tw-bg-opacity))
}
.bg-location-renovation-circulaire {
--tw-bg-opacity: 1;
background-color: rgb(223 0 43 / var(--tw-bg-opacity))
}
.bg-location-renovation-circulaire-light {
--tw-bg-opacity: 1;
background-color: rgb(254 245 246 / var(--tw-bg-opacity))
}
.px-4 {
padding-left: 1rem;
padding-right: 1rem
}
.py-2 {
padding-top: 0.5rem;
padding-bottom: 0.5rem
}
.py-12 {
padding-top: 3rem;
padding-bottom: 3rem
}
.text-center {
text-align: center
}
.text-5xl {
font-size: 3rem;
line-height: 1
}
.text-2xl {
font-size: 1.5rem;
line-height: 2rem
}
.text-sm {
font-size: 0.875rem;
line-height: 1.25rem
}
.text-lg {
font-size: 1.125rem;
line-height: 1.75rem
}
.font-light {
font-weight: 300
}
.font-extrabold {
font-weight: 800
}
.uppercase {
text-transform: uppercase
}
.leading-tight {
line-height: 1.25
}
.text-white {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity))
}
.text-primary {
--tw-text-opacity: 1;
color: rgb(47 1 84 / var(--tw-text-opacity))
}
.text-secondary {
--tw-text-opacity: 1;
color: rgb(223 30 30 / var(--tw-text-opacity))
}
.text-acoustique-coproprietes {
--tw-text-opacity: 1;
color: rgb(36 94 242 / var(--tw-text-opacity))
}
.text-acoustique-coproprietes-light {
--tw-text-opacity: 1;
color: rgb(223 241 255 / var(--tw-text-opacity))
}
.text-energies-urbanisme {
--tw-text-opacity: 1;
color: rgb(2 126 80 / var(--tw-text-opacity))
}
.text-energies-urbanisme-light {
--tw-text-opacity: 1;
color: rgb(227 255 240 / var(--tw-text-opacity))
}
.text-isolation-quotidien {
--tw-text-opacity: 1;
color: rgb(194 69 3 / var(--tw-text-opacity))
}
.text-isolation-quotidien-light {
--tw-text-opacity: 1;
color: rgb(255 251 236 / var(--tw-text-opacity))
}
.text-patrimoine-renovation {
--tw-text-opacity: 1;
color: rgb(139 47 247 / var(--tw-text-opacity))
}
.text-patrimoine-renovation-light {
--tw-text-opacity: 1;
color: rgb(248 242 255 / var(--tw-text-opacity))
}
.text-location-renovation-circulaire {
--tw-text-opacity: 1;
color: rgb(223 0 43 / var(--tw-text-opacity))
}
.text-location-renovation-circulaire-light {
--tw-text-opacity: 1;
color: rgb(254 245 246 / var(--tw-text-opacity))
}
.antialiased {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale
}
.filter {
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)
}
.alignfull {
margin: 2rem calc(50% - 50vw) !important;
max-width: 100vw !important;
width: 100vw
}
.alignwide {
margin: 2rem 0;
max-width: 1280px !important
}
.alignnone {
margin-left: 0px;
margin-right: 0px;
height: auto;
max-width: 100%
}
.aligncenter {
margin: 0.5rem auto;
display: block
}
@media (min-width: 600px) {
.alignleft:not(.wp-block-button) {
margin-right: 0.5rem;
float: left
}
.alignright:not(.wp-block-button) {
margin-left: 0.5rem;
float: right
}
.wp-block-button.alignleft a {
float: left;
margin-right: 1rem
}
.wp-block-button.alignright a {
float: right;
margin-left: 1rem
}
}
.wp-caption {
display: inline-block
}
.wp-caption img {
margin-bottom: 0.5rem;
line-height: 1
}
.wp-caption-text {
font-size: 0.875rem;
color: #718096
}
body {
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"
}
.wp-block {
max-width: 1280px
}
.wp-block[data-align='wide'] {
max-width: 1280px
}
.wp-block[data-align='full'] {
max-width: 100%
}
.wp-block.alignfull {
max-width: 100%
}
.acf-block-component {
/* @apply bg-red-500; */
}
.acf-block-fields {
margin-left: auto;
margin-right: auto;
max-width: 782px
}
.block-editor-default-block-appender .block-editor-inserter button {
--tw-bg-opacity: 1 !important;
background-color: rgb(223 30 30 / var(--tw-bg-opacity)) !important
}
.hover\:bg-primary:hover {
--tw-bg-opacity: 1;
background-color: rgb(47 1 84 / var(--tw-bg-opacity))
}
.hover\:bg-secondary:hover {
--tw-bg-opacity: 1;
background-color: rgb(223 30 30 / var(--tw-bg-opacity))
}
.hover\:bg-acoustique-coproprietes:hover {
--tw-bg-opacity: 1;
background-color: rgb(36 94 242 / var(--tw-bg-opacity))
}
.hover\:bg-acoustique-coproprietes-light:hover {
--tw-bg-opacity: 1;
background-color: rgb(223 241 255 / var(--tw-bg-opacity))
}
.hover\:bg-energies-urbanisme:hover {
--tw-bg-opacity: 1;
background-color: rgb(2 126 80 / var(--tw-bg-opacity))
}
.hover\:bg-energies-urbanisme-light:hover {
--tw-bg-opacity: 1;
background-color: rgb(227 255 240 / var(--tw-bg-opacity))
}
.hover\:bg-isolation-quotidien:hover {
--tw-bg-opacity: 1;
background-color: rgb(194 69 3 / var(--tw-bg-opacity))
}
.hover\:bg-isolation-quotidien-light:hover {
--tw-bg-opacity: 1;
background-color: rgb(255 251 236 / var(--tw-bg-opacity))
}
.hover\:bg-patrimoine-renovation:hover {
--tw-bg-opacity: 1;
background-color: rgb(139 47 247 / var(--tw-bg-opacity))
}
.hover\:bg-patrimoine-renovation-light:hover {
--tw-bg-opacity: 1;
background-color: rgb(248 242 255 / var(--tw-bg-opacity))
}
.hover\:text-primary:hover {
--tw-text-opacity: 1;
color: rgb(47 1 84 / var(--tw-text-opacity))
}
.hover\:text-secondary:hover {
--tw-text-opacity: 1;
color: rgb(223 30 30 / var(--tw-text-opacity))
}
.hover\:text-acoustique-coproprietes:hover {
--tw-text-opacity: 1;
color: rgb(36 94 242 / var(--tw-text-opacity))
}
.hover\:text-acoustique-coproprietes-light:hover {
--tw-text-opacity: 1;
color: rgb(223 241 255 / var(--tw-text-opacity))
}
.hover\:text-energies-urbanisme:hover {
--tw-text-opacity: 1;
color: rgb(2 126 80 / var(--tw-text-opacity))
}
.hover\:text-energies-urbanisme-light:hover {
--tw-text-opacity: 1;
color: rgb(227 255 240 / var(--tw-text-opacity))
}
.hover\:text-isolation-quotidien:hover {
--tw-text-opacity: 1;
color: rgb(194 69 3 / var(--tw-text-opacity))
}
.hover\:text-isolation-quotidien-light:hover {
--tw-text-opacity: 1;
color: rgb(255 251 236 / var(--tw-text-opacity))
}
.hover\:text-patrimoine-renovation:hover {
--tw-text-opacity: 1;
color: rgb(139 47 247 / var(--tw-text-opacity))
}
.hover\:text-patrimoine-renovation-light:hover {
--tw-text-opacity: 1;
color: rgb(248 242 255 / var(--tw-text-opacity))
}
@media (min-width: 782px) {
.md\:my-6 {
margin-top: 1.5rem;
margin-bottom: 1.5rem
}
.md\:flex {
display: flex
}
.md\:w-1\/2 {
width: 50%
}
.md\:text-3xl {
font-size: 1.875rem;
line-height: 2.25rem
}
}
@media (min-width: 960px) {
.lg\:text-5xl {
font-size: 3rem;
line-height: 1
}
}

View File

@ -1,37 +0,0 @@
body {
/* @apply bg-primary; */
}
#login h1 a,
.login h1 a {
background-image: url("../resources/img/logo_client.svg");
height: 100px;
width: 300px;
background-size: 300px 100px;
background-repeat: no-repeat;
padding-bottom: 10px;
}
#wp-submit {
--tw-border-opacity: 1;
border-color: rgb(47 1 84 / var(--tw-border-opacity));
--tw-bg-opacity: 1;
background-color: rgb(47 1 84 / var(--tw-bg-opacity));
}
#nav a,
#backtoblog a {
/* color: var(--red) !important; */
--tw-text-opacity: 1;
color: rgb(47 1 84 / var(--tw-text-opacity));
}
#loginform {
border: none;
}
.wp-pwd span {
--tw-text-opacity: 1;
color: rgb(47 1 84 / var(--tw-text-opacity));
/* color: var(--red) !important; */
}

338
js/app.js
View File

@ -1,338 +0,0 @@
(() => {
// resources/js/editor.js
function editorInit() {
const tablesCells = document.querySelectorAll(".wp-block-table td");
function filterCells(element, stringToParse) {
return element.textContent.trim() === stringToParse;
}
const checkedCells = Array.from(tablesCells).filter((element) => filterCells(element, "((v))"));
const crossedCells = Array.from(tablesCells).filter((element) => filterCells(element, "((x))"));
checkedCells.forEach((cell) => {
cell.innerHTML = `<div class="table-cell-icon table-cell-icon--checked"><img src="${mainAppJsDynamicDatas.template_directory_uri}/resources/img/graphic-assets/table-cell--check.svg"
alt="${mainAppJsDynamicDatas.yes}"/></div>`;
});
crossedCells.forEach((cell) => {
cell.innerHTML = `<img class="table-cell-icon table-cell-icon--crossed" src="${mainAppJsDynamicDatas.template_directory_uri}/resources/img/graphic-assets/table-cell--cross.svg"
alt="${mainAppJsDynamicDatas.no}"/>`;
});
}
// resources/js/menus.js
function menuInit() {
const header = document.querySelector("#main-header");
const footer = document.querySelector("footer");
if (!header)
return;
const searchModule = header.querySelector(".search-module");
const searchModuleToggle = header.querySelector("#search-module-toggle");
const mobileMenuToggle = header.querySelector("#mobile-menu-toggle");
const headerSubmenuToggles = header.querySelectorAll(".menu-item__submenu-toggle");
const headerSubmenuCloseBtns = header.querySelectorAll(".menu-item__submenu-close");
const footerSubmenuToggles = footer.querySelectorAll(".menu-item__submenu-toggle");
const footerSubmenuCloseBtns = footer.querySelectorAll(".menu-item__submenu-close");
function isSubmenuOpen() {
return header.querySelector(".sub-menu--open") !== null || footer.querySelector(".sub-menu--open") !== null;
}
function openSubmenu(buttonToggle) {
let isExpanded = buttonToggle.getAttribute("aria-expanded") === "true";
buttonToggle.setAttribute("aria-expanded", !isExpanded);
buttonToggle.parentElement.querySelector(".sub-menu").classList.toggle("sub-menu--open");
buttonToggle.parentElement.querySelector(".sub-menu").classList.toggle("sub-menu--closed");
}
function closeSubmenus() {
const headerOpenSubmenus = header.querySelectorAll(".sub-menu--open");
const footerOpenSubmenus = footer.querySelectorAll(".sub-menu--open");
headerOpenSubmenus.forEach((submenu) => {
submenu.classList.remove("sub-menu--open");
submenu.classList.add("sub-menu--closed");
submenu.parentElement.querySelector(".menu-item__submenu-toggle").setAttribute("aria-expanded", "false");
});
footerOpenSubmenus.forEach((submenu) => {
submenu.classList.remove("sub-menu--open");
submenu.classList.add("sub-menu--closed");
submenu.parentElement.querySelector(".menu-item__submenu-toggle").setAttribute("aria-expanded", "false");
});
}
function handleSubmenuToggle(buttonToggle) {
let isExpanded = buttonToggle.getAttribute("aria-expanded") === "true";
if (!isExpanded) {
closeSubmenus();
openSubmenu(buttonToggle);
} else {
closeSubmenus();
}
}
function closeCurrentSubmenu(buttonClose) {
const currentOpenedSubmenu = buttonClose.parentElement;
currentOpenedSubmenu.classList.remove("sub-menu--open");
currentOpenedSubmenu.classList.add("sub-menu--closed");
currentOpenedSubmenu.parentElement.querySelector(".menu-item__submenu-toggle").setAttribute("aria-expanded", "false");
}
headerSubmenuToggles.forEach((button) => {
button.addEventListener("click", () => {
if (isSearchOpen() === true) {
closeSearch();
}
handleSubmenuToggle(button);
});
});
headerSubmenuCloseBtns.forEach((button) => {
button.addEventListener("click", () => closeCurrentSubmenu(button));
});
footerSubmenuToggles.forEach((button) => {
button.addEventListener("click", () => {
if (isSearchOpen() === true) {
closeSearch();
}
handleSubmenuToggle(button);
});
});
footerSubmenuCloseBtns.forEach((button) => {
button.addEventListener("click", () => closeCurrentSubmenu(button));
});
function isSearchOpen() {
if (searchModule.getAttribute("mobile-closed") != null && searchModule.getAttribute("aria-hidden") != null && searchModule.getAttribute("mobile-opened") === null) {
return false;
}
if (searchModule.getAttribute("mobile-opened") != null && searchModule.getAttribute("mobile-closed") === null && searchModule.getAttribute("aria-hidden") === null) {
return true;
}
return null;
}
function openSearch() {
const searchFieldInput = header.querySelector(".search-module__search-form__input");
searchModuleToggle.setAttribute("aria-expanded", "true");
searchModule.setAttribute("mobile-opened", "");
searchModule.removeAttribute("mobile-closed");
searchFieldInput.focus();
setTimeout(() => {
searchModule.removeAttribute("aria-hidden");
}, 400);
}
function closeSearch() {
searchModuleToggle.setAttribute("aria-expanded", "false");
searchModuleToggle.focus();
searchModule.setAttribute("aria-hidden", "");
searchModule.removeAttribute("mobile-opened", "");
searchModule.setAttribute("mobile-closing", "");
searchModule.addEventListener("animationend", () => {
searchModule.setAttribute("mobile-closed", "");
searchModule.removeAttribute("mobile-closing", "");
}, { once: true });
}
searchModuleToggle.addEventListener("click", function(e) {
closeSubmenus();
if (isSearchOpen() === false) {
openSearch();
return;
}
if (isSearchOpen() === true) {
closeSearch();
}
});
const renovateurNavListContainer = header.querySelector(".menu-renovateur__navlist-container");
const HomegradeNavListContainer = header.querySelector(".menu-homegrade");
function isMobileNavOpened() {
console.log("is mobile nav opened");
console.log(renovateurNavListContainer.hasAttribute("opened") && mobileMenuToggle.getAttribute("aria-expanded") === "true");
return renovateurNavListContainer.hasAttribute("opened") && mobileMenuToggle.getAttribute("aria-expanded") === "true";
}
function openMenu(menuContainer) {
console.log("open menu");
mobileMenuToggle.setAttribute("aria-expanded", "true");
const textContent = mobileMenuToggle.querySelector("span.text-content");
textContent.textContent = mobileMenuToggle.getAttribute("data-text-close");
function openRenovateur() {
renovateurNavListContainer.removeAttribute("closed", "");
renovateurNavListContainer.setAttribute("opened", "");
renovateurNavListContainer.removeAttribute("aria-hidden", "");
renovateurNavListContainer.setAttribute("opening", "");
renovateurNavListContainer.addEventListener("animationend", () => {
renovateurNavListContainer.removeAttribute("opening", "");
}, { once: true });
console.log("#######");
}
function openHomegrade() {
HomegradeNavListContainer.removeAttribute("closed", "");
HomegradeNavListContainer.setAttribute("opened", "");
HomegradeNavListContainer.removeAttribute("aria-hidden", "");
HomegradeNavListContainer.setAttribute("opening", "");
HomegradeNavListContainer.addEventListener("animationend", () => {
HomegradeNavListContainer.removeAttribute("opening", "");
}, { once: true });
}
openRenovateur();
openHomegrade();
}
function closeMenu(menuContainer) {
mobileMenuToggle.setAttribute("aria-expanded", "false");
let textContent = mobileMenuToggle.querySelector("span.text-content");
textContent.textContent = mobileMenuToggle.getAttribute("data-text-open");
renovateurNavListContainer.removeAttribute("opened");
renovateurNavListContainer.setAttribute("aria-hidden", "");
renovateurNavListContainer.setAttribute("closing", "");
renovateurNavListContainer.addEventListener("animationend", () => {
renovateurNavListContainer.setAttribute("closed", "");
renovateurNavListContainer.removeAttribute("closing", "");
}, { once: true });
HomegradeNavListContainer.removeAttribute("opened");
HomegradeNavListContainer.setAttribute("aria-hidden", "");
HomegradeNavListContainer.setAttribute("closing", "");
HomegradeNavListContainer.addEventListener("animationend", () => {
HomegradeNavListContainer.setAttribute("closed", "");
HomegradeNavListContainer.removeAttribute("closing", "");
}, { once: true });
}
mobileMenuToggle.addEventListener("click", function(e) {
if (isMobileNavOpened() === false) {
openMenu();
return;
}
if (isMobileNavOpened() === true) {
closeMenu();
}
});
function getFirstLink(menuLinks) {
return menuLinks[0].querySelector("button") ? menuLinks[0].querySelector("button") : menuLinks[0].querySelector("a");
}
function getLastLink(menuLinks) {
return menuLinks[menuLinks.length - 1].querySelector("button") ? menuLinks[menuLinks.length - 1].querySelector("button") : menuLinks[menuLinks.length - 1].querySelector("a");
}
const renovateurLinks = header.querySelectorAll(".menu-renovateur__navlist .menu-item");
const renovateurFirstLink = getFirstLink(renovateurLinks);
const renovateurLastLink = getLastLink(renovateurLinks);
const homegradeLinks = header.querySelectorAll(".menu-homegrade__navlist .menu-item");
const homegradeFirstLink = getFirstLink(homegradeLinks);
const homegradeLastLink = getLastLink(homegradeLinks);
mobileMenuToggle.addEventListener("focusout", (e) => {
if (isMobileNavOpened()) {
renovateurFirstLink.focus();
}
});
renovateurFirstLink.addEventListener("focusout", (e) => {
if (e.relatedTarget.id == "website-logo-link" && isMobileNavOpened()) {
mobileMenuToggle.focus();
}
});
renovateurLastLink.addEventListener("focusout", (e) => {
if (isMobileNavOpened()) {
homegradeFirstLink.focus();
}
});
homegradeLastLink.addEventListener("focusout", (e) => {
if (isMobileNavOpened()) {
mobileMenuToggle.focus();
}
});
document.addEventListener("keydown", (e) => {
if (e.key === "Escape") {
if (isMobileNavOpened()) {
closeMenu(renovateurNavListContainer);
closeMenu(HomegradeNavListContainer);
}
if (isSearchOpen() === true) {
closeSearch();
}
if (isSubmenuOpen()) {
closeSubmenus();
}
}
});
}
// resources/js/single-conseil.js
function singleConseil() {
const hasChapterIndex = document.querySelector(".chapter_index__list");
if (!hasChapterIndex)
return;
let chapterIndex = document.querySelector(".chapter_index");
let questionBlocks = document.querySelectorAll(".questions-container-block");
function handleLinkScrollToTarget(e) {
e.preventDefault();
let target = e.target.getAttribute("href");
let targetBlock = document.querySelector(target);
targetBlock.setAttribute("tabindex", "0");
targetBlock.scrollIntoView({
behavior: "smooth"
});
targetBlock.focus({ preventScroll: true });
}
function handleChapterIndicatorPosition(targetPosition) {
let chapterIndicator = document.querySelector(".chapter_index__position-indicator");
chapterIndicator.style.top = targetPosition + "px";
}
let chapterLinks = document.querySelectorAll(".chapter_index__link");
chapterLinks.forEach((link) => {
link.addEventListener("click", (e) => {
handleLinkScrollToTarget(e);
handleChapterIndicatorPosition(e.target.offsetTop);
});
});
const io = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
entry.target.classList.add("active");
const blockId = entry.target.getAttribute("id");
const relatedChapterLink = document.querySelector(`a[href="#${blockId}"]`);
handleChapterIndicatorPosition(relatedChapterLink.offsetTop);
} else {
}
});
}, {
rootMargin: "-10% 0px -70% 0px"
});
function buildAllBlocksToObserve() {
const questionsContainerBlocks = document.querySelectorAll(".questions-container-block");
const vocabulaireSummaryBlock = document.querySelector(".homegrade-blocks-vocabulaire-summary");
const plusLoinBlock = document.querySelector("#aller-plus-loin");
let allBlocks2 = [];
if (questionsContainerBlocks)
allBlocks2 = [...questionsContainerBlocks];
if (vocabulaireSummaryBlock)
allBlocks2.push(vocabulaireSummaryBlock);
if (plusLoinBlock)
allBlocks2.push(plusLoinBlock);
return allBlocks2;
}
allBlocks = buildAllBlocksToObserve();
allBlocks.forEach((el) => {
console.log(el);
io.observe(el);
});
}
// resources/js/schema-bullet-points.js
function SchemaBulletPointsInit() {
const focusBulletPoints = document.querySelectorAll(".homegrade-blocks-focus-point-bullet");
if (!focusBulletPoints)
return;
focusBulletPoints.forEach((focusPoint) => {
const focusPointsContainer = focusPoint.parentElement;
focusPoint.addEventListener("mouseover", (event) => {
const aleradyHoveredFocusPoint = document.querySelector("[data-hovered]");
console.log(aleradyHoveredFocusPoint);
const focusTitle = focusPoint.getAttribute("data-focus-bullet-title");
const focusPointPopupContainer = document.createElement("div");
focusPointPopupContainer.className = "focus-point-popup-container";
const focusPointPopupTitle = document.createElement("h4");
focusPointPopupTitle.textContent = focusTitle;
focusPointPopupTitle.className = "focus-point-popup-container__title";
focusPointPopupContainer.appendChild(focusPointPopupTitle);
focusPoint.appendChild(focusPointPopupContainer);
focusPoint.setAttribute("data-hovered", "");
});
focusPoint.addEventListener("mouseout", function() {
const focusPointPopupContainer = focusPoint.querySelector(".focus-point-popup-container");
focusPointPopupContainer.remove();
});
});
}
// resources/js/app.js
window.addEventListener("DOMContentLoaded", (event) => {
menuInit();
SchemaBulletPointsInit();
singleConseil();
editorInit();
});
})();