1//Tarte au citron 2tarteaucitronCustomText = { 3 "disclaimer": "En autorisant chacun de ces services tiers, vous acceptez le dépôt, la lecture de cookies ainsi que le suivi mis en place par ces plateformes. A noter que les cookies nécessaires au bon fonctionnement du site (connexion à l'administration par exemple) ou ceux déposés par l'outil de mesure d'audience matomo respectueux de la vie privée échappent à l'impératif de consentement préalable.", 4 "fallback": " est désactivé pour protéger votre vie privée.<div class='tac_fallback_customtext'><p><a href='/protection-des-donnees-personnelles' target='_blank'>Plus d'informations sur la protection des données.</a></p><p>Cliquez sur le bouton '<b>Autoriser</b>' pour charger le module tiers :</p></div>", 5 "noCookie": " - Ce service ne dépose aucun cookie.", 6 "useCookie": " - Ce service peut déposer", 7 "useCookieCurrent": " - Ce service a déposé", 8 "useNoCookie": " - Ce service n'a déposé aucun cookie.", 9}; 10tarteaucitron.init({ 11 "privacyUrl": "/protection-des-donnees-personnelles", 12 /* Privacy policy url */ 13 "hashtag": "#consentement-services", 14 /* Open the panel with this hashtag */ 15 "cookieName": "consentement-services", 16 /* Cookie name */ 17 "showIcon": false, 18 /* Show cookie icon to manage cookies */ 19 "highPrivacy": true, 20 /* HIGHLY RECOMMANDED Disable auto consent */ 21 "removeCredit": true, 22 /* Remove credit link */ 23 "mandatory": false, 24 /* Show a message about mandatory cookies */ 25 "moreInfoLink": true, 26 /* Show more info link */ 27 "orientation": "bottom", 28 /* Banner position (top - bottom) */ 29 "handleBrowserDNTRequest": true, 30 "useExternalCss": true, 31 "reloadThePage": true, 32 /* pour Firefox */ 33}); 34 35window.addEventListener("load", (event) => { 36 setTimeout(function () { 37 // Ajout du texte pour informer des ressources externes chargées et du traçage 38 document.querySelectorAll(".tac_activate .tac_fallback_customtext").forEach(e => { 39 const service = Array.from(e.closest('[class$="RVVN"').classList).filter( 40 (className) => className.endsWith("RVVN") 41 )[0].replace("tac_activate_", ""); 42 //console.log(service); 43 44 const domains = tarteaucitron.services[service].domains ?? []; //?.join(", ") ?? ""; 45 //console.log(domains); 46 if(domains.length > 0) { 47 let domainsWarningParts = []; 48 domainsWarningParts[0] = document.createElement("p"); 49 domainsWarningParts[0].classList.add("tacDomainsWarning"); 50 domainsWarningParts[0].appendChild(document.createTextNode(`Les domaines suivants sont susceptibles de charger des ressources externes à ce site, de déposer des cookies et par conséquent de vous tracer : `)); 51 //domainsWarning.appendChild(document.createElement("br")); 52 //const ul = domainsWarning.appendChild(document.createElement("ul")); 53 domainsWarningParts[1] = document.createElement("ul"); 54 domainsWarningParts[1].classList.add("tacDomainsWarning"); 55 domains.forEach((d, idx) => { 56 const li = document.createElement("li").appendChild(document.createTextNode(`${d}${idx < (domains.length - 1) ? ", " : ""}`)).parentElement; 57 domainsWarningParts[1].appendChild(li); 58 }); 59 e.prepend(...domainsWarningParts); 60 } 61 }); 62 // Ajout du bouton de gestion des services à l'encart de chaque service 63 document.querySelectorAll(".tac_activate .tac_float button.tarteaucitronAllow").forEach(e => { 64 let button1 = document.createElement("button"); 65 button1.appendChild(document.createTextNode("Gérer les services")); 66 button1.classList.add('tarteaucitronManagement'); 67 button1.addEventListener("click", (e) => {
68 tarteaucitron.userInterface.openPanel(); 69 }); 70 e.insertAdjacentElement('afterend', button1); 71 }); 72 // RVVN Suppression de liens inutiles dans la modal des services 73 document.querySelectorAll("a.tarteaucitronReadmoreInfo + .tarteaucitronReadmoreSeparator, a.tarteaucitronReadmoreInfo").forEach(e => e.remove()); 74 }, 200); 75}); 76 77window.addEventListener("tac.open_panel", (e) => { 78 tarteaucitron.job.forEach(e => { 79 //console.log(e); 80 //console.log(`${e}Line`); 81 const serviceStatusInfo = document.querySelector(`#${e}Line .tarteaucitronStatusInfo`); 82 if(serviceStatusInfo.querySelector(".tacDomainsWarning")) { 83 return; 84 } 85 const domains = tarteaucitron.services[e].domains ?? []; //?.join(", ") ?? ""; 86 //console.log(serviceStatusInfo, domains); 87 if(domains.length > 0) { 88 let domainsWarning = document.createElement("p"); 89 domainsWarning.classList.add("tacDomainsWarning"); 90 domainsWarning.appendChild(document.createTextNode(`Les domaines suivants sont susceptibles de charger des ressources externes à ce site, de déposer des cookies et par conséquent de vous tracer : ${domains.join(", ")}.`)); 91 serviceStatusInfo.appendChild(domainsWarning); 92 } 93 }); 94}); 95 96// En cours : utilisation de Javascript natif à la place de jQuery 97document.addEventListener("DOMContentLoaded", (event) => { 98 //console.log("DOMContentLoaded", document.documentElement, document.body); 99 100 // Nécessaire depuis l'abandon de Modernizr 101 document.documentElement.classList.replace('no-js', 'js'); 102 103 // Carrousel v3 104 // Ajout des classes invert et carouselv3 ssi premier contenu 105 if (document.querySelector("#contenu>section.partialcarouselv3:first-child") && document.querySelector("#socialshare")) { 106 document.querySelector("#socialshare").classList.add("invert", "carouselv3"); 107 } 108 109 // Contenus audio 110 // Lancement de la lecture automatique si configuré 111 // Insertion d'un message d'erreur si le navigateur ne l'autorise pas 112 document.querySelectorAll("section.audio.autoplay audio").forEach(audioToPlay => { 113 const promise = audioToPlay.play(); 114 if (promise !== undefined) { 115 promise.then(_ => { 116 // Autoplay started! 117 }).catch(error => { 118 audioToPlay.closest("div.row").insertAdjacentHTML("afterbegin", "<p class='alert'>Lecture automatique interdite par le navigateur, appuyez sur le bouton de lecture pour lancer la piste audio.</p>"); 119 }); 120 } 121 }); 122 123 // Placement des aria uniquement si JS chargé 124 document.querySelectorAll("nav .navbar-nav .nav-item .dropdown-menu").forEach(e => { 125 e.setAttribute("aria-hidden", false); 126 }); 127 document.querySelectorAll("nav .navbar-nav .nav-item .nav-link.dropdown-toggle").forEach(e => { 128 e.setAttribute("aria-haspopup", true); 129 e.setAttribute("aria-expanded", false); 130 }); 131 document.querySelectorAll(".tarteaucitronBTN button, .TACopenPanelBtn").forEach(e => { 132 e.setAttribute("aria-disabled", false); 133 }); 134 135 //Ouverture des menus 136 // Impossible sans jQuery avant Bootstrap 5 137 138 // Prise en charge de la touche "Espace" sur les liens du T1 afin qu'ils respectent leur rôle ARIA "button" 139 document.querySelectorAll('.nav-item [role="button"]').forEach(e => { 140 e.addEventListener("keydown", event => { 141 if(event.keyCode === 32){ 142 event.preventDefault(); 143 e.dispatchEvent(new MouseEvent("click", { 144 bubbles: true, 145 cancelable: true, 146 view: window, 147 })); 148 } 149 }); 150 }); 151 152 // Menu mobile 153 document.querySelectorAll(".navbar-toggler").forEach(e => { 154 e.addEventListener("click", event => { 155 const body = document.body; 156 if (e.classList.contains('collapsed')) { 157 body.classList.add('mobileNavOpen'); 158 if (body.classList.contains('touch')) { 159 /*const navbarNav = document.querySelector(".mobileNavOpen .navbar-nav"); 160 navbarNav.style.height = (window.innerHeight - document.querySelector(".mainHeader").offsetTop) + 'px'; 161 navbarNav.style.paddingBottom = "1.5rem"; 162 navbarNav.scrollTop = 0;*/ 163 /*navbarNav.addEventListener("touchstart", function(t) { 164 this.scrollHeight !== this.clientHeight && (0 === this.scrollTop && (this.scrollTop = 1)); 165 this.scrollTop === this.scrollHeight - this.clientHeight && (this.scrollTop = this.scrollHeight - this.clientHeight - 1); 166 this.allowUp = this.scrollTop > 0; 167 this.allowDown = this.scrollTop < this.scrollHeight - this.clientHeight; 168 this.lastY = t.pageY; 169 }); 170 navbarNav.addEventListener("touchmove", function(t) { 171 var e = t.pageY > this.lastY, 172 n = !e; 173 this.lastY = t.pageY; 174 e && this.allowUp || n && this.allowDown ? t.stopPropagation() : t.preventDefault(); 175 });*/ 176 } 177 } 178 else { 179 /*if (body.classList.contains('touch')) { 180 const navbarNav = document.querySelector(".mobileNavOpen .navbar-nav"); 181 navbarNav.style = ''; 182 }*/ 183 body.classList.remove('mobileNavOpen'); 184 } 185 }); 186 }); 187 // Test 188 //document.body.classList.replace('no-touch', 'touch'); 189 /* ne fonctionne qu'avec jQuery en Bootstrap 4 */ 190 $('#mainNav').on('hide.bs.collapse', function () { 191 const navbarNav = document.querySelector(".navbar-nav"); 192 navbarNav.style = ''; 193 }); 194 $('#mainNav').on('show.bs.collapse', function () { 195 const navbarNav = document.querySelector(".navbar-nav"); 196 navbarNav.style.height = (window.innerHeight - document.querySelector(".mainHeader").offsetTop) + 'px'; 197 navbarNav.style.paddingBottom = "1.5rem"; 198 navbarNav.scrollTop = 0; 199 navbarNav.addEventListener("touchstart", function(t) { 200 this.scrollHeight !== this.clientHeight && (0 === this.scrollTop && (this.scrollTop = 1)); 201 this.scrollTop === this.scrollHeight - this.clientHeight && (this.scrollTop = this.scrollHeight - this.clientHeight - 1); 202 this.allowUp = this.scrollTop > 0; 203 this.allowDown = this.scrollTop < this.scrollHeight - this.clientHeight; 204 this.lastY = t.pageY; 205 }); 206 navbarNav.addEventListener("touchmove", function(t) { 207 var e = t.pageY > this.lastY, 208 n = !e; 209 this.lastY = t.pageY; 210 e && this.allowUp || n && this.allowDown ? t.stopPropagation() : t.preventDefault(); 211 }); 212 }); 213 214 window.addEventListener('resize', function() { 215 const isDropdownOpened = Array.from(this.document.body.classList).some(cls => /^dropdownv\d+open$/.test(cls)); 216 const dropdownCls = Array.from(this.document.body.classList).find(cls => /^dropdownv\d+open$/.test(cls)); 217 218 if(window.matchMedia("(min-width:992px)").matches && document.body.classList.contains("mobileNavOpen")) { 219 document.body.classList.remove('mobileNavOpen'); 220 if(isDropdownOpened) { 221 this.document.body.classList.remove(dropdownCls) 222 const version = /^dropdownv(\d+)open$/.exec(dropdownCls)[1]; 223 $(".nav-item.v" + version + ".show > a").dropdown("toggle"); 224 } 225 $('#mainNav').collapse('hide'); 226 } else if(window.matchMedia("(max-width:991px)").matches && isDropdownOpened && !document.body.classList.contains("mobileNavOpen")) { 227 this.document.body.classList.remove(dropdownCls) 228 const version = /^dropdownv(\d+)open$/.exec(dropdownCls)[1]; 229 $(".nav-item.v" + version + ".show > a").dropdown("toggle"); 230 } else if(window.matchMedia("(max-width:991px)").matches && document.body.classList.contains("mobileNavOpen")) { 231 const navbarNav = document.querySelector(".navbar-nav"); 232 navbarNav.style.height = (window.innerHeight - document.querySelector(".mainHeader").offsetTop) + 'px'; 233 navbarNav.style.paddingBottom = "1.5rem"; 234 } 235 }, false); 236 237 // Detect touch and set touch class in body tag 238 if (('ontouchstart' in window) || 239 (navigator.MaxTouchPoints > 0) || 240 (navigator.msMaxTouchPoints > 0)) { 241 document.body.classList.replace('no-touch', 'touch'); 242 }; 243 244 // Construction du menu de sections (seulement si on est sur ordi) 245 if (!document.body.classList.contains('touch')) { 246 const mainHeader = document.querySelector('#mainHeader'); 247 const sectionNav = document.createElement('nav'); 248 sectionNav.id = "sectionNav"; 249 sectionNav.classList.add("sectionNav", "d-none", "d-sm-block"); 250 sectionNav.role = "navigation"; 251 sectionNav.setAttribute('aria-labelledby', 'sectionNavLabel'); 252 sectionNav.setAttribute('tabindex', '-1'); 253 sectionNav.insertAdjacentHTML('beforeend', '<h2 class="sr-only" id="sectionNavLabel">Naviguer dans la page</h2>'); 254 const sectionNavList = sectionNav.appendChild(document.createElement("ul")); 255 sectionNavList.classList.add("nav"); 256 // URL de la page sans l'ancre éventuelle 257 let documentURL = ''; // ? cette variable reste toujours vide (Seb) 258 259 // Ajout d'un tabindex="-1" sur le body pour que le lien d'évitement fonctionne et que le focus de tabulation reprenne du haut de la page 260 document.body.tabIndex = "-1"; 261 const backToTop = '<li><a href="' + documentURL + '#top" class="nav-link smoothScroll backToTop active" data-target="#top" aria-labelledby="backToTop-sectionNav-title"><span class="fas fa-angle-up"></span><span class="title" id="backToTop-sectionNav-title">Retour en haut de page</span></a></li>'; 262 sectionNavList.insertAdjacentHTML('beforeend', backToTop); 263 264 document.querySelectorAll("[data-rvvnsn='1']").forEach((e) => { 265 // Ajout d'un tabindex="-1" sur la cible pour que le lien d'évitement fonctionne et que le focus de tabulation reprenne depuis l'élément ciblé 266 e.tabIndex = "-1"; 267 let type = e.dataset.rvvnctype, title = e.dataset.rvvntitle, iconType = ""; 268 switch (type) { 269 case "textpic": 270 iconType = "fas fa-align-justify"; 271 e.querySelectorAll("h1, h2").forEach((h, i) => { // ? pourquoi on prend les h1 ? (Seb) 272 title = h.textContent.trim(); 273 h.setAttribute("id", e.getAttribute("id") + "-" + i); 274 // Ajout d'un tabindex="-1" sur la cible pour que le lien d'évitement fonctionne et que le focus de tabulation reprenne depuis l'élément ciblé 275 h.tabIndex = "-1"; 276 277 switch (h.tagName) { 278 case "H1": 279 type = "textH1SN"; 280 iconType = "fas fa-align-justify"; 281 break; 282 case "H2": 283 type = "textH2SN"; 284 iconType = "fas fa-align-justify"; 285 break; 286 } 287 if (title && title.length > 0) { 288 sectionNavList.insertAdjacentHTML('beforeend', '<li><a href="' + documentURL + '#' + h.getAttribute("id") + '" class="nav-link smoothScroll ' + type + '" data-target="#' + h.getAttribute("id") + '" aria-labelledby="' + h.getAttribute("id") + '-sectionNav-title"><span class="' + iconType + '"></span><span class="title" id="' + h.getAttribute("id") + '-sectionNav-title">' + title + '</span></a></li>'); 289 title = ""; 290 } 291 }); 292 break; 293 case "columns": 294 iconType = "fas fa-align-justify"; 295 break; 296 case "actus": 297 case "newsCarrousel": 298 case "carousel": 299 iconType = "fas fa-rss"; 300 break; 301 case "agenda": 302 iconType = "far fa-calendar-alt"; 303 break; 304 case "photoStory": 305 iconType = "fas fa-camera"; 306 break; 307 case "publication": 308 iconType = "far fa-file-alt"; 309 break; 310 case "newspaper": 311 iconType = "far fa-newspaper"; 312 break; 313 case "testimony": 314 iconType = "fas fa-comments"; 315 break; 316 case "slideshow": 317 iconType = "far fa-image"; 318 break; 319 case "countdown": 320 iconType = "fas fa-hourglass-half"; 321 break; 322 case "map": 323 iconType = "fas fa-map-marker-alt"; 324 break; 325 case "meteo": 326 iconType = "fas fa-cloud"; 327 break; 328 case "presParallax": 329 iconType = "fas fa-bullhorn"; 330 break; 331 case "summary": 332 iconType = "fas fa-sitemap"; 333 break; 334 case "recherche": 335 iconType = "fas fa-search"; 336 break; 337 case "shortcuts": 338 iconType = "fas fa-star"; 339 break; 340 case "audio": 341 iconType = "fa-solid fa-volume-high"; 342 break; 343 case "video": 344 iconType = "fas fa-film"; 345 break; 346 case "socialnetworks": 347 iconType = "fas fa-share-alt"; 348 break; 349 case "form": 350 iconType = "far fa-edit"; 351 break; 352 } 353 if (title && title.length > 0) { 354 sectionNavList.insertAdjacentHTML('beforeend', '<li><a href="' + documentURL + '#' + e.getAttribute("id") + '" class="nav-link smoothScroll ' + type + '" data-target="#' + e.getAttribute("id") + '" aria-labelledby="' + e.getAttribute("id") + '-sectionNav-title"><span class="' + iconType + '"></span><span class="title" id="' + e.getAttribute("id") + '-sectionNav-title">' + title + '</span></a></li>'); 355 title = ""; 356 } 357 if (type === "agenda") { 358 e.querySelectorAll(".timeline article .title").forEach((t, i) => { 359 iconType = "fas fa-calendar-day"; 360 let articleTitle = t.textContent.trim(); 361 const id = e.getAttribute("id") + "-" + i; 362 t.closest("article").setAttribute("id", id); 363 364 if (articleTitle && articleTitle.length > 0) { 365 sectionNavList.insertAdjacentHTML('beforeend', '<li><a href="' + documentURL + '#' + id + '" class="nav-link smoothScroll ' + type + ' event" data-target="#' + id + '" aria-labelledby="' + id + '-sectionNav-title"><span class="' + iconType + '"></span><span class="title" id="' + id + '-sectionNav-title">' + articleTitle + '</span></a></li>'); 366 articleTitle = ""; 367 } 368 }); 369 } 370 }); 371 372 sectionNavList.insertAdjacentHTML('beforeend', '<li><a href="' + documentURL + '#contact" class="nav-link smoothScroll contact" data-target="#contact" aria-labelledby="contact-sectionNav-title"><span class="fas fa-paper-plane"></span><span class="title" id="contact-sectionNav-title">Coordonnées & Contacts</span></a></li>'); 373 mainHeader.appendChild(sectionNav); 374 375 document.body.setAttribute("data-spy", "scroll"); 376
376 document.body.setAttribute("data-offset", 85); 377 document.body.setAttribute("data-target", '#sectionNav'); 378 379 sectionNav.querySelectorAll("a").forEach(a => { 380 a.addEventListener("keyup", (event) => { 381 if(event.code == "Escape" || event.key == "Escape") { 382 event.target.querySelector(".title").hidden = true; 383 } 384 }); 385 a.addEventListener("blur", (event) => { 386 event.target.querySelector(".title").hidden = false; 387 }); 388 }); 389 } 390 391 // Smooth Scroll 392 // depuis une autre page 393 if (window.location.hash) { 394 scrollToAnchor(window.location.hash, false); 395 } 396 // depuis la page 397 document.querySelectorAll("a[href*='#']:not([href='#'])").forEach(e => { 398 e.addEventListener("click", (event) => { 399 if (location.pathname.replace(/^\//, '') == e.pathname.replace(/^\//, '') && location.hostname == e.hostname && !e.classList.contains('noScroll')) { 400 event.preventDefault(); // ne pas ajouter le #xxx à l'url 401 let offset = 80; 402 if (e.classList.contains('event')) { 403 offset = 105; 404 } 405 if (e.classList.contains('skipLink') && e.hash != "#contenu") { 406 offset = 240; 407 } 408 scrollToAnchor(e.hash, offset); 409 } 410 }); 411 }); 412 413 function scrollToAnchor(hash, offset = 80) { 414 let target = document.querySelector(hash); 415 target ??= document.querySelector('[name=' + hash.slice(1) + ']'); 416 if (target) { 417 if (target.dataset.rvvnctype == "form") { 418 offset = 140; 419 } 420 const rect = target.getBoundingClientRect(); 421 const toTarget = rect.top + document.documentElement.scrollTop - offset; 422 const animateScrollTo = (to, duration) => { 423 const element = document.scrollingElement || document.documentElement; 424 const start = element.scrollTop; 425 const change = to - start; 426 const startDate = + new Date(); 427 // t = current time 428 // b = start value 429 // c = change in value 430 // d = duration 431 const easeInOutQuad = (t, b, c, d) => { 432 let t2 = t; 433 t2 /= d / 2; 434 if (t2 < 1) return (c / 2) * t2 * t2 + b; 435 t2 -= 1; 436 return (-c / 2) * (t2 * (t2 - 2) - 1) + b; 437 }; 438 const animateScroll = () => { 439 const currentDate = +new Date(); 440 const currentTime = currentDate - startDate; 441 element.scrollTop = parseInt(easeInOutQuad(currentTime, start, change, duration), 10); 442 if (currentTime < duration) { 443 requestAnimationFrame(animateScroll); 444 } else { 445 element.scrollTop = to; 446 } 447 }; 448 animateScroll(); 449 target.focus(); 450 }; 451 animateScrollTo(toTarget, 1000); 452 453 return false; 454 } 455 } 456 457 // Sharing Modals 458 document.querySelectorAll("#socialshare, #modalNewsDetail .modal-body").forEach(e => { 459 e.addEventListener("click", (event) => { 460 let link = event.target.closest(".sharelink a"); 461 if (link) { 462 const network = link.dataset.network; 463 if (network == "whatsapp" || network == "sms" || (network == "bluesky" && !document.body.classList.contains('touch'))) { 464 return true; 465 } 466 event.preventDefault(); 467 const href = link.getAttribute('href'); 468 if (network == "bluesky") { 469 const blueskyMobileHref = href.replace("https://bsky.app/", "bluesky://"); 470 window.open(blueskyMobileHref); 471 return true; 472 } 473 const networks = { 474 facebook: { 475 width: 600, 476 height: 300 477 }, 478 x: { 479 width: 600, 480 height: 254 481 }, 482 linkedin: { 483 width: 600, 484 height: 473 485 } 486 }; 487 const popup = function(network) { 488 const options = 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,'; 489 window.open(href, '', options + 'height=' + networks[network].height + ',width=' + networks[network].width); 490 } 491 popup(network); 492 } 493 }); 494 }); 495 496 // Bouton panneau Tarte au Citron dans le pied de page + page sur la protection des données personnelles 497 document.querySelectorAll(".TACopenPanelBtn, .tarteaucitronBTN .btn").forEach(e => { 498 e.addEventListener("click", event => { 499 event.preventDefault(); 500 event.stopPropagation();
501 tarteaucitron.userInterface.openPanel(); 502 }); 503 }); 504 505 // Tooltips des boutons de partage (impossible sans jQuery avant Bootstrap 5) 506 // voir section Jquery ci-après 507}); 508 509$(document).ready(function() { 510 511 // Nécessaire depuis l'abandon de Modernizr 512 //$('html').removeClass('no-js').addClass('js'); 513 514 // Carrousel v3 515 // Ajout des classes invert et carouselv3 ssi premier contenu 516 /*if ($('#contenu>section.partialcarouselv3:first-child').length) { 517 $('#socialshare').addClass("invert carouselv3"); 518 }*/ 519 520 // Contenus audio 521 // Lancement de la lecture automatique si configuré 522 // Insertion d'un message d'erreur si le navigateur ne l'autorise pas 523 /*$("section.audio.autoplay audio").each(function(i, audioToPlay) { 524 //console.log("Lecteur trouvé : "+audioToPlay.id); 525 var promise = audioToPlay.play(); 526 if (promise !== undefined) { 527 promise.then(_ => { 528 // Autoplay started! 529 }).catch(error => { 530 $(audioToPlay).closest('div.row').prepend("<p class='alert'>Lecture automatique interdite par le navigateur, appuyez sur le bouton de lecture pour lancer la piste audio.</p>"); 531 }); 532 } 533 });*/ 534 535 // Ajout de la class top sur le body 536 /* 537 var scrollPos = 0; 538 var ticking = false; 539 var body = $('body'); 540 window.addEventListener('scroll', function(e) { 541 scrollPos = window.scrollY; 542 if (!ticking) { 543 window.requestAnimationFrame(function() { 544 if(scrollPos == 0){ 545 body.addClass('top'); 546 } else { 547 if(body.hasClass('top')) { 548 body.removeClass('top'); 549 } 550 } 551 ticking = false; 552 }); 553 } 554 ticking = true; 555 }); 556 */ 557 558 //Ouverture des menus 559 $('#mainNav').on('show.bs.dropdown', function(e) { 560 let version = 0; 561 if ($(e.target).attr("class").length > 0) { 562 version = $(e.target).attr("class").split(" "); 563 version = version[2]; 564 $('body').addClass('dropdown' + version + 'open'); 565 } 566 if(!document.body.classList.contains("mobileNavOpen")) { 567 $('#megamenuOverlay').addClass('open'); 568 } 569 }); 570 $('#mainNav').on('hide.bs.dropdown', function(e) { 571 if (!$(this).hasClass('in')) { 572 if ($(e.target).attr("class").length > 0) { 573 version = $(e.target).attr("class").split(" "); 574 version = version[2]; 575 $('body').removeClass('dropdown' + version + 'open'); 576 } 577 $('#megamenuOverlay').removeClass('open'); 578 } 579 }); 580 581 /*/menu mobile 582 $('.navbar-toggler').click(function() { 583 if ($(this).hasClass('collapsed')) { 584 var body = $('body'); 585 body.addClass('mobileNavOpen'); 586 if (body.hasClass('touch')) { 587 var navbarNav = $(".mobileNavOpen .navbar-nav"); 588 navbarNav.height(window.innerHeight - ($(".mainHeader").position().top)); 589 navbarNav.css("padding-bottom", "1.5rem"); 590 navbarNav.get(0).scrollTop = 0; 591 $(document).on("touchmove", function(t) { 592 t.preventDefault(); 593 }); 594 $(document).on("touchstart", ".mobileNavOpen .navbar-nav", function(t) { 595 this.scrollHeight !== this.clientHeight && (0 === this.scrollTop && (this.scrollTop = 1)); 596 this.scrollTop === this.scrollHeight - this.clientHeight && (this.scrollTop = this.scrollHeight - this.clientHeight - 1); 597 this.allowUp = this.scrollTop > 0; 598 this.allowDown = this.scrollTop < this.scrollHeight - this.clientHeight; 599 this.lastY = t.pageY; 600 }); 601 $(document).on("touchmove", ".mobileNavOpen .navbar-nav", function(t) { 602 var e = event.pageY > this.lastY, 603 n = !e; 604 this.lastY = event.pageY; 605 e && this.allowUp || n && this.allowDown ? t.stopPropagation() : t.preventDefault(); 606 }); 607 } 608 } else { 609 $('body').removeClass('mobileNavOpen'); 610 $(document).off("touchstart touchmove"); 611 } 612 });*/ 613 614 //detect touch and set touch class in body tag 615 /*if (('ontouchstart' in window) || 616 (navigator.MaxTouchPoints > 0) || 617 (navigator.msMaxTouchPoints > 0)) { 618 $('body').removeClass('no-touch').addClass('touch'); 619 }*/ 620 621 /*/ Construction du menu de sections (seulement si on est sur ordi) 622 if (!$('body').hasClass('touch')) { 623 624 var sectionNav = $('#sectionNav'); 625 sectionNav.append('<ul class="nav" />'); 626 // URL de la page sans l'ancre éventuelle 627 var documentURL = ''; 628 if ($('body.inside').length > 0) { 629 var backToTop = '<li><a href="' + documentURL + '#top" class="nav-link smoothScroll backToTop active" data-target="#top"><span class="fas fa-angle-up"></span><span class="title">Retour en haut de page</span></a></li>'; 630 sectionNav.children('ul').append(backToTop); 631 } 632 633 $("[data-rvvnsn='1']").each(function(i, e) { 634 var type = $(e).attr("data-rvvnctype"); 635 var title = $(e).attr("data-rvvntitle"); 636 var iconType = ""; 637 switch (type) { 638 case "textpic": 639 iconType = "fas fa-align-justify"; 640 $("h1,h2", e).each(function(j, f) { 641 title = $.trim($(f).text()); 642 643 $(f).attr("id", $(e).attr("id") + "-" + j); 644 645 switch ($(f)[0].tagName) { 646 case "H1": 647 type = "textH1SN"; 648 iconType = "fas fa-align-justify"; 649 break; 650 case "H2": 651 type = "textH2SN"; 652 iconType = "fas fa-align-justify"; 653 break; 654 } 655 if (title && title.length > 0) { 656 sectionNav.children('ul').append('<li><a href="' + documentURL + '#' + $(f).attr("id") + '" class="nav-link smoothScroll ' + type + '" data-target="#' + $(f).attr("id") + '"><span class="' + iconType + '"></span><span class="title">' + title + '</span></a></li>'); 657 title = ""; 658 } 659 }); 660 break; 661 case "columns": 662 iconType = "fas fa-align-justify"; 663 break; 664 case "actus": 665 case "newsCarrousel": 666 case "carousel": 667 iconType = "fas fa-rss"; 668 break; 669 case "agenda": 670 iconType = "far fa-calendar-alt"; 671 break; 672 case "photoStory": 673 iconType = "fas fa-camera"; 674 break; 675 case "publication": 676 iconType = "far fa-file-alt"; 677 break; 678 case "newspaper": 679 iconType = "far fa-newspaper"; 680 break; 681 case "testimony": 682 iconType = "fas fa-comments"; 683 break; 684 case "slideshow": 685 iconType = "far fa-image"; 686 break; 687 case "countdown": 688 iconType = "fas fa-hourglass-half"; 689 break; 690 case "map": 691 iconType = "fas fa-map-marker-alt"; 692 break; 693 case "meteo": 694 iconType = "fas fa-cloud"; 695 break; 696 case "presParallax": 697 iconType = "fas fa-bullhorn"; 698 break; 699 case "summary": 700 iconType = "fas fa-sitemap"; 701 break; 702 case "recherche": 703 iconType = "fas fa-search"; 704 break; 705 case "shortcuts": 706 iconType = "fas fa-star"; 707 break; 708 case "audio": 709 iconType = "fa-solid fa-volume-high"; 710 break; 711 case "video": 712 iconType = "fas fa-film"; 713 break; 714 case "socialnetworks": 715 iconType = "fas fa-share-alt"; 716 break; 717 case "form": 718 iconType = "far fa-edit"; 719 break; 720 } 721 if (title && title.length > 0) { 722 sectionNav.children('ul').append('<li><a href="' + documentURL + '#' + $(e).attr("id") + '" class="nav-link smoothScroll ' + type + '" data-target="#' + $(e).attr("id") + '"><span class="' + iconType + '"></span><span class="title">' + title + '</span></a></li>'); 723 title = ""; 724 } 725 if (type === "agenda") { 726 $(".timeline article .title", e).each(function(j, f) { 727 iconType = "fas fa-calendar-day"; 728 var articleTitle = $.trim($(f).text()); 729 var id = $(e).attr("id") + "-" + j; 730 $(f).parents("article").attr("id", id); 731 732 if (articleTitle && articleTitle.length > 0) { 733 sectionNav.children('ul').append('<li><a href="' + documentURL + '#' + id + '" class="nav-link smoothScroll ' + type + ' event" data-target="#' + id + '"><span class="' + iconType + '"></span><span class="title">' + articleTitle + '</span></a></li>'); 734 articleTitle = ""; 735 } 736 }); 737 } 738 }); 739 740 var contact = '<li><a href="' + documentURL + '#contact" class="nav-link smoothScroll contact" data-target="#contact"><span class="fas fa-paper-plane"></span><span class="title">Coordonnées & Contacts</span></a></li>'; 741 sectionNav.children('ul').append(contact); 742 743 // ScrollSpy 744 $('body').scrollspy({ 745 offset: 85, 746 target: '#sectionNav' 747 }); 748 }*/ 749 750 // Smooth Scroll 751 /*/ depuis une autre page 752 if (window.location.hash) { 753 scrollToAnchor(window.location.hash, false); 754 }*/ 755 /*/ depuis la page 756 $(function() { 757 $('a[href*=\'#\']:not([href=\'#\'])').click(function(event) {
758 if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname && !this.classList.contains('noScroll')) { 759 event.preventDefault(); // ne pas ajouter le #xxx à l'url 760 scrollToAnchor(this.hash, this.classList.contains('event')); 761 } 762 }); 763 }); 764 765 function scrollToAnchor(hash, isEvent) { 766 var target = $(hash); 767 target = target.length ? target : $('[name=' + hash.slice(1) + ']'); 768 if (target.length) { 769 var index = 80; 770 if (isEvent) { 771 index = 105; 772 } 773 if (target[0].tagName == "FORM") { 774 index = 140; 775 } 776 var toTarget = target.offset().top - index; 777 $('html,body').animate({ 778 scrollTop: toTarget 779 }, 1000); 780 return false; 781 } 782 }*/ 783 784 /*/ Modals 785 $('.sharelink a').on('click', function(e) { 786 var $link = $(this); 787 var href = $link.attr('href'); 788 var network = $link.attr('data-network'); 789 if (network == "whatsapp" || network == "sms") { 790 return true; 791 } 792 e.preventDefault(); 793 794 var networks = { 795 facebook: { 796 width: 600, 797 height: 300 798 }, 799 x: { 800 width: 600, 801 height: 254 802 }, 803 linkedin: { 804 width: 600, 805 height: 473 806 } 807 }; 808 var popup = function(network) { 809 var options = 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,'; 810 window.open(href, '', options + 'height=' + networks[network].height + ',width=' + networks[network].width); 811 } 812 popup(network); 813 }); 814 */ 815 816 // Tooltips des boutons de partage 817 $('#socialshare [data-toggle="tooltip"]').tooltip({ 818 title: function() { 819 return $(this).attr("aria-label"); 820 } 821 }); 822});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.