1/* 2 * jQuery Copyright plugin 0.1.1 3 * https://github.com/absentik/copyright 4 * 5 * Author: Seleznev Alexander (ABSENT) 6 * Email: [email protected] 7 * Website: http://whoisabsent.ru 8 * 9 * Licensed under the MIT license. 10 * http://www.opensource.org/licenses/mit-license.php 11 */ 12 13/* utilisé pour les boutons retour : */ 14; function retour() { window.history.back(); } 15 16/*evites d'etre encapsulé dans une iframe: */ 17if (top.frames.length != 0) 18 top.location = self.document.location; 19 20 21 22/*liens RouletteProD class rpdo= target_blank*/ 23function RPDFunction(event) { 24 var attribute = this.getAttribute("data-rpd"); 25 document.location.href = decodeURIComponent(window.atob(attribute)); 26}; 27 28 29function RPDOFunction(event) { 30 var attribute = this.getAttribute("data-rpd"); 31 newWindow = window.open(decodeURIComponent(window.atob(attribute)), '_blank'); 32 newWindow.focus(); 33}; 34 35function insertRpdEvents(content) { 36 var classname = content.getElementsByClassName("rpd"); 37 var classname2 = content.getElementsByClassName("rpdo"); 38 39 for (var i = 0; i < classname.length; i++) { 40 classname[i].addEventListener('click', RPDFunction, false); 41 } 42 43 for (var i = 0; i < classname2.length; i++) { 44 classname2[i].addEventListener('click', RPDOFunction, false); 45 } 46} 47 48document.addEventListener("DOMContentLoaded", function (event) { 49 insertRpdEvents(document); 50}); 51 52 53/* Fonction "shorten" Jquery pour raccourcir texte page categorie intro */ 54; (function ($) { 55 $.fn.shorten = function (settings) { 56 57 var config = { 58 showChars: 150, 59 ellipsesText: "", /* ... */ 60 moreText: "lire la suite", 61 lessText: " réduire" 62 }; 63 64 if (settings) { 65 $.extend(config, settings); 66 } 67 68 $(document).off("click", '.morelink'); 69 70 $(document).on({ 71 click: function () { 72 73 var $this = $(this); 74 if ($this.hasClass('less')) { 75 $this.removeClass('less'); 76 $this.html(config.moreText); 77 } else { 78 $this.addClass('less'); 79 $this.html(config.lessText); 80 } 81 $this.parent().prev().toggle(); 82 $this.prev().toggle(); 83 return false; 84 } 85 }, '.morelink'); 86 87 return this.each(function () { 88 var $this = $(this); 89 if ($this.hasClass("shortened")) return; 90 91 $this.addClass("shortened"); 92 var content = $this.html(); 93 if (content.length > config.showChars) { 94 95 var checkSpace = content.substr(config.showChars - 1, config.showChars - config.showChars + 1); 96 while (checkSpace != ' ') { 97 config.showChars = config.showChars + 1; 98 checkSpace = content.substr(config.showChars - 1, config.showChars - config.showChars + 1); 99 } 100 101 poffset = content.substr(config.showChars, content.length - config.showChars).indexOf("</p>") + 4; 102 var c = content.substr(0, config.showChars + poffset); 103 var h = content.substr(config.showChars + poffset, content.length - (config.showChars + poffset)); 104 105 var html = c + '<span class="moreellipses">' + config.ellipsesText + '</span><span class="morecontent"><span>' + h + '</span><b class="morelink">' + config.moreText + '</b></span>'; 106 $this.html(html); 107 $(".morecontent span").hide(); 108 } 109 }); 110 111 }; 112 113})(jQuery); 114$(document).ready(function () { 115 116 /*$(".txtintro").shorten(); desactive 6/11/18 */ 117 118 119 /* depose cookie dans taguniversel */ 120 if (document.cookie.indexOf("eucookie") === -1) { 121 $('#cookie-bar').show(); 122 } 123 124 $('#removecookie').on('click', function () { 125 // SetCookie('eucookie','yes',390); //rgpd cnil = 13 mois max. 30*13 = 390 126 $(this).closest('div').remove(); 127 128 }) 129 130 /* FIN EU COOKIE */ 131 132 133}); 134/* FIN Fonction "shorten" */ 135 136/* s'appelle comme ça : onclick="to_position('.bloctunnel')" */ 137function to_position(divid) { 138 139 let yOffset = -20; 140 141 if (window.innerWidth < 601) { /* si mobile */ 142 yOffset = -80; 143 } 144 145 const el = document.querySelector(divid); 146 const y = el.getBoundingClientRect().top + window.pageYOffset + yOffset; 147 148 // Timeout : Fix for firefox not scrolling to y 149 setTimeout(() => { window.scrollTo({ top: y, behavior: 'smooth' }); }, 10); 150} 151 152function removeActive(block) { 153 block.classList.remove("active"); 154} 155 156function setActive(block) { 157 block.classList.add("active"); 158} 159 160function toggleActive(block) { 161 block.classList.toggle("active"); 162} 163 164/* g_modal methods */ 165var allowModalSubmit = {}; 166 167function initModal(g_modal) { 168 allowModalSubmit[g_modal.id] = false;
169} 170 171function openModal(g_modal) { 172 g_modal.checked = true; 173} 174 175function closeModal(g_modal, form_name = '', submit = false) { 176 g_modal.checked = false; 177 if (submit) { 178 allowModalSubmit[g_modal.id] = true; 179 document.forms[form_name].submit(); 180 } 181} 182 183/* Hide read-more button and transition if block is less than max-height */ 184document.addEventListener("DOMContentLoaded", function (event) { 185 let read_more_blocks = document.querySelectorAll('.read-more'); 186 187 for (const [key, read_more] of Object.entries(read_more_blocks)) { 188 let event_name = `readmore-video-metadata-loaded-${key}`; 189 let event_lazy_metadata = new Event(event_name); 190 191 // Wait for all lazyloaded video to finish loading to calculate read-more height 192 document.addEventListener(event_name, function () { 193 let maxHeight = window.getComputedStyle(read_more).maxHeight; 194 let height = read_more.offsetHeight + 'px'; 195 196 if (height != maxHeight) { 197 read_more.querySelector('.read-more-trigger').classList.add('hide'); 198 read_more.querySelector('.read-more-content').classList.add('remove-mask'); 199 } 200 }); 201 202 // Add event on lazyloaded videos and send event if they all loaded 203 let lazyVideos = [...read_more.querySelectorAll("video.lazyvideo")]; 204 let nb_lazy_video_loaded = { [key]: 0 } 205 206 if (lazyVideos.length == 0) { 207 document.dispatchEvent(event_lazy_metadata); 208 } else { 209 for (const lazy of lazyVideos) { 210 lazy.addEventListener('loadedmetadata', function (e) { 211 nb_lazy_video_loaded[key]++; 212 213 if (nb_lazy_video_loaded[key] >= lazyVideos.length) { 214 document.dispatchEvent(event_lazy_metadata); 215 } 216 }); 217 } 218 } 219 } 220}); 221 222/** 223 * Lazyloading of video blocks 224 * Add "lazyvideo" to classes of <video> tag 225 * And change "src" to "data-src" of <source> tags 226 */ 227document.addEventListener("DOMContentLoaded", function () { 228 let lazyVideos = [...document.querySelectorAll("video.lazyvideo")] 229 230 if ("IntersectionObserver" in window) { 231 let lazyVideoObserver = new IntersectionObserver(function (entries) { 232 entries.forEach(function (video) { 233 if (video.isIntersecting) { 234 for (let source in video.target.children) { 235 let videoSource = video.target.children[source]; 236 if (typeof videoSource.tagName === "string" && videoSource.tagName === "SOURCE") { 237 videoSource.src = videoSource.dataset.src; 238 } 239 } 240 241 video.target.load(); 242 video.target.classList.remove("lazyvideo"); 243 lazyVideoObserver.unobserve(video.target); 244 } 245 }); 246 }); 247 248 lazyVideos.forEach(function (lazyVideo) { 249 lazyVideoObserver.observe(lazyVideo); 250 }); 251 } 252}, false); 253 254/** 255 * Ajuste automatiquement la taille en fonction de la variable "element" 256 * @param {string} element 257 */ 258window.addEventListener("load", function () { 259 const textareas = document.querySelectorAll('.textareaperso, .textareacustomize'); 260 261 textareas.forEach(function (textarea) { 262 auto_grow(textarea); // Ajuste la hauteur du textarea 263 }); 264}); 265 266function auto_grow(element) { 267 element.style.height = "auto"; 268 element.style.height = element.scrollHeight + "px"; 269}; 270 271/** 272 * Révéler des éléments au défilement de la page en leur appliquant une animation CSS 273 */ 274 275document.addEventListener("DOMContentLoaded", function () { 276 const revealElements = document.querySelectorAll("[data-reveal]"); 277 278 const observer = new IntersectionObserver((entries) => { 279 entries.forEach((entry) => { 280 if (entry.isIntersecting) { 281 entry.target.classList.add("revealed"); 282 } else { 283 entry.target.classList.remove("revealed"); 284 } 285 }); 286 }, {
287 /*rootMargin: "0px 0px -10% 0px", */ 288 rootMargin: "0px 0px -5% 0px", 289 }); 290 291 revealElements.forEach((element) => { 292 observer.observe(element); 293 }); 294});
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.