Skip to content

Instantly share code, notes, and snippets.

@antoineMoPa
Last active December 8, 2015 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antoineMoPa/95d1b8e97a0a1def4a12 to your computer and use it in GitHub Desktop.
Save antoineMoPa/95d1b8e97a0a1def4a12 to your computer and use it in GitHub Desktop.
/*
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