1/********************************************************* 2Fonctions de bases pour illicopage 3**********************************************************/ 4 5/* Fonction d'ouverture d'un popup : evite le target */ 6function winOpen(url, largeur, hauteur){ 7 gauche = (screen.width/2)-(largeur/2); 8 haut = (screen.height/2)-(hauteur/2); 9 window.open(url,"popup","height="+hauteur+",width="+largeur+",status = no,toolbar = no,menubar = no,location = no,resizable = no,titlebar = no,scrollbars = yes,fullscreen = no,top ="+haut+",left ="+gauche); 10 } 11 12/* affichage de la date du jour **/ 13function AfficheDateJour ( ){ 14Today = new Date; 15TexteJour = new Array ("Dimanche" , "Lundi", "Mardi", "Mercredi" , "Jeudi" , "Vendredi", "Samedi"); 16TexteMois = new Array ("Janvier" , "F�vrier", "Mars", "Avril" , "Mai" , "Juin", "Juillet", "Ao�t" , "Septembre", "Octobre", "Novembre", "D�cembre"); 17 18 19Day = Today.getDay(); 20Jour = Today.getDate(); 21if (Jour<10) 22Jour = "0"+Jour; 23Mois = (Today.getMonth())+1; 24if (Mois<10) 25Mois = "0"+Mois; 26Annee = Today.getFullYear(); 27var DateDuJour = ""; 28DateDuJour = TexteJour[Day] + " "+ Jour +" "+TexteMois[Mois]+ " " +Annee; 29document.write(DateDuJour); 30} 31 32/* Fonction de remplissage d'un div avec le contenu pass� par programme */ 33function ChangeMessage(message,champ) 34{ 35 var msg2 = message.replace(/\>\;/gi, ">"); 36 msg2 = msg2.replace(/\<\;/gi, "<"); 37 38 if(document.getElementById) 39 document.getElementById(champ).innerHTML = msg2; 40} 41 42/* Fonction d'ouverture de la version imprimable*/ 43function printer_friendly() 44{ 45 ret = window.open('/cgi-local/printer_friendly.pl?url='+url_printer, 'printer_friendly','width=800,height=600,scrollbars=1'); 46} 47 48/* Fonction de passage � la version malvoyant */ 49function version_malvoyant() 50{ 51 if( url_lien_malvoyant != "" ) 52 document.location=url_lien_malvoyant; 53} 54 55/* Fonction de transformation de la page html en un fichier pdf */ 56function version_pdf() 57{ 58 ret = window.open('/cgi-local/imprime-pdf.pl?url='+url_printer, 'printer_friendly','width=800,height=600,scrollbars=1'); 59} 60 61 62/* Initialisation des parametres */ 63var prse_menu_lateral = 0; 64var url_printer = ""; 65var url_lien_malvoyant = ""; 66 67function GetId(id) 68{ 69 return document.getElementById(id); 70} 71 72function deplace_contenu_div(source, dest) 73{ 74 if(GetId(source)){ 75 content = GetId(source).innerHTML; 76 if(GetId(dest)){ 77 GetId(dest).innerHTML = content; 78 GetId(source).innerHTML = ""; 79 } 80 } 81 82} 83 84 85function recup_element_div(source, dest) 86{ 87 if(document.getElementById(source)){ 88 content = document.getElementById(source).innerHTML; 89 if(document.getElementById(dest)){ 90 document.getElementById(dest).innerHTML = content; 91 document.getElementById(source).innerHTML = ""; 92 } 93 } 94 95} 96 97/*au chargement de la page...*/ 98jQuery.noConflict(); 99jQuery(document).ready(function(){ 100/*gestion du menu mobile */ 101if(jQuery("#conteneur").width()<540) 102{ 103jQuery("#titre_rub").toggle(function() { 104 jQuery('.menuLat').slideDown(); 105 jQuery('#titre_rub').addClass('menu-ouvert'); 106 jQuery('#titre_rub').removeClass('menu-ferme'); 107 jQuery('.menuLat').css({"display":"block"}); 108 }, 109function() { 110 jQuery('.menuLat').slideUp(); 111 jQuery('#titre_rub').addClass('menu-ferme'); 112 jQuery('#titre_rub').removeClass('menu-ouvert'); 113 jQuery('.menuLat').css({"display":"none"}); 114 }); 115jQuery('#titre_rub').addClass('menu-ferme'); 116 } 117 118/*annuaire des communes autocompletion*/ 119 jQuery(function() { 120 jQuery("#recherchecommune").autocomplete({ 121 source: "/cgi-local/recherche_commune.pl", 122 minLength: 2, 123 select: function(event, ui) { 124 125 var ID = ui.item.ref; 126 document.location = "/cgi-local/detail_commune.pl?action=Donnees&charte=1&ID="+ID; 127 128 } 129 }); 130 }); 131 132 133 134}); 135 136 137 138 139jQuery(document).ready(function () { 140 var recherche_en_cours = 0; 141 var mySearchTimeout; 142 143 jQuery('#query2').keyup(function () { 144 clearTimeout(mySearchTimeout); 145 var filter = jQuery(this).val(); 146 mySearchTimeout = setTimeout(function () { 147 var textRecherche = document.getElementById("query2").value; 148 while (recherche_en_cours == 1) { sleep(100); } 149 if (textRecherche.length >= 3 && recherche_en_cours == 0) { 150 recherche_en_cours = 1; 151 152 moteur(); 153 154 recherche_en_cours = 0; 155 } 156 else { 157 jQuery('#response').html(""); 158 } 159 }, 150); 160 return true; 161 162 }); 163 164 //GE - 25/05/2023 - JQuery.on() deprecated 165 //jQuery(document).on('click', '.remplace', function (event) { 166 // jQuery('document').delegate('.remplace', 'click', function () { 167 168 // var recherche = jQuery(this).text(); 169 // jQuery("#query2").val(recherche); 170 // jQuery("#query2").focus(); 171 // moteur(); 172 173 // }); 174 175 //JU - 7/06/2023 - JQuery.on() deprecated 176 jQuery(document).click(function(event) { 177 if (jQuery(event.target).hasClass("remplace")) { 178 var recherche = jQuery(event.target).text(); 179 jQuery("#query2").val(recherche); 180 jQuery("#query2").focus(); 181 182 moteur(); 183 } 184 }); 185 186 187 188 function moteur() { 189 var textRecherche = document.getElementById("query2").value; 190 var lang = jQuery('html').attr('lang'); 191 192 // console.log(" recherche "+textRecherche); 193 // console.log(" langue "+lang); 194 195 196 jQuery('#response').html(""); 197 jQuery('#bloc-moteur-suggest').html(""); 198 jQuery.ajax({ 199 type: "POST", 200 url: "/cgi-local/moteur-elastic.pl", 201 dataType: 'json', 202 context: document.body, 203 data: { resultRecherche: textRecherche, langue: lang}, 204 success: function (data) { 205 jQuery.each(data, function (teste, value) { 206 207 jQuery.each(value, function (doc, info) { 208 codespan = ' picto_html '; 209 210 if (!info.suggest.includes('null')) { 211 // jQuery('#bloc-moteur-suggest').html("<h2>Suggestion(s):</h2>" + info.suggest); 212 jQuery('#bloc-moteur-suggest').html(info.suggest); 213 } 214 if (info.title.includes('pdf')) { 215 codespan = ' picto_pdf '; 216 } 217 if (info.img.substr(info.img.length - 8, 8) == 'html.png') { 218 219 jQuery('#response').append("<div class='itemmoteur " + codespan + "'" + "><a href=" + info.url + "><div><h3>" + info.title + "</h3><p>" + info.body + "</p></div></a></div>"); 220 } 221 else { 222
223 jQuery('#response').append("<div class='itemmoteur " + codespan + "'" + "><a href=" + info.url + "><div><h3>" + info.title + "</h3><p>" + info.body + "</p><div class='img-moteur'><img src=" + info.img + "></div></div></a></div>"); 224 } 225 }) 226 }) 227 }, 228 error: function (jqXHR, textStatus, errorThrown) { 229 console.log('Pas de r̮̩sultat' + jqXHR.status + ' ' + textStatus); 230 231 } 232 }); 233 }; 234}); 235 236 237// illicobilite 238 239function getCookie(nome) { 240 var nomeIgual = nome + "="; 241 var cookies = document.cookie.split(';'); 242 for (var i = 0; i < cookies.length; i++) { 243 var cookie = cookies[i].trim(); 244 if (cookie.indexOf(nomeIgual) === 0) { 245 return cookie.substring(nomeIgual.length, cookie.length); 246 } 247 } 248 return null; 249} 250 251function openMenuAccessibilite(){ 252 var menuAcessibilidade = document.querySelector(".menu_acessibilite"); 253 var estilo = window.getComputedStyle(menuAcessibilidade); 254 var display = estilo.getPropertyValue('display'); 255 if (display === "none") { 256 menuAcessibilidade.style.display = "flex"; 257 menuAcessibilidade.focus(); 258 } else { 259 menuAcessibilidade.style.display = "none"; 260 } 261} 262 263document.cookie = "policet = "+(getCookie("policet"))*1+" ; path=/"; 264 265if(getCookie("grayscale") == 'on'){ document.cookie = "grayscale = off ; path=/";grayscale();} 266 267if(getCookie("contrast") == 'on'){ document.cookie = "contrast = off ; path=/"; contrast(); } 268 269if(getCookie("liensoulines") == 'on'){document.cookie = "liensoulines = off ; path=/"; liensoulines(); } 270 271if(getCookie("opendyslexic") == 'on'){document.cookie = "opendyslexic = off ; path=/"; opendyslexic(); } 272 273if(getCookie("acc_lectureAudio") == "on"){ 274document.addEventListener("DOMContentLoaded", function() { 275 document.cookie = "acc_lectureAudio = off ; path=/"; 276 277 acc_lectureAudio(); 278}); 279} 280 281if(getCookie("policet") > 0){ 282 283 var tpolice = 0.05 * getCookie("policet"); 284 tpolice = 1 + tpolice; 285 286 document.addEventListener("DOMContentLoaded", function() { 287 var itens = document.querySelectorAll("p ,input, a, button"); 288 289 for(var i = 0; i< itens.length; i++){ 290 var object = itens[i]; 291 var config = window.getComputedStyle(object); 292 var taille = (parseFloat(config.fontSize))*tpolice; 293 294 object.style.fontSize = taille+"px"; 295 296 } 297 }); 298 299 300} 301 302function plus_taille(){ 303 jQuery(document).ready(function () { 304 var policet = parseInt(getCookie("policet")); 305 if(policet < 5){ 306 var itens = document.querySelectorAll("p ,input, a, button"); 307 for(var i = 0; i< itens.length; i++){ 308 var object = itens[i]; 309 var config = window.getComputedStyle(object); 310 var taille = (parseFloat(config.fontSize))*1.05; 311 object.style.fontSize = taille+"px"; 312 313 } 314 315 document.cookie = "policet = "+(policet+1)+" ; path=/"; 316 317 } 318 319 }); 320} 321 322function moin_taille(){ 323 324 jQuery(document).ready(function () { 325 var policet = (getCookie("policet"))*1; 326 327 if(policet > 0 ){ 328 var itens = document.querySelectorAll("p ,input, a, button"); 329 330 for(var i = 0; i< itens.length; i++){ 331 var object = itens[i]; 332 var config = window.getComputedStyle(object); 333 var taille = (parseFloat(config.fontSize))*0.95; 334 335 object.style.fontSize = taille+"px"; 336 } 337 document.cookie = "policet = "+(policet - 1)+" ; path=/"; 338 } 339 }); 340} 341 342function grayscale(){ 343 if(getCookie("grayscale") == "on"){ 344 345 var itens = document.querySelectorAll("html"); 346 347 for(var i = 0; i< itens.length; i++){ 348 var object = itens[i]; 349 350 object.classList.remove("gray"); 351 } 352 353 document.cookie = "grayscale = off ; path=/"; 354 }else{ 355 356 var itens = document.querySelectorAll("html"); 357 358 for(var i = 0; i< itens.length; i++){ 359 var object = itens[i]; 360 361 object.classList.add("gray"); 362 } 363 364 document.cookie = "grayscale = on; path=/" 365 } 366 367} 368 369function contrast(){ 370 if(getCookie("contrast") == "on"){ 371 372 var itens = document.querySelectorAll("html"); 373 374 for(var i = 0; i< itens.length; i++){ 375 var object = itens[i]; 376 377 object.classList.remove("inverter"); 378 } 379 380 document.cookie = "contrast = off ; path=/"; 381 }else{ 382 383 var itens = document.querySelectorAll("html"); 384 385 for(var i = 0; i< itens.length; i++){ 386 var object = itens[i]; 387 388 object.classList.add("inverter"); 389 } 390 391 document.cookie = "contrast = on ; path=/"; 392 } 393 394} 395 396function liensoulines(){ 397 jQuery(document).ready(function () { 398 if(getCookie("liensoulines") == "on"){ 399 var itens = document.querySelectorAll("a"); 400 for(var i = 0; i< itens.length; i++){ 401 var object = itens[i]; 402 object.classList.remove("liensoulines"); 403 } 404 document.cookie = "liensoulines = off ; path=/"; 405 }else{ 406 var itens = document.querySelectorAll("a"); 407 for(var i = 0; i< itens.length; i++){ 408 var object = itens[i]; 409 object.classList.add("liensoulines"); 410 } 411 document.cookie = "liensoulines = on ; path=/"; 412 } 413 }); 414} 415 416function opendyslexic(){ 417 jQuery(document).ready(function () { 418 var text = document.querySelectorAll("p ,input ,a ,button ,span ,h1 ,h2 ,h3 ,h4 ,h5 ,h6 ,div"); 419 if(getCookie("opendyslexic") == "on"){ 420 for(var i = 0; i< text.length; i++){ 421 var object = text[i]; 422 object.classList.remove("opendyslexic"); 423 } 424 document.cookie = "opendyslexic = off ; path=/"; 425 }else{ 426 for(var i = 0; i< text.length; i++){ 427 var object = text[i]; 428 object.classList.add("opendyslexic"); 429 } 430 document.cookie = "opendyslexic = on ; path=/"; 431 } 432 }); 433} 434 435$audioLir = 0; 436 437function acc_lectureAudio() 438{ 439 if ('speechSynthesis' in window && window.speechSynthesis.getVoices().length > 0) { 440 441 var elements = document.querySelectorAll('section, p ,input ,a ,button ,h1 ,h2 ,h3 ,h4 ,h5 ,h6, div, article ');
442 var checkbox = document.getElementById("lecaudio"); 443 if(getCookie("acc_lectureAudio") == "off"){ 444 for(var i = 0; i< elements.length; i++){ 445 var object = elements[i]; 446 447 if(object.tagName == "DIV"){ 448 if(object.children.length != 0){ 449 continue; 450 } 451 } 452 object.addEventListener('click', readText); 453 object.setAttribute('tabindex', i); 454 checkbox.checked = true; 455 } 456 $audioLir = 1; 457 document.cookie = "acc_lectureAudio = on ; path=/"; 458 }else{ 459 for(var i = 0; i< elements.length; i++){ 460 var object = elements[i]; 461 if(object.tagName == "DIV"){ 462 if(object.children.length != 0){ 463 continue; 464 } 465 } 466 object.removeEventListener('click', readText); 467 object.removeAttribute('tabindex', i); 468 checkbox.checked = false; 469 speechSynthesis.cancel(); 470 } 471 $audioLir = 0; 472 document.cookie = "acc_lectureAudio = off ; path=/"; 473 } 474 }else { 475 alert("Erreur - Votre navigateur ne supporte pas la synthèse vocale."); 476 document.getElementById("config_lecaudio_d").innerHTML = "<span style='color: white;text-align: center;display: flex;' > Votre navigateur ne supporte pas la synthèse vocale. </span>" ; 477 } 478} 479 480function voicesvocal(lg) { 481 var voices = window.speechSynthesis.getVoices(); 482 return voices.filter(function(voice) { 483 return voice.lang.startsWith(lg); 484 }); 485} 486 487document.addEventListener("DOMContentLoaded", function() { 488 489 function sleep(ms) { 490 return new Promise(resolve => setTimeout(resolve, ms)); 491 } 492 async function init() { 493 494 window.speechSynthesis.getVoices().length 495 await sleep(100); 496 497 voicescheck() 498 } 499 init(); 500 501 function voicescheck(){ 502 if ('speechSynthesis' in window && window.speechSynthesis.getVoices().length > 0) { 503 function optionvacal() { 504 505 var langue = document.getElementsByTagName("html")[0].getAttribute('lang'); 506 var voicesFiltered = voicesvocal(langue); 507 if(voicesFiltered.length == 0){ 508 var voicesFiltered = voicesvocal("fr"); 509 } 510 var selectVoices = document.getElementById('acb_voices'); 511 512 selectVoices.innerHTML = ''; 513 voicesFiltered.forEach(function(voice, index) { 514 var option = document.createElement('option'); 515 option.value = index; 516 option.textContent = voice.name; 517 selectVoices.appendChild(option); 518 }); 519 } 520 optionvacal(); 521 document.getElementById('acb_lg').addEventListener('change', optionvacal); 522 document.getElementById('config_lecaudio').addEventListener('click', optionvacal); 523 }else{ 524 document.getElementById("config_lecaudio_d").innerHTML = "<span style='color: white;text-align: center;display: flex;' > Votre navigateur ne supporte pas la synthèse vocale. </span>" ; 525 } 526 } 527 528}); 529 530function readText(event) { 531 var text = event.target.innerText; 532 speechSynthesis.cancel(); 533 event.target.style.border = "3px dashed black" 534 var msg = new SpeechSynthesisUtterance(); 535 var langue = document.getElementsByTagName("html")[0].getAttribute('lang'); 536 var rate = document.getElementById('acb_rate').value; 537 var voice = document.getElementById('acb_voices').value; 538 var voicesFrench = voicesvocal(langue); 539 540 msg.voice = voicesFrench[voice]; 541 msg.rate = rate; 542 msg.pitch = 0; 543 msg.text = text; 544 msg.lang = langue; 545 speechSynthesis.speak(msg); 546 setTimeout(function() { 547 event.target.style.border = ""; 548 }, 3000); 549} 550 551function reinitialiser(){ 552 553 var tpolice = 0.05 * getCookie("policet"); 554 tpolice = 1 - tpolice; 555 556 var itens = document.querySelectorAll("p ,input, a, button"); 557 for(var i = 0; i< itens.length; i++){ 558 var object = itens[i]; 559 var config = window.getComputedStyle(object); 560 var taille = (parseFloat(config.fontSize))*tpolice; 561 object.style.fontSize = taille+"px"; 562 } 563 564 document.cookie = "policet = 0 ; path=/"; 565 566 document.cookie = "grayscale = on ; path=/"; 567 grayscale(); 568 569 document.cookie = "contrast = on ; path=/"; 570 contrast(); 571 572 document.cookie = "liensoulines = on ; path=/";; 573 liensoulines(); 574 575 document.cookie = "opendyslexic = on ; path=/"; 576 opendyslexic(); 577 578 document.cookie = "acc_lectureAudio = on ; path=/"; 579 acc_lectureAudio(); 580} 581 582//
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.