1document.addEventListener("DOMContentLoaded", function(){ 2 // NAVIGATION 3 var ToggleMenuElems = document.getElementsByClassName("navbar-toggle"); 4 Array.from(ToggleMenuElems).forEach(function(e) { 5 e.addEventListener("click", function() { 6 let target = e.dataset.target; 7 if (target) { 8 if(document.querySelector(target).classList.contains('sd-opened')) 9 closeNav(target); 10 else 11 openNav(target); 12 } 13 }) 14 }); 15 document.querySelectorAll(".navbar-close").forEach( elm => { 16 elm.addEventListener("click", function() { 17 closeNav("#" + elm.closest(".sidenav").id); 18 }); 19 }); 20 21 document.querySelectorAll(".sidenav").forEach( elm => { 22 elm.addEventListener("click", function(e) { 23 if (elm.classList.contains('sd-opened') && e.target.classList.contains(elm.classList[0])) { 24 closeNav("#" + elm.id); 25 } 26 }); 27 }); 28 29 const expandergo = document.querySelectorAll(".expander-go"); 30 expandergo.forEach(item => { 31 item.addEventListener('click', function (e) { 32 item.classList.toggle("expendable"); 33 }); 34 }); 35 36 function openNav(nav) { 37 let sidenavOpened = document.querySelectorAll(".sd-opened"); 38 sidenavOpened.forEach(elm => { 39 closeNav("#" + elm.id); 40 }); 41 let sidenav = document.querySelector(nav); 42 sidenav.style.transform = "translateX(0px)"; 43 sidenav.classList.add("sd-opened"); 44 if(window.matchMedia("(max-width: 575px)").matches) 45 document.documentElement.style.overflowY = "hidden"; 46 } 47 function closeNav(nav) { 48 let sidenav = document.querySelector(nav); 49 let direction = sidenav.classList.contains("sidenav-right") ? "translateX(100%)" : "translateX(-100%)"; 50 sidenav.style.transform = direction; 51 sidenav.classList.remove("sd-opened"); 52 document.documentElement.style.overflowY = "auto"; 53 } 54 function offset(el) { 55 var rect = el.getBoundingClientRect(), 56 scrollLeft = window.pageXOffset || document.documentElement.scrollLeft, 57 scrollTop = window.pageYOffset || document.documentElement.scrollTop; 58 return { top: rect.top + scrollTop, left: rect.left + scrollLeft } 59 } 60 var NavContainer = document.querySelector("[id=tool_header]"); 61 var NavTabs = NavContainer.querySelectorAll("[data-tab]"); 62 Array.from(NavTabs).forEach(function(e) { 63 e.addEventListener("click", function() { 64 var child_id = e.getAttribute("data-tab"), 65 child_tag = NavContainer.querySelector("[id=".concat(child_id, "]")); 66 toggleActiveTab(e, child_tag); 67 }) 68 }) 69 function toggleActiveTab(t, e) { 70 var activeElements = NavContainer.getElementsByClassName("active"); 71 t.classList.contains("active") ? (t.classList.remove("active"), t.setAttribute("aria-expanded", !1), e.classList.remove("active")) : (Array.from(activeElements).forEach(function(a) { 72 a.classList.remove("active"), a.setAttribute("aria-expanded", !1) 73 }), t.classList.add("active"), t.setAttribute("aria-expanded", !0), e.classList.add("active")); 74 if(e.classList.contains("active") && !e.classList.contains("scrollisset")){ 75 set_subnavscroll_width(e); 76 } 77 } 78 79 function set_subnavscroll_width(el){ 80 w_tool = document.querySelector("#tool_header>.ctn_ext").offsetWidth; 81 w_el = el.querySelector(".subnav_expandable").offsetWidth; 82 if (w_el == 0) { 83 w_el = el.offsetWidth; 84 } 85 if (w_el > (w_tool - 40)) { 86 el.querySelectorAll(".subnav_btn").forEach(e => { 87 e.classList.remove("disp-none"); 88 }); 89 } 90 el.classList.add("scrollisset"); 91 } 92 93 document.querySelectorAll(".dropd_subnav").forEach(function(el) { 94 if(el.classList.contains("active")){ 95 set_subnavscroll_width(el); 96 } 97 }); 98 99 100 var NavContainer_footer = document.querySelector("[id=footer_mobile_home]"); 101 if(NavContainer_footer !== null) { 102 var NavTabs_footer = NavContainer_footer.querySelectorAll("[data-tab]"); 103 Array.from(NavTabs_footer).forEach(function(e) { 104 e.addEventListener("click", function() { 105 var child_id = e.getAttribute("data-tab"), 106 child_tag = NavContainer_footer.querySelector("[id=".concat(child_id, "]")); 107 toggleActiveTab_footer(e, child_tag); 108 }) 109 }) 110 } 111 function toggleActiveTab_footer(t, e) { 112 var activeElements = NavContainer_footer.getElementsByClassName("active"); 113 t.classList.contains("active") ? (t.classList.remove("active"), t.setAttribute("aria-expanded", !1), e.classList.remove("active")) : (Array.from(activeElements).forEac
113h(function(a) { 114 a.classList.remove("active"), a.setAttribute("aria-expanded", !1) 115 }), t.classList.add("active"), t.setAttribute("aria-expanded", !0), e.classList.add("active")); 116 } 117 118 window.onclick = function(event) { 119 if (!event.target.hasAttribute('data-tab') && !event.target.parentElement.hasAttribute('data-tab')) { 120 if(NavContainer_footer !== null) { 121 var activeElements = NavContainer_footer.getElementsByClassName("active"); 122 Array.from(activeElements).forEach(function(a) { 123 a.classList.remove("active"), a.setAttribute("aria-expanded", !1) 124 }); 125 } 126 } 127 } 128 129 // MODALE 130 const detectRobot = (userAgent) => { 131 const robots = new RegExp([ 132 /bot/,/spider/,/crawl/, 133 /APIs-Google/,/AdsBot/,/Googlebot/, 134 /mediapartners/,/Google Favicon/, 135 /FeedFetcher/,/Google-Read-Aloud/, 136 /DuplexWeb-Google/,/googleweblight/, 137 /bing/,/yandex/,/baidu/,/duckduck/,/yahoo/, 138 /ecosia/,/ia_archiver/, 139 /facebook/,/instagram/,/pinterest/,/reddit/, 140 /slack/,/twitter/,/whatsapp/,/youtube/, 141 /semrush/, 142 ].map((r) => r.source).join("|"),"i"); 143 return robots.test(userAgent); 144 }; 145 const isRobot = detectRobot(navigator.userAgent); 146 var modal = document.getElementById("modal-inscription"); 147 var btn = document.querySelectorAll("[data-modal='btn-connexion']"); 148 var span = document.getElementsByClassName("close")[0]; 149 var fermerBtn = document.querySelector(".btn-fermer"); 150 var modal_ppin = document.getElementById("start_poppin"); 151 for(var i = 0; i < btn.length; i++){ 152 btn[i].onclick = function(e) { 153 modal.style.display = "block"; 154 } 155 btn[i].oninput = function(e) { 156 e.preventDefault(); 157 modal.style.display = "block"; 158 } 159 } 160 span.onclick = function() { 161 modal.style.display = "none"; 162 } 163 fermerBtn.onclick = function() { 164 modal.style.display = "none"; 165 } 166 window.onclick = function(event) { 167 if (event.target == modal) { 168 modal.style.display = "none"; 169 } 170 } 171 if(modal_ppin){ 172 var close_ppin = document.getElementById("close_poppin"); 173 close_ppin.onclick = function() { 174 modal_ppin.style.display = "none"; 175 } 176 if(isRobot == null || !isRobot) { 177 window.onload = function(){ 178 setTimeout(loadAfterTime, 0) 179 }; 180 } 181 function loadAfterTime() { 182 modal_ppin.style.display = "block"; 183 } 184 } 185 186 // Scroll sticky header && progress article 187 var initialScrollEvent = true; 188 var sticky = document.getElementById("tool_header").offsetTop; 189 var pourcent_reading = 0; 190 window.onscroll = function() {stickyControl();if(!initialScrollEvent && document.getElementById('texte_article') && document.getElementById('sticky_footer_article')){read_progress();}initialScrollEvent = false;}; 191 function stickyControl() { 192 if (window.pageYOffset > sticky) { 193 document.getElementById("header_container").classList.add("sticky"); 194 document.body.classList.add("mt_nav"); 195 document.getElementById("tool_header").classList.add("first_plan"); 196 } else { 197 document.getElementById("header_container").classList.remove("sticky"); 198 document.body.classList.remove("mt_nav"); 199 document.getElementById("tool_header").classList.remove("first_plan"); 200 } 201 } 202 function read_progress() { 203 var article_height_max=document.getElementById('texte_article').clientHeight - (window.innerHeight - offset(document.getElementById('texte_article')).top - (document.getElementById('sticky_footer_article').clientHeight-10)); 204 var scroll_level=window.pageYOffset; 205 if(scroll_level<article_height_max || pourcent_reading<100) { 206 pourcent_reading = Math.round(scroll_level*100/article_height_max); 207 if(pourcent_reading>100) 208 pourcent_reading=100; 209 document.getElementById('progress_indice').style.transform = "translate3d("+pourcent_reading+"%, 0px, 0px)"; 210 } 211 } 212 213 // NATIVE SLIDER 214 const carousel = document.querySelectorAll(".native-slider-ctn"); 215 carousel.forEach(item => { 216 initCarrousel(item); 217 }); 218 219 // TAGS HEADER 220 const slider = document.querySelector('.ecm_items'); 221 if(slider) { 222 let isDown = false; 223 let startX; 224 let scrollLeft; 225 226 slider.addEventListener('mousedown', (e) => { 227 isDown = true; 228 slider.classList.add('active'); 229 startX = e.pageX - slider.offsetLeft; 230 scrollLeft = slider.scrollLeft; 231 }); 232 slider.addEventListener('mouseleave', () => { 233 isDown = false;
234 slider.classList.remove('active'); 235 }); 236 slider.addEventListener('mouseup', () => { 237 isDown = false; 238 slider.classList.remove('active'); 239 }); 240 slider.addEventListener('mousemove', (e) => { 241 if(!isDown) return; 242 e.preventDefault(); 243 const x = e.pageX - slider.offsetLeft; 244 const walk = (x - startX) * 1; //scroll-fast 245 slider.scrollLeft = scrollLeft - walk; 246 }); 247 } 248 249 // POPIN JS RS 250 const icone_rs = document.querySelectorAll('.icone_rs'); 251 if(icone_rs){ 252 const carte_rs = document.querySelectorAll('.carte_rs'); 253 icone_rs.forEach(el => el.addEventListener('click', function(e){ 254 carte_rs.forEach((element) => element.classList.add("disp-none")); 255 el.nextElementSibling.classList.remove("disp-none"); 256 })); 257 document.getElementById("ft-container").addEventListener('click', function(elm){ 258 if(!elm.srcElement.classList.contains("icone_rs")){ 259 carte_rs.forEach((element) => element.classList.add("disp-none")); 260 } 261 }); 262 } 263 264 // SLIDER PA 265 266 if(document.getElementById("pa--carrousel")){ 267 const slidesContainer = document.querySelector('.slides'); 268 if(slidesContainer) { 269 const slides = document.querySelectorAll('.slide'); 270 const controls = document.querySelectorAll('.control'); 271 272 let currentSlide = 0; 273 274 const nextSlide = () => { 275 currentSlide = (currentSlide + 1) % slides.length; 276 277 controls.forEach(control => control.classList.remove('current')); 278 controls[currentSlide].classList.add('current'); 279 //alert(currentSlide); 280
281 slides.forEach(slide => slide.classList.remove('current')); 282 slides[currentSlide].classList.add('current'); 283 284 slidesContainer.style.transform = `translateX(-${currentSlide * 300}px)`; 285 }; 286 287 let autoSlide = setInterval(nextSlide, 3200); 288 289 slidesContainer.addEventListener('mouseenter', () => { 290 clearInterval(autoSlide); 291 }); 292 293 slidesContainer.addEventListener('mouseleave', () => { 294 autoSlide = setInterval(nextSlide, 3200); 295 }); 296 297 controls.forEach(control => { 298 control.addEventListener('click', function() { 299 clearInterval(autoSlide); 300 currentSlide = Number(this.getAttribute('data-slide')); 301 302 controls.forEach(control => control.classList.remove('current')); 303 this.classList.add('current'); 304 305 slides.forEach(slide => slide.classList.remove('current')); 306 slides[currentSlide].classList.add('current'); 307 308 slidesContainer.style.transform = `translateX(-${currentSlide * 300}px)`; 309 autoSlide = setInterval(nextSlide, 3200); 310 }); 311 }); 312 } 313 } 314 315 if (document.querySelector("#flash_rub")) { 316 document.querySelector("#flash_rub").addEventListener('change', function(e) { 317 var data = new FormData(); 318 data.append("cat_n", this.value); 319 fetch('ajax/flash_news.php', { 320 method: 'POST', 321 body: data 322 }).then(response => response.text()).then(content_result => { 323 document.querySelector("#flash_news").innerHTML = content_result; 324 }); 325 }); 326 } 327 328 document.querySelectorAll(".subnav_btn_rwd").forEach(item_btn => { 329 item_btn.addEventListener('click', function(e) { 330 a = this.nextElementSibling.scrollLeft; 331 this.nextElementSibling.scrollLeft = a - 200; 332 }); 333 }); 334 335 document.querySelectorAll(".subnav_btn_fwd").forEach(item_btn => { 336 item_btn.addEventListener('click', function(e) { 337 a = this.previousElementSibling.scrollLeft; 338 this.previousElementSibling.scrollLeft = a + 200; 339 }); 340 }); 341 342 if (document.querySelector("#sticky-player .close-btn")) { 343 document.querySelector("#sticky-player .close-btn").addEventListener('click', function(e) { 344 document.querySelector("body").classList.remove("sticky-player-mode"); 345 document.cookie = 'sp-hide=1; path=/'; 346 }); 347 } 348 349}); 350 351function initCarrousel(item) { 352 let init_nbshown = item.parentElement.getAttribute("data-nb-shown"); 353 let init_nbshownxs = !item.parentElement.hasAttribute("data-nb-shown-xs") ? null : item.parentElement.getAttribute("data-nb-shown-xs"); 354 let init_nbshownsm = !item.parentElement.hasAttribute("data-nb-shown-sm") ? null : item.parentElement.getAttribute("data-nb-shown-sm"); 355 let init_nbshownmd = !item.parentElement.hasAttribute("data-nb-shown-md") ? null : item.parentElement.getAttribute("data-nb-shown-md"); 356 let init_nbshownlg = !item.parentElement.hasAttribute("data-nb-shown-lg") ? null : item.parentElement.getAttribute("data-nb-shown-lg"); 357 let init_gap = item.parentElement.getAttribute("data-gap"); 358 let nb_child = item.childElementCount; 359 360 361 let can_load = init_nbshown == 0 ? false : true; 362 363 if(window.matchMedia("(max-width: 575px)").matches && init_nbshownxs !== null && init_nbshownxs != init_nbshown) { 364 init_nbshown = init_nbshownxs; 365 can_load = init_nbshownxs == 0 ? false : true; 366 } 367 if(window.matchMedia("(min-width: 576px)").matches && init_nbshownsm !== null && init_nbshownsm != init_nbshown) { 368 init_nbshown = init_nbshownsm; 369 can_load = init_nbshownsm == 0 ? false : true; 370 } 371 if(window.matchMedia("(min-width: 768px)").matches && init_nbshownmd !== null && init_nbshownmd != init_nbshown) { 372 init_nbshown = init_nbshownmd; 373 can_load = init_nbshownmd == 0 ? false : true; 374 } 375 if(window.matchMedia("(min-width: 992px)").matches && init_nbshownlg !== null && init_nbshownlg != init_nbshown) { 376 init_nbshown = init_nbshownlg; 377 can_load = init_nbshownlg == 0 ? false : true; 378 } 379 380 if(can_load) { 381 item.parentElement.style.setProperty("--nativeslider-gap", init_gap + "px"); 382 item.parentElement.style.setProperty("--nativeslider-nbshown", init_nbshown); 383 384 if(nb_child > init_nbshown) { 385 let btn_cmd_string = "<div class=\"native-slider-cmd\"> \ 386 <button class=\"btn_prev\" aria-label=\"Précédent\" disabled=\"true\"> \ 387 <span class=\"icon_prev\"></span> \ 388 </button> \
389 <button class=\"btn_next\" aria-label=\"Suivant\"> \ 390 <span></span> \ 391 </button> \ 392 </div>"; 393 394 item.insertAdjacentHTML('afterend', btn_cmd_string); 395 396 if (init_nbshown == 1) { 397 item.parentElement.style.setProperty("--nativeslider-separator", "0px"); 398 } 399 400 let btn_cmd = item.nextElementSibling.querySelectorAll("button"); 401 btn_cmd.forEach(item_btn => { 402 item_btn.addEventListener('click', function (e) { 403 let nb_child = item.childElementCount; 404 let slideWidth = item.scrollWidth / nb_child; 405 let left_val = this.classList.contains("btn_next") ? (slideWidth) * 1 : (slideWidth) * -1; 406 item.scrollBy({ 407 behavior: "smooth", 408 left: left_val, 409 top: 0 410 }); 411 }); 412 }); 413 } 414 415 item.addEventListener('scroll', () => { 416 let nb_child = item.childElementCount; 417 let slideWidth = item.scrollWidth / nb_child; 418 let btn_cmd = item.nextElementSibling; 419 let btn_prev = btn_cmd.querySelector(".btn_prev"); 420 let btn_next = btn_cmd.querySelector(".btn_next"); 421 (0 === item.scrollLeft) ? btn_prev.setAttribute("disabled", true) : btn_prev.removeAttribute("disabled"); 422 ((item.scrollLeft + (slideWidth * init_nbshown)) >= item.scrollWidth - 1) ? btn_next.setAttribute("disabled", true) : btn_next.removeAttribute("disabled"); 423 }); 424 425 item.parentElement.classList.add("loaded"); 426 item.parentElement.classList.contains("hide") ? item.parentElement.classList.remove("hide") : null; 427 } else { 428 item.parentElement.classList.add("no-slide"); 429 } 430}
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.