From 6156666ed499f81fb5e66724bb1a383b50bd73f6 Mon Sep 17 00:00:00 2001 From: ouidade Date: Thu, 22 May 2025 21:14:06 +0200 Subject: [PATCH] console --- web/themes/custom/eql/dist/assets/bundle.js | 2 +- web/themes/custom/eql/scripts/main.js | 2 +- web/themes/custom/eql/scss/pages/ressources.scss | 5 ----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/web/themes/custom/eql/dist/assets/bundle.js b/web/themes/custom/eql/dist/assets/bundle.js index f4cecaa..9c98950 100644 --- a/web/themes/custom/eql/dist/assets/bundle.js +++ b/web/themes/custom/eql/dist/assets/bundle.js @@ -36,7 +36,7 @@ eval("/**\n * @file\n * External links js file.\n */\n\n (function ($, Drupal, d \*************************/ /***/ (function() { -eval("jQuery(function ($) {\n console.log('salut');\n\n // MENU BURGER\n const burger = document.getElementById(\"block-burger\");\n const burgertitle = document.getElementById(\"block-burger-menu\");\n if (burger && burgertitle) {\n burgertitle.addEventListener(\"click\", function () {\n burger.classList.toggle('opened');\n });\n }\n\n // FAQ — réponses\n const answers = document.getElementsByClassName(\"field--name-field-reponse\");\n const fichiers = document.getElementsByClassName(\"field--name-field-fichiers\");\n const liens = document.getElementsByClassName(\"field--name-field-liens\");\n const ressources = document.getElementsByClassName(\"field--name-field-ress\");\n const questions = document.getElementsByClassName(\"field--name-field-question\");\n\n for (let i = 0; i < questions.length; i++) {\n const q = questions[i];\n q.addEventListener(\"click\", function () {\n // Réponses\n Array.from(answers).forEach(a => a.classList.remove(\"opened\"));\n const r = this.parentNode.querySelector(\".field--name-field-reponse\");\n if (r) r.classList.add(\"opened\");\n\n // Fichiers\n Array.from(fichiers).forEach(f => f.classList.remove(\"opened\"));\n const f = this.parentNode.querySelector(\".field--name-field-fichiers\");\n if (f) f.classList.add(\"opened\");\n\n // Liens\n Array.from(liens).forEach(l => l.classList.remove(\"opened\"));\n const l = this.parentNode.querySelector(\".field--name-field-liens\");\n if (l) l.classList.add(\"opened\");\n\n // Ressources\n Array.from(ressources).forEach(r => r.classList.remove(\"opened\"));\n const res = this.parentNode.querySelector(\".field--name-field-ress\");\n if (res) res.classList.add(\"opened\");\n });\n }\n\n // SLIDESHOW INIT\n $('.path-frontpage .view-actus-blocks-pages .view-content .view-type-slide .views-row-wrapper').slick({\n slidesToShow: 1,\n dots: true,\n arrows: true,\n centerMode: true,\n responsive: [{\n breakpoint: 810,\n settings: {\n slidesToShow: 1,\n adaptiveHeight: true,\n arrows: false,\n draggable: true,\n centerMode: true,\n }\n }]\n });\n\n $('.page-node-type-actualite .block-entity-fieldnodefield-images .field--type-image').slick({\n dots: true,\n arrows: true,\n adaptiveHeight: true,\n responsive: [{\n breakpoint: 800,\n settings: { adaptiveHeight: true }\n }]\n });\n\n $('.page-node-type-projet .block-entity-fieldnodefield-photo .field--type-image').slick({\n slidesToShow: 1,\n dots: true,\n arrows: false,\n draggable: true,\n adaptiveHeight: true,\n responsive: [{\n breakpoint: 800,\n settings: { adaptiveHeight: true }\n }]\n });\n\n // Classes media → .wrapper-ressource\n $(\".wrapper-ressource\").each(function () {\n const media = $(this).find(\".field--name-field-type-de-media\").text().trim();\n const className = media\n .toLowerCase()\n .normalize(\"NFD\").replace(/[\\u0300-\\u036f]/g, \"\")\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/(^-|-$)/g, '');\n $(this).addClass('type-media-' + className);\n });\n console.log(media);\n // SLIDES RECONSTRUCTION LORS DU CHARGEMENT COMPLET\n $(window).on('load', function () {\n const $viewContent = $('.path-ressources .view-content').first();\n if ($viewContent.length === 0) return;\n $viewContent.addClass('view-ressources-hidden');\n \n\n const allowedTypes = [\n 'type-publication-issue-du-programme-eqld',\n 'type-paroles-de-laureats',\n 'type-les-projets-en-images',\n 'type-presse'\n ];\n\n // const $viewContent = $('.view-content');\n const allRows = $('.path-ressources .view-base-de-donnees .views-row').detach();\n function toLabel(str) {\n return str.replace('type-', '').replace(/-/g, ' ').replace(/\\b\\w/g, l => l.toUpperCase());\n } \n allowedTypes.forEach(type => {\n const label = toLabel(type); \n const $slide = $(`\n
\n

${label}

\n
\n
\n `);\n $viewContent.append($slide);\n });\n\n allRows.each(function () {\n const $row = $(this);\n const classList = $row.attr('class').split(/\\s+/);\n classList.forEach(cls => {\n if (allowedTypes.includes(cls)) {\n $(`.view-type-slide.${cls} .views-row-wrapper`).append($row.clone(true, true));\n }\n });\n });\n\n $('.path-ressources .view:not(.view-partenaires) .view-content .view-type-slide .views-row-wrapper').slick({\n slidesToShow: 3,\n dots: false,\n arrows: true,\n infinite: false,\n centerMode: false,\n responsive: [{\n breakpoint: 810,\n settings: {\n slidesToShow: 3,\n arrows: false,\n draggable: true,\n centerMode: true,\n }\n }]\n });\n // Supprimer les .view-type-slide originales générées par Drupal (vides ou non autorisées)\n $('.path-ressources .view-base-de-donnees .view-type-slide').each(function () {\n const classes = $(this).attr('class').split(/\\s+/);\n const isCustom = classes.some(cls => allowedTypes.includes(cls));\n if (!isCustom) {\n $(this).remove();\n }\n console.log(classes);\n });\n \n $viewContent.removeClass('view-ressources-hidden');\n\n });\n\n // Ouvrir les liens externes dans un nouvel onglet\n document.querySelectorAll('a[href^=\"http\"]').forEach(link => {\n if (!link.href.includes(location.hostname)) {\n link.setAttribute('target', '_blank');\n link.setAttribute('rel', 'noopener noreferrer');\n }\n });\n\n // Scroll automatique au filtre\n const form = document.querySelector(\".views-exposed-form\");\n if (form) form.setAttribute(\"action\", form.action.split(\"#\")[0] + \"#filtres\");\n\n if (window.location.hash === \"#filtres\") {\n const target = document.getElementById(\"filtres\");\n if (target) {\n const offset = 300;\n const top = target.getBoundingClientRect().top + window.pageYOffset - offset;\n window.scrollTo({ top: top, behavior: \"smooth\" });\n }\n }\n\n // MASQUER TYPE DE RESSOURCE DOUBLON\n $(\".view-type-slide\").each(function () {\n const h3Content = $(this).find(\"h3\").text().trim();\n $(this).find(\".field--name-field-type-de-ressource\").each(function () {\n if ($(this).text().trim() === h3Content) {\n $(this).hide();\n }\n });\n });\n});\n\n\n//# sourceURL=webpack://dev.eql.fr/./scripts/main.js?"); +eval("jQuery(function ($) {\n console.log('salut');\n\n // MENU BURGER\n const burger = document.getElementById(\"block-burger\");\n const burgertitle = document.getElementById(\"block-burger-menu\");\n if (burger && burgertitle) {\n burgertitle.addEventListener(\"click\", function () {\n burger.classList.toggle('opened');\n });\n }\n\n // FAQ — réponses\n const answers = document.getElementsByClassName(\"field--name-field-reponse\");\n const fichiers = document.getElementsByClassName(\"field--name-field-fichiers\");\n const liens = document.getElementsByClassName(\"field--name-field-liens\");\n const ressources = document.getElementsByClassName(\"field--name-field-ress\");\n const questions = document.getElementsByClassName(\"field--name-field-question\");\n\n for (let i = 0; i < questions.length; i++) {\n const q = questions[i];\n q.addEventListener(\"click\", function () {\n // Réponses\n Array.from(answers).forEach(a => a.classList.remove(\"opened\"));\n const r = this.parentNode.querySelector(\".field--name-field-reponse\");\n if (r) r.classList.add(\"opened\");\n\n // Fichiers\n Array.from(fichiers).forEach(f => f.classList.remove(\"opened\"));\n const f = this.parentNode.querySelector(\".field--name-field-fichiers\");\n if (f) f.classList.add(\"opened\");\n\n // Liens\n Array.from(liens).forEach(l => l.classList.remove(\"opened\"));\n const l = this.parentNode.querySelector(\".field--name-field-liens\");\n if (l) l.classList.add(\"opened\");\n\n // Ressources\n Array.from(ressources).forEach(r => r.classList.remove(\"opened\"));\n const res = this.parentNode.querySelector(\".field--name-field-ress\");\n if (res) res.classList.add(\"opened\");\n });\n }\n\n // SLIDESHOW INIT\n $('.path-frontpage .view-actus-blocks-pages .view-content .view-type-slide .views-row-wrapper').slick({\n slidesToShow: 1,\n dots: true,\n arrows: true,\n centerMode: true,\n responsive: [{\n breakpoint: 810,\n settings: {\n slidesToShow: 1,\n adaptiveHeight: true,\n arrows: false,\n draggable: true,\n centerMode: true,\n }\n }]\n });\n\n $('.page-node-type-actualite .block-entity-fieldnodefield-images .field--type-image').slick({\n dots: true,\n arrows: true,\n adaptiveHeight: true,\n responsive: [{\n breakpoint: 800,\n settings: { adaptiveHeight: true }\n }]\n });\n\n $('.page-node-type-projet .block-entity-fieldnodefield-photo .field--type-image').slick({\n slidesToShow: 1,\n dots: true,\n arrows: false,\n draggable: true,\n adaptiveHeight: true,\n responsive: [{\n breakpoint: 800,\n settings: { adaptiveHeight: true }\n }]\n });\n\n // Classes media → .wrapper-ressource\n $(\".wrapper-ressource\").each(function () {\n const media = $(this).find(\".field--name-field-type-de-media\").text().trim();\n const className = media\n .toLowerCase()\n .normalize(\"NFD\").replace(/[\\u0300-\\u036f]/g, \"\")\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/(^-|-$)/g, '');\n $(this).addClass('type-media-' + className);\n });\n console.log(\"classses media\");\n // SLIDES RECONSTRUCTION LORS DU CHARGEMENT COMPLET\n $(window).on('load', function () {\n const $viewContent = $('.path-ressources .view-content').first();\n if ($viewContent.length === 0) return;\n $viewContent.addClass('view-ressources-hidden');\n \n\n const allowedTypes = [\n 'type-publication-issue-du-programme-eqld',\n 'type-paroles-de-laureats',\n 'type-les-projets-en-images',\n 'type-presse'\n ];\n\n // const $viewContent = $('.view-content');\n const allRows = $('.path-ressources .view-base-de-donnees .views-row').detach();\n function toLabel(str) {\n return str.replace('type-', '').replace(/-/g, ' ').replace(/\\b\\w/g, l => l.toUpperCase());\n } \n allowedTypes.forEach(type => {\n const label = toLabel(type); \n const $slide = $(`\n
\n

${label}

\n
\n
\n `);\n $viewContent.append($slide);\n });\n\n allRows.each(function () {\n const $row = $(this);\n const classList = $row.attr('class').split(/\\s+/);\n classList.forEach(cls => {\n if (allowedTypes.includes(cls)) {\n $(`.view-type-slide.${cls} .views-row-wrapper`).append($row.clone(true, true));\n }\n });\n });\n\n $('.path-ressources .view:not(.view-partenaires) .view-content .view-type-slide .views-row-wrapper').slick({\n slidesToShow: 3,\n dots: false,\n arrows: true,\n infinite: false,\n centerMode: false,\n responsive: [{\n breakpoint: 810,\n settings: {\n slidesToShow: 3,\n arrows: false,\n draggable: true,\n centerMode: true,\n }\n }]\n });\n // Supprimer les .view-type-slide originales générées par Drupal (vides ou non autorisées)\n $('.path-ressources .view-base-de-donnees .view-type-slide').each(function () {\n const classes = $(this).attr('class').split(/\\s+/);\n const isCustom = classes.some(cls => allowedTypes.includes(cls));\n if (!isCustom) {\n $(this).remove();\n }\n console.log(classes);\n });\n \n $viewContent.removeClass('view-ressources-hidden');\n\n });\n\n // Ouvrir les liens externes dans un nouvel onglet\n document.querySelectorAll('a[href^=\"http\"]').forEach(link => {\n if (!link.href.includes(location.hostname)) {\n link.setAttribute('target', '_blank');\n link.setAttribute('rel', 'noopener noreferrer');\n }\n });\n\n // Scroll automatique au filtre\n const form = document.querySelector(\".views-exposed-form\");\n if (form) form.setAttribute(\"action\", form.action.split(\"#\")[0] + \"#filtres\");\n\n if (window.location.hash === \"#filtres\") {\n const target = document.getElementById(\"filtres\");\n if (target) {\n const offset = 300;\n const top = target.getBoundingClientRect().top + window.pageYOffset - offset;\n window.scrollTo({ top: top, behavior: \"smooth\" });\n }\n }\n\n // MASQUER TYPE DE RESSOURCE DOUBLON\n $(\".view-type-slide\").each(function () {\n const h3Content = $(this).find(\"h3\").text().trim();\n $(this).find(\".field--name-field-type-de-ressource\").each(function () {\n if ($(this).text().trim() === h3Content) {\n $(this).hide();\n }\n });\n });\n});\n\n\n//# sourceURL=webpack://dev.eql.fr/./scripts/main.js?"); /***/ }) diff --git a/web/themes/custom/eql/scripts/main.js b/web/themes/custom/eql/scripts/main.js index e100ff7..b0bb77b 100644 --- a/web/themes/custom/eql/scripts/main.js +++ b/web/themes/custom/eql/scripts/main.js @@ -92,7 +92,7 @@ jQuery(function ($) { .replace(/(^-|-$)/g, ''); $(this).addClass('type-media-' + className); }); - console.log(media); + console.log("classses media"); // SLIDES RECONSTRUCTION LORS DU CHARGEMENT COMPLET $(window).on('load', function () { const $viewContent = $('.path-ressources .view-content').first(); diff --git a/web/themes/custom/eql/scss/pages/ressources.scss b/web/themes/custom/eql/scss/pages/ressources.scss index e2e708f..731c7c0 100644 --- a/web/themes/custom/eql/scss/pages/ressources.scss +++ b/web/themes/custom/eql/scss/pages/ressources.scss @@ -280,12 +280,7 @@ height: 0; overflow: hidden; } - - - - .view-content{ - transition: opacity 0.3s ease; display: flex; flex-direction: row;