Last active
December 8, 2015 21:50
-
-
Save antoineMoPa/95d1b8e97a0a1def4a12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Met les notes en pourcentages dans la grille d'évaluation de www.gel.usherbrooke.ca | |
UTILISATION: Il faut ouvrir la page de l'horaire (dans un nouvel onglet) et faire rouler le code dans la console javascript. | |
Copyright Antoine Morin-Paulhus 2015 | |
Vous pouvez utiliser, modifier et distribuer ce script sous les termes de la license GPL disponible ici: | |
http://www.gnu.org/licenses/gpl-3.0.en.html | |
*/ | |
var items = dataGrille.items; | |
var ponderation_items = dataToolTip; | |
var table_rows = document.querySelectorAll(".dojoxGridMasterView .dojoxGridRow"); | |
for(var i = 0; i < items.length; i++){ | |
var row = table_rows[i].querySelectorAll("td.dojoxGridCell"); | |
for(var j = 0; j < row.length; j++){ | |
// Grid elements are offseted by 3 from the real td elements | |
if(items[i][j-3] != undefined && typeof items[i][j-3][0] == "number"){ | |
if(ponderation_items[i][j-3] != undefined){ | |
var pond = ponderation_items[i][j-3].ponderation; | |
var number = items[i][j-3][0]; | |
var percent = (number / pond * 100).toFixed(1); | |
row[j].innerHTML = "<span style='font-size:8px;'>" + percent + "%</span>"; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment