Widget: StatToggle

From Mr Love Queen's Choice
Jump to: navigation, search
   <input type="checkbox" id="stat-toggle" placeholder="Search" onclick="toggleStats();" style="webkit-box-shadow: none; box-shadow: none;"> Toggle Single / Combined Stats

<script type="text/javascript">

   function toggleStats() {
       var checkbox = document.getElementById("stat-toggle");
       var singleStats = document.getElementsByClassName("single-stat-row");
       var combinedStats = document.getElementsByClassName("combined-stat-row");
       if (checkbox.checked) {
           for (var i = 0; i < singleStats.length; i++) {
                 var singleStat = singleStats[i];
                 singleStat.style.display = 'none';
           }
           for (var i = 0; i < combinedStats.length; i++) {
                 var combinedStat = combinedStats[i];
                 combinedStat.style.display = ;
           }
       } else {
           for (var i = 0; i < singleStats.length; i++) {
                 var singleStat = singleStats[i];
                 singleStat.style.display = ;
           }
           for (var i = 0; i < combinedStats.length; i++) {
                 var combinedStat = combinedStats[i];
                 combinedStat.style.display = 'none';
           }
       }  
   }

</script>