1import {rendreDiaposInteractifs} from 'diapo-utils' 2 3$(document).ready( () => { 4 5 let boutons_fiches = document.getElementsByClassName("button-fiche-annuaire"); 6 7 for (let i=0;i<boutons_fiches.length;i++) { 8 boutons_fiches[i].addEventListener("click",() => { 9 afficherChargement(); 10 initialiserFiche(boutons_fiches[i].dataset.slug, boutons_fiches[i].dataset.route); 11 }); 12 } 13 14 function afficherChargement() { 15 let loadingContainer = document.createElement("div"); 16 loadingContainer.classList.add("loading-container"); 17 document.body.insertAdjacentElement('beforeend',loadingContainer); 18 let loading = document.createElement("div"); 19 loading.classList.add("loading"); 20 loadingContainer.appendChild(loading); 21 } 22 23 function addCloseListener() { 24 document.getElementById("close-popup").addEventListener("click", () => { 25 document.getElementsByClassName("popup")[0].remove(); 26 $('body').css({ 27 marginRight: 0, 28 overflow: 'auto' 29 }); 30 $('.fixed-top').css({ 31 marginRight: 0 32 }); 33 }); 34 } 35 36 function initialiserFiche(ficheSlug, ficheRoute) { 37 let httpRequest = new XMLHttpRequest(); 38 let url = ficheRoute; 39 40 if (!httpRequest) { 41 return false; 42 } 43 httpRequest.onreadystatechange = traiterReponseFiche; 44 httpRequest.open('GET', url); 45 httpRequest.send(); 46 47 function traiterReponseFiche() { 48 if (httpRequest.readyState === XMLHttpRequest.DONE) { 49 if (httpRequest.status === 200) { 50 remplirFiche(); 51 } else { 52 console.log("Erreur: la requête vers %s n'a pas abouti", url); 53 } 54 } 55 } 56 57 function remplirFiche() { 58 let reponse = httpRequest.responseText; 59 let fiche = construireFiche(reponse); 60 let chargement = document.getElementsByClassName("loading-container")[0]; 61 if (chargement != null) chargement.remove(); 62 var scrollBarWidth = window.innerWidth - document.body.offsetWidth; 63 $('body').css({ 64 marginRight: scrollBarWidth, 65 overflow: 'hidden' 66 }); 67 $('.fixed-top').css({ 68 marginRight: scrollBarWidth 69 }); 70 document.body.insertAdjacentHTML('beforeend',fiche); 71 $('.popup-dialog').css({ 72 marginRight: -scrollBarWidth 73 }); 74 addCloseListener(); 75 rendreDiaposInteractifs(); 76 } 77 78 79 function construireFiche(reponse) { 80 return '<div class="popup">\ 81 <div class="row justify-content-center align-items-center mx-0">\ 82 <div class="col-11 col-sm-8 col-lg-6 popup-dialog fond-blanc p-4 my-4">\ 83 <span id="close-popup"></span>\ 84 <div class="popup-content">'+ 85 reponse + 86 '</div>\ 87 </div>\ 88 </div>\ 89 </div>'; 90 } 91 92 } 93 94});
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.