Difference between revisions of "Team:Pasteur Paris/test"

Line 37: Line 37:
 
   document.getElementById('week14').style.display = "none";
 
   document.getElementById('week14').style.display = "none";
 
   document.getElementById('week15').style.display = "none";
 
   document.getElementById('week15').style.display = "none";
 +
}
 +
function showALL(){
 +
  //Solution peu propre.
 +
  //TODO: foreach with querySelectotAll
 +
  document.getElementById('week1').style.display = "inline";
 +
  document.getElementById('week2').style.display = "inline";
 +
  document.getElementById('week3').style.display = "inline";
 +
  document.getElementById('week4').style.display = "inline";
 +
  document.getElementById('week5').style.display = "inline";
 +
  document.getElementById('week6').style.display = "inline";
 +
  document.getElementById('week7').style.display = "inline";
 +
  document.getElementById('week8').style.display = "inline";
 +
  document.getElementById('week9').style.display = "inline";
 +
  document.getElementById('week10').style.display = "inline";
 +
  document.getElementById('week11').style.display = "inline";
 +
  document.getElementById('week12').style.display = "inline";
 +
  document.getElementById('week13').style.display = "inline";
 +
  document.getElementById('week14').style.display = "inline";
 +
  document.getElementById('week15').style.display = "inline";
 
}
 
}
 
</script>
 
</script>
Line 65: Line 84:
 
     //Extract filters Tags
 
     //Extract filters Tags
 
     var filters = $("#select-chosen").chosen().val();
 
     var filters = $("#select-chosen").chosen().val();
     for (var filter in filters) {
+
     //If no filters set, show everything
        //Select all elements with class with filter
+
    if(filters.length==0){
        var elems = document.querySelectorAll('.'+filters[filter]);
+
      showALL();
        //for each elemnts containing the tag, show it in the document
+
    }
        for(i = 0; i < elems.length; i++){
+
    else{
            var week = elems.item(i);
+
      for (var filter in filters) {
            week.style.display = "inline";
+
          //Select all elements with class with filter
        }
+
          var elems = document.querySelectorAll('.'+filters[filter]);
 +
          //for each elemnts containing the tag, show it in the document
 +
          for(i = 0; i < elems.length; i++){
 +
              var week = elems.item(i);
 +
              week.style.display = "inline";
 +
          }
 +
      }
 
     }
 
     }
 
});
 
});

Revision as of 11:55, 17 July 2015

Notebook

Search for a content: