1// illicobilite 2 3 4 5function getCookie(nome) { 6 var nomeIgual = nome + "="; 7 var cookies = document.cookie.split(';'); 8 for (var i = 0; i < cookies.length; i++) { 9 var cookie = cookies[i].trim(); 10 if (cookie.indexOf(nomeIgual) === 0) { 11 return cookie.substring(nomeIgual.length, cookie.length); 12 } 13 } 14 return null; 15} 16 17function openMenuAccessibilite() { 18 19 20 var menuAcessibilidade = document.querySelector(".menu_acessibilite"); 21 var estilo = window.getComputedStyle(menuAcessibilidade); 22 var display = estilo.getPropertyValue('display'); 23 24 if (display === "none") { 25 menuAcessibilidade.style.display = "flex"; 26 menuAcessibilidade.focus(); 27 } else { 28 menuAcessibilidade.style.display = "none"; 29 } 30} 31 32document.cookie = "policet = " + (getCookie("policet")) * 1 + " ; path=/"; 33 34if (getCookie("grayscale") == 'on') { 35 36 document.cookie = "grayscale = off ; path=/"; 37 grayscale(); 38} 39 40if (getCookie("contrast") == 'on') { 41 42 document.cookie = "contrast = off ; path=/"; 43 contrast(); 44} 45 46if (getCookie("liensoulines") == 'on') { 47 48 document.cookie = "liensoulines = off ; path=/"; 49 liensoulines(); 50 console.log("teste " + getCookie("liensoulines")); 51} 52 53if (getCookie("opendyslexic") == 'on') { 54 55 document.cookie = "opendyslexic = off ; path=/"; 56 opendyslexic(); 57 58} 59 60if (getCookie("acc_lectureAudio") == "on") { 61 document.addEventListener("DOMContentLoaded", function () { 62 document.cookie = "acc_lectureAudio = off ; path=/"; 63 console.log("cookie lecture audio"); 64 acc_lectureAudio(); 65 }); 66} 67 68if (getCookie("policet") > 0) { 69 70 var tpolice = 0.05 * getCookie("policet"); 71 tpolice = 1 + tpolice; 72 73 console.log("teste - " + tpolice); 74 75 document.addEventListener("DOMContentLoaded", function () { 76 var itens = document.querySelectorAll("p ,input, a, button"); 77 78 for (var i = 0; i < itens.length; i++) { 79 var object = itens[i]; 80 var config = window.getComputedStyle(object); 81 var taille = (parseFloat(config.fontSize)) * tpolice; 82 83 object.style.fontSize = taille + "px"; 84 85 } 86 }); 87 88 89} 90 91function plus_taille() { 92 93 jQuery(document).ready(function () { 94 var policet = parseInt(getCookie("policet")); 95 console.log("taille p " + policet); 96 if (policet < 5) { 97 98 99 var itens = document.querySelectorAll("p ,input, a, button"); 100 101 for (var i = 0; i < itens.length; i++) { 102 var object = itens[i]; 103 var config = window.getComputedStyle(object); 104 var taille = (parseFloat(config.fontSize)) * 1.05; 105 // if(policet == 4){ 106 // console.log(taille); 107 // } 108 109 object.style.fontSize = taille + "px"; 110 111 } 112 113 document.cookie = "policet = " + (policet + 1) + " ; path=/"; 114 115 } 116 117 }); 118} 119 120function moin_taille() { 121 122 jQuery(document).ready(function () { 123 var policet = (getCookie("policet")) * 1; 124 125 if (policet > 0) { 126 var itens = document.querySelectorAll("p ,input, a, button"); 127 128 for (var i = 0; i < itens.length; i++) { 129 var object = itens[i]; 130 var config = window.getComputedStyle(object); 131 var taille = (parseFloat(config.fontSize)) * 0.95; 132 133 object.style.fontSize = taille + "px"; 134 } 135 document.cookie = "policet = " + (policet - 1) + " ; path=/"; 136 } 137 }); 138} 139 140function grayscale() { 141 if (getCookie("grayscale") == "on") { 142 143 var itens = document.querySelectorAll("html"); 144 145 for (var i = 0; i < itens.length; i++) { 146 var object = itens[i]; 147 148 object.classList.remove("gray"); 149 } 150 151 152 153 document.cookie = "grayscale = off ; path=/"; 154 } else { 155 156 var itens = document.querySelectorAll("html"); 157 158 for (var i = 0; i < itens.length; i++) { 159 var object = itens[i]; 160 161 object.classList.add("gray"); 162 } 163 164 165 document.cookie = "grayscale = on; path=/" 166 } 167 168 169} 170 171function contrast() { 172 if (getCookie("contrast") == "on") { 173 174 var itens = document.querySelectorAll("html"); 175 176 for (var i = 0; i < itens.length; i++) { 177 var object = itens[i]; 178 179 object.classList.remove("inverter"); 180 } 181 182 183 document.cookie = "contrast = off ; path=/"; 184 } else { 185 186 var itens = document.querySelectorAll("html"); 187 188 for (var i = 0; i < itens.length; i++) { 189 var object = itens[i]; 190 191 object.classList.add("inverter"); 192 } 193 194 document.cookie = "contrast = on ; path=/"; 195 } 196 197 198} 199 200function liensoulines() { 201 jQuery(document).ready(function () { 202 if (getCookie("liensoulines") == "on") { 203 204 var itens = document.querySelectorAll("a"); 205 206 for (var i = 0; i < itens.length; i++) { 207 var object = itens[i]; 208 209 object.classList.remove("liensoulines"); 210 } 211 document.cookie = "liensoulines = off ; path=/"; 212 } else { 213 214 var itens = document.querySelectorAll("a"); 215 216 for (var i = 0; i < itens.length; i++) { 217 var object = itens[i]; 218 219 object.classList.add("liensoulines"); 220 } 221 console.log("add lien"); 222 document.cookie = "liensoulines = on ; path=/"; 223 } 224 }); 225} 226 227function opendyslexic() { 228 229 jQuery(document).ready(function () { 230 var text = document.querySelectorAll("p ,input ,a ,button ,span ,h1 ,h2 ,h3 ,h4 ,h5 ,h6 ,div"); 231 232 if (getCookie("opendyslexic") == "on") { 233 234 for (var i = 0; i < text.length; i++) { 235 var object = text[i]; 236 237 object.classList.remove("opendyslexic"); 238 } 239 document.cookie = "opendyslexic = off ; path=/"; 240 } else { 241 242 for (var i = 0; i < text.length; i++) { 243 var object = text[i]; 244 245 object.classList.add("opendyslexic"); 246 } 247 document.cookie = "opendyslexic = on ; path=/"; 248 } 249 }); 250 251} 252 253/*function acc_lectureAudio() 254* fonction permettant d'activer la lecture audio 255*/ 256$audioLir = 0; 257 258// document.cookie = "acc_lectureAudio = off ; path=/"; 259 260 261 262function acc_lectureAudio() { 263 264 //if ('speechSynthesis' in window ) { 265 if ('speechSynthesis' in window && window.speechSynthesis.getVoices().length > 0) { 266 //console.log("Votre navigateur supporte la synthèse vocale"); 267 //Dans ce cas, on peut utiliser la synthèse vocale et l'activer 268 //When i click on any element, it will read the title attribute of the element 269 270 //var elements = document.querySelectorAll("p ,input ,a ,button ,span ,h1 ,h2 ,h3 ,h4 ,h5 ,h6"); 271 //Also get div element that are childless 272 var elements = document.querySelectorAll('section, p ,input ,a ,button ,h1 ,h2 ,h3 ,h4 ,h5 ,h6, div, article ');
273 var checkbox = document.getElementById("lecaudio"); 274 275 if (getCookie("acc_lectureAudio") == "off") { 276 277 for (var i = 0; i < elements.length; i++) { 278 var object = elements[i]; 279 280 //if it is a div, check if it has children 281 if (object.tagName == "DIV") { 282 if (object.children.length != 0) { 283 //if it has children, then it is not a leaf node 284 //so we go to the next element 285 continue; 286 } 287 } 288 object.addEventListener('click', readText); 289 object.setAttribute('tabindex', i); 290 291 checkbox.checked = true; 292 // disable_a() 293 } 294 $audioLir = 1; 295 document.cookie = "acc_lectureAudio = on ; path=/"; 296 297 } else { 298 299 for (var i = 0; i < elements.length; i++) { 300 var object = elements[i]; 301 302 //if it is a div, check if it has children 303 if (object.tagName == "DIV") { 304 if (object.children.length != 0) { 305 //if it has children, then it is not a leaf node 306 //so we go to the next element 307 continue; 308 } 309 } 310 object.removeEventListener('click', readText); 311 object.removeAttribute('tabindex', i); 312 313 checkbox.checked = false; 314 speechSynthesis.cancel(); 315 // enable_a(); 316 } 317 $audioLir = 0; 318 document.cookie = "acc_lectureAudio = off ; path=/"; 319 320 } 321 322 } else { 323 alert("Erreur - Votre navigateur ne supporte pas la synthase vocale."); 324 document.getElementById("config_lecaudio_d").innerHTML = "<span style='color: white;text-align: center;display: flex;' > Votre navigateur ne supporte pas la synthase vocale. </span>"; 325 } 326 327} 328 329function voicesvocal(lg) { 330 var voices = window.speechSynthesis.getVoices(); 331 return voices.filter(function (voice) { 332 return voice.lang.startsWith(lg); 333 }); 334} 335 336document.addEventListener("DOMContentLoaded", function () { 337 338 if ('speechSynthesis' in window && window.speechSynthesis.getVoices().length === 0) { 339 function optionvacal() { 340 341 var langue = document.getElementsByTagName("html")[0].getAttribute('lang'); 342 343 var voicesFiltered = voicesvocal(langue); 344 345 var selectVoices = document.getElementById('acb_voices'); 346 347 // Limpar opções existentes 348 selectVoices.innerHTML = ''; 349 console.log("lg: " + langue + ""); 350 // Adicionar opções para cada voz filtrada 351 voicesFiltered.forEach(function (voice, index) { 352 var option = document.createElement('option'); 353 option.value = index; // Valor do Ãndice da voz na matriz 354 option.textContent = voice.name; 355 356 console.log("vozes " + option);// Nome da voz 357 selectVoices.appendChild(option); 358 }); 359 360 361 362 } 363 optionvacal(); 364 document.getElementById('acb_lg').addEventListener('change', optionvacal); 365 document.getElementById('config_lecaudio').addEventListener('click', optionvacal); 366 } else { 367 document.getElementById("config_lecaudio_d").innerHTML = "<span style='color: white;text-align: center;display: flex;' > Votre navigateur ne supporte pas la synthase vocale. </span>"; 368 } 369 370}); 371 372 373function readText(event) { 374 var text = event.target.innerText; 375 speechSynthesis.cancel(); 376 //get only the text from the clicked element and not from its children 377 // for(var i = 0; i< event.target.children.length; i++){ 378 // text = text.replace(event.target.children[i].innerText, ''); 379 // } 380 381 event.target.style.border = "3px dashed black" 382 var msg = new SpeechSynthesisUtterance(); 383 var langue = document.getElementsByTagName("html")[0].getAttribute('lang'); 384 385 var rate = document.getElementById('acb_rate').value; 386 387 var voice = document.getElementById('acb_voices').value; 388 389 var voicesFrench = voicesvocal(langue); 390 391 392 393 394 msg.voice = voicesFrench[voice];; 395 msg.rate = rate; 396 msg.pitch = 0; 397 msg.text = text; 398 msg.lang = langue; 399 speechSynthesis.speak(msg); 400 setTimeout(function () { 401 event.target.style.border = ""; 402 }, 3000); 403} 404 405 406 407 408 409function reinitialiser() { 410 411 var tpolice = 0.05 * getCookie("policet"); 412 tpolice = 1 - tpolice; 413 414 console.log("teste -- " + tpolice); 415 416 417 var itens = document.querySelectorAll("p ,input, a, button"); 418 419 for (var i = 0; i < itens.length; i++) { 420 var object = itens[i]; 421 var config = window.getComputedStyle(object); 422 var taille = (parseFloat(config.fontSize)) * tpolice; 423 424 object.style.fontSize = taille + "px"; 425 426 } 427 428 document.cookie = "policet = 0 ; path=/"; 429 430 431 document.cookie = "grayscale = on ; path=/"; 432 grayscale(); 433 434 document.cookie = "contrast = on ; path=/"; 435 contrast(); 436 437 document.cookie = "liensoulines = on ; path=/";; 438 liensoulines(); 439 440 document.cookie = "opendyslexic = on ; path=/"; 441 opendyslexic(); 442 443 acc_lectureAudio(); 444} 445 446 447 448 449// 450
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.