X-Git-Url: http://git.euphorik.ch/?p=pompage.git;a=blobdiff_plain;f=js%2Fyopyop.js;fp=js%2Fyopyop.js;h=38a761f66f44f3dbf2e4347e3d4bc2e089950656;hp=9c46105d455157a8c83469952948b20c5e089571;hb=758f0146355cf0b6c0745d1e73c94c060fc6405c;hpb=5613a3fda1f8667227866cb1684b8a75efd2d069 diff --git a/js/yopyop.js b/js/yopyop.js index 9c46105..38a761f 100644 --- a/js/yopyop.js +++ b/js/yopyop.js @@ -66,7 +66,11 @@ function doRecherche() && !document.getElementById("checkRechercheActeurs").checked && !document.getElementById("checkRecherchePays").checked) afficherTout = true; - + + var nbFilm = 0; // pour compter le nombre de film total + var nbFilmAffiche = 0; // pour compter le nombre de film affiché + + // le motif à chercher var motif = document.getElementById("recherche").value var rechercheRegExp = new RegExp(".*" + motif + ".*", "i") @@ -74,12 +78,17 @@ function doRecherche() var lignes = liste.childNodes for(i = 0; i < lignes.length; i += 2) { + nbFilm++; + + // extraction des informations du film courant var titre = lignes[i].firstChild.innerHTML var tableDetails = lignes[i+1].firstChild.firstChild.childNodes var genres = tableDetails[0].firstChild.nextSibling.textContent var realisateurs = tableDetails[1].firstChild.nextSibling.textContent var acteurs = tableDetails[2].firstChild.nextSibling.textContent var pays = tableDetails[3].firstChild.nextSibling.textContent + + // si le film satisfait la recherche alors on l'affiche sinon ou le cache if ( afficherTout || document.getElementById("checkRechercheTitre").checked && rechercheRegExp.exec(titre) != null @@ -90,6 +99,7 @@ function doRecherche() { lignes[i].style.display = "table-row" lignes[i+1].style.display = "table-row" + nbFilmAffiche++; } else { @@ -97,6 +107,9 @@ function doRecherche() lignes[i+1].style.display = "none" } } + + // mise à jour de l'affichage du nombre de film total/affiché + document.getElementById("nbFilms").textContent = nbFilmAffiche + " / " + nbFilm + " film" + (nbFilm > 1 ? "s" : "") } /**