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

 
(19 intermediate revisions by the same user not shown)
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 47: Line 66:
 
Search for a content:
 
Search for a content:
 
<!-- multiple dropdown -->
 
<!-- multiple dropdown -->
 +
 +
<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
 +
<!-- AJOUTER ICI LES TAGS de la page -->
 
<select data-placeholder="Choose an option..." id="select-chosen" class="chosen" multiple="true" style="width:400px;">
 
<select data-placeholder="Choose an option..." id="select-chosen" class="chosen" multiple="true" style="width:400px;">
 
<option value="PCR">PCR</option>
 
<option value="PCR">PCR</option>
Line 52: Line 74:
 
<option value="Sequencing">Sequencing</option>
 
<option value="Sequencing">Sequencing</option>
 
</select>
 
</select>
 +
<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
 +
 +
 
<script type="text/javascript">
 
<script type="text/javascript">
 
//Enable jQuery chosen
 
//Enable jQuery chosen
Line 57: Line 82:
 
     disable_search_threshold:10,
 
     disable_search_threshold:10,
 
     no_results_text: "Oops, nothing found!",
 
     no_results_text: "Oops, nothing found!",
     width: "95%"
+
     width: "105%"
 
});
 
});
 
//Fonction de détection d'un changement dans le champ recherche
 
//Fonction de détection d'un changement dans le champ recherche
 
$(".chosen").chosen().change(function(event) {
 
$(".chosen").chosen().change(function(event) {
     //Hide everything
+
     //Hide everything before doing things
 
     hideALL();
 
     hideALL();
 +
    //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
        //document.getElementById(i).style.display = "inline";
+
    if(filters == null){
        alert(filters[filter]);
+
      showALL();
        var elems = document.querySelectorAll(".'"+filter+"'");
+
    }
        for(i = 0; i < elems.length; i++){
+
    else{
            var week = elems.item(i);
+
//AND STATEMENT
            week.style.display = "inline";
+
      //Construct filter string
            //alert(week);
+
      var filtersString = '';
        }
+
      for (var filter in filters) {
 +
          filtersString = filtersString+'.'+filters[filter];
 +
      }
 +
      var elems = document.querySelectorAll(filtersString);
 +
      //for each elemnts containing all the tags, show it in the document
 +
      for(i = 0; i < elems.length; i++){
 +
          var week = elems.item(i);
 +
          week.style.display = "inline";
 +
      }
 +
//OR STATEMENT
 +
/*      for (var filter in filters) {
 +
          //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";
 +
          }
 +
      }
 +
*/
 
     }
 
     }
    alert('Kirikou');
 
 
});
 
});
 
</script>
 
</script>
Line 80: Line 124:
 
<button type="button" id="btn_hide">Hide</button>
 
<button type="button" id="btn_hide">Hide</button>
 
<script type="text/javascript">
 
<script type="text/javascript">
$('#btn_hide').click(function() {
+
//$('#btn_hide').click(function() {
     //alert('test');
+
     //toggle('week2');
    toggle('week2');
+
//});
});
+
 
</script>
 
</script>
 
   <ul>
 
   <ul>

Latest revision as of 12:38, 17 July 2015

Notebook

Search for a content: