1var $ = jQuery; 2 3function desactiveClickOnMenu() { 4 $("nav ul#menu-menu_header>li.menu-item>a,footer .center .menus ul#menu-menu_header-1>.menu-item>a").off().on("click", 5 function () { 6 if (!$(this).parent().hasClass("sagachanel")) 7 return false; 8 }); 9} 10 11function targetBlank() { 12 $("footer a").off().on("click", function() { 13 this.target = '_blank'; 14 }); 15} 16 17function getUrlVars() { 18 let hashes = window.location.href.split('/'); 19 hashes = hashes[hashes.length - 1].split('?'); 20 return hashes[0].split('#')[1]; 21} 22 23function clickArticles() { 24 $(".linkArticle").off().on("click", function () { 25 $(this).find(".readmore").click(); 26 }); 27} 28 29function register_urlParam(){ 30 $.urlParam = function(name){ 31 const results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); 32 return results==null ? '' : (results[1] || 0) 33 } 34} 35 36function autoDiaporama() { 37 let liDiaporama = $(".diaporama .navs_absolute").children(); 38 indexDiaporama = indexDiaporama < liDiaporama.length - 1 ? indexDiaporama+1 : 0; 39 $(liDiaporama[indexDiaporama]).click(); 40} 41 42function centerImgDiaporama(photo, el) { 43 height_diaporama = (self.site_config_js && self.site_config_js.height_diaporama) ? self.site_config_js.height_diaporama : 465; 44 height = $(el).height(); 45 $(el).css("top", (height_diaporama - height) / 2); 46} 47 48function centerImgCarroussel(photo, el) { 49 $(el).css("margin-top", ((($(el).height() - 356) / 2) * (-1))); 50} 51 52function navDiaporamaAnimate(index) { 53 $(".diaporama .items").stop().animate({ 54 left: -(index * 648) 55 }, 1000, function () { 56 $(".diaporama .navs li").removeClass("current"); 57 $($("#content .diaporama .navs li")[index]).addClass("current"); 58 indexDiaporama = Number(index); 59 $("#blockRight .widgetLegende .title").text(diaporamaPicturelists[indexDiaporama].alttext); 60 $("#blockRight .widgetLegende .excerpt").text(diaporamaPicturelists[indexDiaporama].description); 61 if (indexDiaporama + 1 == diaporamaPicturelists.length) { 62 $(".homeMoreArticles").fadeIn("Slow"); 63 } else { 64 $(".homeMoreArticles").fadeOut("Slow"); 65 } 66 try { 67 window.history.pushState(null, "", $($("#content .diaporama ul li")[index]).find("a").attr("href")); 68 } catch (e) { } 69 }); 70} 71 72function navDiaporama() { 73 $("#content .diaporama .nav_menu_next").on("click",function () { 74 const item = $("#content .diaporama .navs .navs_absolute li").first(); 75 item.hide("slow", function () { 76 $("#content .diaporama .navs .navs_absolute").append(item); 77 item.show(); 78 }); 79 return false; 80 }); 81 $("#content .diaporama .nav_menu_prev").on("click",function () { 82 const item = $("#content .diaporama .navs .navs_absolute li").last(); 83 item.hide(); 84 $("#content .diaporama .navs .navs_absolute").prepend(item); 85 item.show("solw"); 86 return false; 87 }); 88} 89 90function paginationHome() { 91 $(".paginationHome span").each(function (i, obj) { 92 $(obj).off().on("click", function () { 93 $(".paginationHome span").removeClass("current"); 94 $(this).addClass("current"); 95 $("#homeBody .articles").hide(); 96 $("#homeBody .articles.item_" + $(this).html()).fadeIn(700); 97 $("#results .articles li a .visu img, .homeMoreArticles .item .visu a img").each(function (index) { 98 $(this).css("margin-top", ((($(this).height() - $(this).closest(".visu").height()) / 2) * (-1))); 99 }); 100 }); 101 }); 102} 103 104function paginationRubrique() { 105 $(".pagination_rubrique li a").each(function (i, obj) { 106 $(obj).off().on("click",function () { 107 $(".pagination_rubrique li").removeClass("active"); 108 $(this).parent().addClass("active"); 109 $("#homeBody .articles").hide(); 110 $("#homeBody .articles.item_" + $(this).html()).fadeIn(700); 111 $('html, body').animate({ 112 scrollTop: $(".items-posts").offset().top - $(".navbar-site #principal-menu").height() - $("#wpadminbar").height() 113 }, 700); 114 $(".number_page .active_page").html($(this).html()); 115 return false;
116 }); 117 }); 118} 119 120function strip_tags(input, allowed) { 121 allowed = (((allowed || "") + "").toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join(''); 122 const tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi; 123 return input.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) { 124 return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : ''; 125 }); 126} 127 128function seo() { 129 if (site_config_js.seo_bubble_links) { 130 const $wrapper_cls = site_config_js.devs.liens_non_cliquables_161442981 ? '#page' : 'body'; 131 $($wrapper_cls).on('click', 'a,img', function () { 132 let $origin = $target = $(this),href = ''; 133 if (href = $target.data('ihref')) { 134 window.location = href; 135 return; 136 } 137 138 $target = $target.is('img') || $target.is('span') ? $target.parents('a') : $target; 139 140 if (href = $target.data('href')) $target.attr('href', href); 141 142 $(document).trigger('bubble_click', [$origin]); 143 }); 144 } 145 $("[data-link-class]").each(function (i, index) { 146 const class_name = $(index).attr("data-link-class"); 147 const parent = $(index).parents("." + class_name); 148 const link = parent.find("a").attr("href"); 149 const a = "<a href='" + link + "' >" + $(index).html() + "</a>"; 150 $(index).html(a); 151 }); 152 $("span[data-href]").each(function(i, index) { 153 $(index).attr("href", $(index).attr("data-href")); 154 $(index).attr("data-href", null); 155 const target = $(index).data('target'); 156 let $href_html = $(index)[0].outerHTML; 157 if( target && typeof target !== 'undefined'){ 158 $href_html = $href_html.replace("data-target", "target"); 159 } 160 $(index)[0].outerHTML = $href_html.replace("<span", "<a").replace("</span", "</a"); 161 }); 162 $("img[data-ihref]").each(function (i, index) { 163 $(this).on("click",function () { 164 window.location = $(this).attr("data-ihref"); 165 }); 166 }); 167 $('a[data-href]').on('click', function () { 168 const link = $(this).data('href'); 169 if (link.length) { 170 let target = $(this).attr('target'); 171 target = target ? target : '_self'; 172 window.open(link, target); 173 } 174 }); 175} 176 177function setDefaultImage(source) { 178 const data_default_src = $(source).attr("data-default-src"); 179 if (data_default_src) { 180 const cpyImg = new Image(); 181 cpyImg.src = source.src; 182 source.src = cpyImg.width <= 120 && source.src != data_default_src ? data_default_src : source.src; 183 } 184} 185 186// Fonction pour regrouper les éléments li par groupes de 10 dans des ul 187function groupMenuItemsInUl(container, itemsPerGroup = 10) { 188 const $container = $(container); 189 const $allItems = $container.find('> li'); 190 191 if ($allItems.length <= itemsPerGroup) { 192 return; // Pas besoin de regrouper si moins de itemsPerGroup éléments 193 } 194 195 // Créer des groupes 196 const groups = []; 197 for (let i = 0; i < $allItems.length; i += itemsPerGroup) { 198 groups.push($allItems.slice(i, i + itemsPerGroup)); 199 } 200 201 // Vider le conteneur 202 $container.empty(); 203 204 // Créer un ul pour chaque groupe 205 groups.forEach((group, index) => { 206 const $groupUl = $('<ul class="sub-menu-group"></ul>'); 207 group.appendTo($groupUl); 208 $groupUl.appendTo($container); 209 }); 210} 211 212// Fonction pour calculer le niveau de menu 213function getMenuLevel(menu_item_id, menu_items) { 214 let level = 1; 215 let current_item = menu_items.find(item => item.ID == menu_item_id); 216 217 while (current_item && current_item.menu_item_parent !== 0) { 218 level++; 219 current_item = menu_items.find(item => item.ID == current_item.menu_item_parent); 220 } 221 222 return level; 223} 224 225function seo_menu() { 226 if (self.menu_items && (site_config_js.version == 1 || !site_config_js.version)) { 227 228 // Fonction pour traiter récursivement les éléments de menu 229 function processMenuItems(parent_id, target_selector, is_footer = false) { 230 // Trouver tous les enfants directs du parent 231 let children = menu_items.filter(item => item.menu_item_parent == parent_id); 232 233 for (let child of children) { 234 let item_parent = $(target_selector + " .menu-item-" + child.menu_item_parent); 235 236 if (is_footer) { 237 // Traitement pour le footer 238 if (item_parent.length) { 239 if (item_parent.find(".sub-menu").length === 0) { 240 item_parent.append("<ul class='sub-menu' />"); 241 } 242 let menu_level = getMenuLevel(child.ID, menu_items); 243 html = '<li class="' + ((child.classes) ? child.classes.join(' ') : '') + ' menu-item menu-item-type-taxonomy menu-item-object-category menu-item-' + child.ID + ' menu-level-' + menu_level + '">\ 244 <a href="' + child.url + '">' + child.title + '</a></li>'; 245 item_parent.find(".sub-menu").append(html); 246 } 247 } else { 248 // Traitement pour la navigation principale 249 if (site_config_js.sub_menu_by_column) { 250 let li_tp_parent = item_parent.closest('#header-top-menu > li'); 251 if (li_tp_parent.length) { 252 item_parent = li_tp_parent; 253 } 254 } 255 256 if (item_parent.length) { 257 if (item_parent.find(".sub-menu").length === 0 && !item_parent.hasClass('no-sub-childs')) { 258 item_parent.addClass('has-sub-childs') 259 item_parent.append("<ul class='sub-menu parent-" + child.menu_item_parent + "' />"); 260 } 261 if ($("nav .menu-item-" + child.ID).length === 0) { 262 let menu_level = getMenuLevel(child.ID, menu_items); 263 html = '<li class="' + ((child.classes) ? child.classes.join(' ') : '') + ' menu-item menu-item-type-taxonomy menu-item-object-category menu-item-' + child.ID + ' menu-level-' + menu_level + '">\ 264 <a href="' + child.url + '">' + child.title + '</a></li>'; 265 if (site_config_js.sub_menu_by_column) { 266 item_parent.find(".sub-menu").append(html); 267 } else { 268 item_parent.find(".sub-menu.parent-" + child.menu_item_parent).append(html); 269 } 270 } 271 } 272 } 273 274 if(site_config_js.sub_menu_by_column){ 275 // Traiter récursivement les enfants de cet élément 276 processMenuItems(child.ID, target_selector, is_footer); 277 } 278 } 279 } 280 281 // Regrouper les éléments de menu par groupes de 10 après leur création 282 if (site_config_js.sub_menu_by_column) { 283 // Traiter d'abord les éléments racine (parent = 0) pour la navigation 284 processMenuItems(0, "nav", false); 285 $("nav .sub-menu").each(function () { 286 groupMenuItemsInUl(this, site_config_js.sub_menu_by_column); 287 }); 288 } else { 289 for (const i in menu_items) { 290 const menu_item = menu_items[i]; 291 if (menu_item.menu_item_parent !== 0) { 292 processFooterItem(menu_item); 293 processHeaderItem(menu_item); 294 } 295 } 296 } 297 } 298} 299
300function processFooterItem(menu_item) { 301 const footer_parent = $("footer .menu-item-" + menu_item.menu_item_parent); 302 if (footer_parent.length) { 303 if (footer_parent.find(".sub-menu").length === 0) { 304 footer_parent.append("<ul class='sub-menu' />"); 305 } 306 const footer_html = '<li class="' + ((menu_item.classes) ? menu_item.classes.join(' ') : '') + 307 ' menu-item menu-item-type-taxonomy menu-item-object-category menu-item-' + 308 menu_item.ID + '">\ 309 <a href="' + menu_item.url + '">' + menu_item.title + '</a></li>'; 310 footer_parent.find(".sub-menu").append(footer_html); 311 } 312} 313 314function processHeaderItem(menu_item) { 315 const nav_parent = $("nav .menu-item-" + menu_item.menu_item_parent); 316 if (nav_parent.length) { 317 if (nav_parent.find(".sub-menu").length === 0 && !nav_parent.hasClass('no-sub-childs')) { 318 nav_parent.addClass('has-sub-childs'); 319 nav_parent.append("<ul class='sub-menu parent-" + menu_item.menu_item_parent + "' />"); 320 } 321 if ($("nav .menu-item-" + menu_item.ID).length === 0) { 322 const nav_html = '<li class="' + ((menu_item.classes) ? menu_item.classes.join(' ') : '') + 323 ' menu-item menu-item-type-taxonomy menu-item-object-category menu-item-' + 324 menu_item.ID + '">\ 325 <a href="' + menu_item.url + '">' + menu_item.title + '</a></li>'; 326 nav_parent.find(".sub-menu.parent-" + menu_item.menu_item_parent).append(nav_html); 327 } 328 } 329} 330 331function effet_bloc_sommaire() { 332 $("#content #results .thecontent .bloc_sommaire ul li.title").off().on("click",function () { 333 let ul_child = $(this).parent(); 334 let post_child = $(ul_child).children('.post-child,.folder-link'); 335 const delayTime = 50; 336 if (!$(ul_child).hasClass('in')) { 337 for (let i = 0; i <= post_child.length - 1; i++) { 338 $(post_child[i]).delay(i * delayTime).fadeIn('fast', 'swing'); 339 } 340 $(ul_child).addClass('in'); 341 } else { 342 for (let j = post_child.length - 1; j >= 0; j--) { 343 $(post_child[j]).delay((post_child.length - j) * delayTime).fadeOut('fast', 'swing'); 344 } 345 $(ul_child).removeClass('in'); 346 } 347 }); 348} 349 350function ninja_form_add_img() { 351 const element = $(".ninja-forms-form-wrap .ajouter-une-image").last(); 352 if (element.length) { 353 element.show().on("click",function () { 354 $(".ninja-forms-form-wrap .field-wrap.hidden_field:hidden").first().show(300); 355 if ($(".ninja-forms-form-wrap .field-wrap.hidden_field:hidden").length === 0) { 356 $(this).hide("slow"); 357 } 358 }); 359 } 360} 361 362function isScriptAlreadyIncluded(src) { 363 const scripts = document.getElementsByTagName("script"); 364 for (let i = 0; i < scripts.length; i++) 365 if (scripts[i].getAttribute('src') == src) return true; 366 return false; 367} 368 369function send_GA(category, action, lebel, value) { 370 if (typeof (value) === "undefined") { 371 value = null; 372 } 373 const custom_datalayer = site_config_js.custom_datalayer || 'dataLayer'; 374 if (window[custom_datalayer]) { 375 window[custom_datalayer] = window[custom_datalayer] || []; 376 window[custom_datalayer].push({ 377 event: category,action: action,label: lebel,value: value 378 }); 379 } 380 const args = { 'category': category, 'action': action, 'lebel': lebel, 'value': value }; 381 if (typeof consent_didomi !== 'undefined') { 382 consent_didomi('google_analytics', wait_consent_before_send_GA, args); 383 } else { 384 wait_consent_before_send_GA(args); 385 } 386} 387 388function wait_consent_before_send_GA(args) { 389 const non_interaction = (typeof site_config_js.enable_event_non_interaction !== 'undefined' && site_config_js.enable_event_non_interaction == true && no_interaction) ? true : false; 390 if (typeof site_config_js["partners"] !== 'undefined' && site_config_js["partners"].analytics == true) { 391 let category = args.category, action = args.action, lebel = args.lebel, value = args.value; 392 if (window._gaq) { 393 if (value) {
394 _gaq.push(['_trackEvent', category, action, lebel, value]); 395 } else { 396 _gaq.push(['_trackEvent', category, action, lebel]); 397 } 398 } if (window.gtag) { 399 let interaction = non_interaction ? { 'nonInteraction': true } : ''; 400 if (value) { 401 if (interaction) { 402 gtag('event', action, { 'event_category': category, 'event_label': lebel, 'value': value, interaction }); 403 } else { 404 gtag('event', action, { 'event_category': category, 'event_label': lebel, 'value': value }); 405 } 406 if (site_config_js.other_google_analytics_ids) { 407 jQuery.each(site_config_js.other_google_analytics_ids, function (index, value1) { 408 if (interaction) { 409 gtag('event', action, { 'send_to': value1, 'event_category': category, 'event_label': lebel, 'value': value, interaction }); 410 } else { 411 gtag('event', action, { 'send_to': value1, 'event_category': category, 'event_label': lebel, 'value': value }); 412 } 413 }); 414 } 415 } else { 416 if (interaction) { 417 gtag('event', action, { 'event_category': category, 'event_label': lebel, interaction }); 418 } else { 419 gtag('event', action, { 'event_category': category, 'event_label': lebel }); 420 } 421 if (site_config_js.other_google_analytics_ids) { 422 jQuery.each(site_config_js.other_google_analytics_ids, function (index, value1) { 423 if (interaction) { 424 gtag('event', action, { 'send_to': value1, 'event_category': category, 'event_label': lebel, interaction }); 425 } else { 426 gtag('event', action, { 'send_to': value1, 'event_category': category, 'event_label': lebel }); 427 } 428 }); 429 } 430 } 431 } if (window.ga) { 432 let interaction = non_interaction ? { 'nonInteraction': 1 } : ''; 433 if (value) { 434 if (interaction) { 435 ga('send', 'event', category, action, lebel, value, interaction); 436 } else { 437 ga('send', 'event', category, action, lebel, value); 438 } 439 if (site_config_js.other_google_analytics_ids) { 440 for (let ga_name in site_config_js.other_google_analytics_ids) { 441 if (interaction) { 442 ga(ga_name + '.send', 'event', category, action, lebel, value, interaction); 443 } else { 444 ga(ga_name + '.send', 'event', category, action, lebel, value); 445 } 446 } 447 } 448 } else { 449 if (interaction) { 450 ga('send', 'event', category, action, lebel, interaction); 451 } else { 452 ga('send', 'event', category, action, lebel); 453 } 454 if (site_config_js.other_google_analytics_ids) { 455 for (let ga_name in site_config_js.other_google_analytics_ids) { 456 if (interaction) { 457 ga(ga_name + '.send', 'event', category, action, lebel, interaction); 458 } else { 459 ga(ga_name + '.send', 'event', category, action, lebel); 460 } 461 } 462 } 463 } 464 } 465 } 466} 467 468function send_events_GA(category, action, lebel) { 469 if (window.gtag) { 470 gtag('event', action, { 'send_to': 'events', 'event_category': category, 'event_label': lebel }); 471 } if (window.ga) { 472 ga('events.send', 'event', category, action, lebel); 473 } 474} 475 476function pageview_GA(only_path_and_hash) { 477 if (window._gaq) {
478 window._gaq.push(['_trackPageview', only_path_and_hash]); 479 } if (window.gtag) { 480 gtag('event', 'page_view', { 'send_to': site_config_js.google_analytics_id }); 481 if (site_config_js.other_google_analytics_ids) { 482 jQuery.each(site_config_js.other_google_analytics_ids, function (index, value1) { 483 gtag('event', 'page_view', { 'send_to': value1 }); 484 }); 485 } 486 } if (window.ga) { 487 if (typeof site_config_js["partners"] !== 'undefined' && site_config_js["partners"].analytics == true) { 488 ga('send', 'pageview', only_path_and_hash); 489 if (site_config_js.other_google_analytics_ids) { 490 for (let ga_name in site_config_js.other_google_analytics_ids) { 491 ga(ga_name + '.send', 'pageview', only_path_and_hash); 492 } 493 } 494 } 495 } 496} 497 498function calc_new_sharer_size() { 499 $block_share = $('.sharer_after_comment .share-buttons'); 500 const width_1 = $block_share.find('.total-shares').width(),width_2 = $block_share.find('.blockShare_horizontal').width(); 501 $block_share.width(width_1 + width_2 + 15); 502} 503 504function handle_video_state_tracking(event, tracking_Params) { 505 const StateMessage = tracking_Params.event,videoPlayer = tracking_Params.videoPlayer,prsentPoints = [25, 50, 75]; 506 StateMessage = StateMessage === 0 ? 'Start' : (prsentPoints.indexOf(StateMessage) != -1 ? 'lecture à ' + StateMessage + '% ' : StateMessage); 507 if (site_config_js.is_preprod) { 508 console.log(StateMessage); 509 } 510 setTimeout(function () { 511 send_GA(videoPlayer, StateMessage, self.location.href); 512 }, 3000); 513} 514 515function menu_link_mouseover(this_) { 516 const $this_ = $(this_); 517 const color = $this_.data('color-typo-hover') || ''; 518 $this_.css('color', color, 'important'); 519 const bg_color = $this_.data('color-fond-hover') || ''; 520 $this_.each(function () { 521 this.style.setProperty('color', color, 'important'); 522 this.style.setProperty('background-color', bg_color, 'important'); 523 }); 524} 525 526function menu_link_onmouseout(this_) { 527 const $this_ = $(this_); 528 const color = $this_.data('color-typo') || ''; 529 const bg_color = $this_.data('color-fond') || ''; 530 $this_.each(function () { 531 this.style.setProperty('color', color, 'important'); 532 this.style.setProperty('background-color', bg_color, 'important'); 533 }); 534} 535 536function show_default_sharer(id, url, title, description, image) { 537 if (typeof Share == 'function') { 538 window.share_object = new Share(id, { 539 url: url, 540 title: title, 541 description: description, 542 image: image, 543 ontoggle: false, 544 inject_css: false, 545 inject_html: false, 546 ui: { button_font: false, icon_font: false }, 547 networks: { 548 twitter: { 549 before: function (elem) { 550 const twObj = $(elem).find('.social-network[data-network=twitter]'); 551 this.url = $(twObj).data('url'); 552 this.description = this.text = $(twObj).data('text'); 553 const hashtags = $(twObj).data('hashtags'); 554 const via = $(twObj).data('via'); 555 if (hashtags && hashtags != '') { 556 this.url += '&hashtags=' + hashtags; 557 } 558 if (via && via != '') { 559 this.url += '&via=' + via; 560 } 561 } 562 } 563 } 564 }); 565 } 566} 567 568function fix_nav_scroll() { 569 const $share_to_fix = $('.sharer_below_title .share-buttons'); 570 if ($share_to_fix.length > 0) { 571 let $share_sticky = $('.blockShare_fixed'); 572 $(document).on('scroll', function () { 573 const offset_navbar_top = !$share_sticky.hasClass('navbar-fixed-top') ? $share_to_fix.offset().top : 0; 574 $share_sticky.toggleClass('navbar-fixed-top', offset_navbar_top <= $(this).scrollTop()); 575 }); 576 } 577} 578 579function get_more_posts(paged) { 580 if (window.stored_posts && window.stored_posts.length != 0) { 581 $.each(window.stored_posts, function (key, value) {
582 if (value['id'] != site_config_js.post_id) { 583 $("#posts-ajax").append(post_template(value)); 584 } 585 }); 586 window.stored_posts = []; 587 window.load_more_content = true; 588 return false; 589 } else { 590 let data = { 591 feed: 'json2' 592 }; 593 if (paged > 1) { 594 data.paged = paged; 595 } 596 $.ajax({ 597 url: '/', 598 type: 'GET', 599 dataType: 'json', 600 data: data, 601 success: function (response) { 602 window.stored_posts = []; 603 if (response) { 604 let i = 1; 605 $.each(response['posts'], function (key, value) { 606 if (i < 6) { 607 if (value['id'] != site_config_js.post_id) { 608 $("#posts-ajax").append(post_template(value)); 609 } 610 i++; 611 } else { 612 window.stored_posts.push(value); 613 } 614 }); 615 } 616 $('#paged').val(parseInt(paged) + 1); 617 window.load_more_content = true; 618 return false; 619 }, 620 }); 621 } 622} 623 624function post_template(post) { 625 let html = "<div class='col-xs-12 col-sm-6 item-post'><div class='thumbnail'>"; 626 html += "<div class='thumbnail-visu mobile'><a href='" + post['permalink'] + "'><img id='img_more_post' loading='lazy' class='img-responsive zoom-it wp-post-image' src='" + post['thumbnail_medium'] + "' ></a></div>"; 627 html += '<h2 class="title"><a href="' + post['permalink'] + '">' + post['title'] + '</a></h2>'; 628 html += '<div class="addthis_toolbox" addthis:url="' + post['permalink'] + '" addthis:title="' + post['title'] + '" addthis:description="' + post['excerpt'] + '"></div></div></div>'; 629 return html; 630} 631 632function flash_active() { 633 if (navigator.mimeTypes.length > 0) { 634 return navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin != null; 635 }else if (window.ActiveXObject) { 636 try { 637 new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); 638 return true; 639 } 640 catch (oError) { 641 return false; 642 } 643 } 644 return false; 645} 646 647function second_tracking(url) { 648 window.open(url); 649} 650 651function isIE(userAgent) { 652 userAgent = userAgent || navigator.userAgent; 653 return userAgent.indexOf("MSIE ") > -1 || userAgent.indexOf("Trident/") > -1; 654} 655 656function handleJsLinkClick() { 657 let link = $(this).attr('data-ref') ?? $(this).attr('data-rel'); 658 if (link) { 659 const target = $(this).attr('data-target') ?? ''; 660 link = link.indexOf('http') != 0 && link[0] != '/' ? '/' + link : link; 661 if (target.toLowerCase() == '_blank') { 662 window.open(link); 663 } else { 664 document.location.href = link; 665 } 666 } 667} 668 669function rw_lazyload() { 670 let rw_lazyload = null; 671 if (typeof LazyLoad != 'undefined') { 672 rw_lazyload = new LazyLoad({ 673 elements_selector: ".lazy-load", 674 class_loaded: 'lazy-loaded' 675 }); 676 } 677 return rw_lazyload; 678} 679 680function showCmpPreferencesPopup() { 681 if (typeof (FastCMP) !== 'undefined') { 682 FastCMP.open(); 683 } else if (typeof (Didomi) !== 'undefined') { 684 Didomi.preferences.show(); 685 } 686} 687
688function rw_observe_element(selector, callback) { 689 const targetNode = document.querySelector(selector); 690 if (!targetNode) { 691 return; 692 } 693 const mutationCallback = function (mutationsList, observer) { 694 for (const mutation of mutationsList) { 695 if (mutation.type === 'childList') { 696 callback(targetNode); 697 } 698 } 699 }; 700 const observer = new MutationObserver(mutationCallback),config = { childList: true, subtree: true }; 701 observer.observe(targetNode, config); 702} 703 704 705function slick_diapo_newsletter() { 706 const $diapo_newsletter = $(".diaporama_newsletter"); 707 if ($("body").hasClass('single') && $diapo_newsletter.length) { 708 $diapo_newsletter.slick({ 709 slidesToScroll: 1, 710 draggable: true, 711 infinite: false, 712 }); 713 } 714} 715 716function datepicker_quizz() { 717 if (typeof $.datepicker !== 'undefined' && $.isFunction($.datepicker)) { 718 $(".datepicker_quizz").datepicker({ 719 dateFormat: 'dd/mm/yy', 720 changeYear: true, 721 yearRange: "1920:Now" 722 }); 723 } 724} 725 726function calback_btn_accept_cookie() { 727 $('#button_accept_cookies').on("click",function () { 728 setCookie("eccept_cookie", 1, 60 * 60 * 24 * 365); 729 $("#rw_alert_cookies").hide("slow"); 730 }); 731} 732 733function slick_hp_carrousel() { 734 let hp_carrousel = $('#hp_carousel'); 735 if ($.fn.slick && hp_carrousel.length > 0) { 736 hp_carrousel.slick({ 737 autoplay: true, 738 autoplaySpeed: 8000, 739 speed: 800, 740 infinite: true, 741 fade: true, 742 cssEase: 'linear', 743 arrows: true, 744 dots: false, 745 pauseOnHover: false, 746 lazyLoad: 'ondemand', 747 appendArrows: $('#carousel_arrows'), 748 }); 749 } 750} 751 752function callback_copy_link() { 753 const copy_link_selector = '.copy_link'; 754 if (typeof ClipboardJS !== "undefined" && $(copy_link_selector).length) { 755 const clipboard = new ClipboardJS(copy_link_selector); 756 clipboard.on('success', function (e) { 757 if (typeof e.trigger != 'undefined') { 758 $(e.trigger).addClass('copied'); 759 setTimeout(function () { 760 $(e.trigger).removeClass('copied'); 761 }, 1000); 762 } 763 e.clearSelection(); 764 }); 765 } 766} 767 768function handle_links_blank() { 769 $("a[href='javascript:void(0);'], a[href='javascript:void(0)']").on("contextmenu", function (e) { 770 $(this).attr('href', $(this).attr('data-href')); 771 }).on('mouseout', function (e) { 772 $(this).attr('href', 'javascript:void(0);'); 773 }); 774} 775 776function quizz_progress() { 777 if ($('#quizz').length > 0) { 778 779 const $quizz = $('#quizz'),$progress = $quizz.find('.test_progress'),widthTest = $progress.width(),numItems = $progress.find('.steps').length; 780 let time_refresh_quizz = site_config_js.time_refresh_quizz || 2000; 781 if ($quizz.hasClass('test-v2') && typeof site_config_js.time_refresh_test !== 'undefined') { 782 time_refresh_quizz = site_config_js.time_refresh_test; 783 } 784 $('#quizz .test_progress .steps:not(:last)').css('width', widthTest / (numItems - 1)); 785 786 $('#quizz .question-responses-list-item label').on("click",function () { 787 const $question_list_item = $(this).closest('#quizz .question-responses-list-item'); 788 if(!$question_list_item.hasClass('right') && !$question_list_item.hasClass('wrong')) { 789 $question_list_item.removeClass('right wrong'); 790 if ($(this).children('input').attr('correct') == 1) { 791 $question_list_item.addClass('right'); 792 } else { 793 $question_list_item.addClass('wrong'); 794 } 795 } 796 setTimeout(function () { $('#answer_quizz_form').submit(); }, time_refresh_quizz); 797 }); 798 } 799} 800 801function handle_link_consent_didomi() { 802 if(typeof site_config_js.partners !== 'undefined' && site_config_js.partners.cmp_didomi && typeof Didomi !== 'undefined'){ 803 const linkGestionCookies = $('a[href="#consent_didomi"]'); 804 if (linkGestionCookies.length) { 805 linkGestionCookies.on("click",function (e) { 806 e.preventDefault(); 807 Didomi.preferences.show(); 808 }); 809 } 810 } 811} 812 813function callback_onlick_btn_show_more(event) { 814 const lang = $('html').get(0).lang || 'fr-FR'; 815 const $element = $('.pagination--show-more-pages'); 816 $element.toggleClass('pagination--hide-pages'); 817 if ($element.hasClass('pagination--hide-pages')) { 818 $(this).text(lang === 'fr-FR' ? 'Voir plus' : 'See more'); 819 } else { 820 $(this).text(lang === 'fr-FR' ? 'Voir moins' : 'See less'); 821 } 822} 823 824function load_and_center_gallery_images(){ 825 $("#content #results .thecontent .diaporama ul li.item img").each(function(index, el) { 826 const photo = new Image(); 827 photo.url = el.src; 828 $(photo).on('load', centerImgDiaporama(photo, el)); 829 }); 830 $("#content .carroussel ul li a.pimg img").each(function(index, el) { 831 const photo = new Image(); 832 photo.url = el.src; 833 $(photo).on('load', centerImgCarroussel(photo, el)); 834 }); 835 var indexDiaporama = parseInt($("#content .diaporama .navs li.current").attr("index")) || 0; 836} 837 838function convert_newsletter_submit_to_button() { 839 $('.rw-ninja-forms .nl-social .nf-form-content input[type="submit"], .rw-ninja-forms .nl_box .nf-form-content input[type="submit"], .rw-ninja-forms #blockRight .widget_newsletter .nf-form-content input[type="submit"], .rw-ninja-forms #blockRight .newsletter .nf-form-content input[type="submit"], .rw-ninja-forms footer .
839nf-form-content input[type="submit"]').attr('type', 'button') 840} 841 842function send_GA_traking_device(){ 843 const device = site_config_js.nginx_mobile ? 'phone' : site_config_js.nginx_tablet ? 'tablet' : 'desktop'; 844 send_GA('NginxMobile', device, device, null, true); 845} 846 847function setup_meta_refresh(){ 848 const refresh_duration = site_config_js.devs.refresh_manager_153552908 && site_config_js.refresh_meta_duration !== 'undefined' ? site_config_js.refresh_meta_duration : 300; 849 if( site_config_js.enable_refresh_meta !== 'undefined' && site_config_js.enable_refresh_meta){ 850 $('head').append('<meta id="meta-refresh" http-equiv="refresh" content="'+ refresh_duration +'">'); 851 } 852} 853 854function enable_lazyload_on_home_carousels(){ 855 if (site_config_js.devs.activer_le_lazyload_sur_le_home_diapos_3459) { 856 $("#carousel-gallery-generic, #custom-full-carousel-type-1").on('slide.bs.carousel', function (e) { 857 window.imgc = e; 858 let img = $(e.relatedTarget).find("img.lazy-load"); 859 if (img.length) { 860 img.attr("src", img.data("src")).removeClass('lazy-load').addClass("lazy-loaded"); 861 } 862 let img2 = $(e.relatedTarget).next(".item").find("img.lazy-load"); 863 if (img2.length) { 864 img2.attr("src", img2.data("src")).removeClass('lazy-load').addClass("lazy-loaded"); 865 } 866 }); 867 } 868} 869 870function init_mobile_social_share_toggle(){ 871 if( site_config_js.new_share_bottons_mobile ){ 872 $( "#social_share_mobile #illustrate" ).on( "click", function() { 873 $( "#social_share_mobile .blockShare_horizontal ul" ).toggleClass( "show_sharer" ); 874 $( this ).toggleClass( "close_share" ); 875 }); 876 } 877} 878 879function handle_iframe_message(e) { 880 let data = e.data; 881 if (data && data.indexOf) { 882 if (data.indexOf('iframe_height') > -1 && data.indexOf('iframe_id') > -1) { 883 let iframe = JSON.parse(e.data); 884 if (iframe.iframe_id) { 885 let iframe_obj = document.getElementById(iframe.iframe_id.replace('/', '')); 886 if (iframe_obj) iframe_obj.style.height = iframe.iframe_height + "px"; 887 } 888 } else if (data.indexOf('height_iframe_') > -1) { 889 const height = data.substr(14),frame = document.getElementById('iframe-autosize'); 890 frame.style.height = height + "px"; 891 } 892 } 893}
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.