Skip to content

Instantly share code, notes, and snippets.

@ahollenbach
Created November 15, 2014 05:38
Show Gist options
  • Select an option

  • Save ahollenbach/bad62fbfed0c3d7c6e29 to your computer and use it in GitHub Desktop.

Select an option

Save ahollenbach/bad62fbfed0c3d7c6e29 to your computer and use it in GitHub Desktop.
Adds cluster labels to Master's CS courses on RIT CSH Scheduler.
// Author: Andrew Hollenbach (ahollenbach)
// Instructions:
// Copy and paste the js below into a bookmark "URL" field.
// On the CSH scheduler (http://schedule.csh.rit.edu/browse), expand GCCIS > CSCI.
// Click the bookmark to add cluster labels!
javascript:(function(){
var clusters = {
"CG" : "#1abc9c",
"Data" : "#2980b9",
"Distr" : "#d35400",
"IS" : "#c0392b",
"Lang" : "#2ecc71",
"Sec" : "#e67e22",
"Theory": "#9b59b6"
};
var courses = {
"CSCI-610" : ["CG"],
"CSCI-711" : ["CG"],
"CSCI-712" : ["CG"],
"CSCI-713" : ["CG"],
"CSCI-714" : ["CG"],
"CSCI-715" : ["CG"],
"CSCI-719" : ["CG"],
"CSCI-620" : ["Data"],
"CSCI-621" : ["Data"],
"CSCI-622" : ["Data","Sec"],
"CSCI-720" : ["Data"],
"CSCI-721" : ["Data"],
"CSCI-729" : ["Data","Sec"],
"CSCI-651" : ["Distr","Sec"],
"CSCI-652" : ["Distr"],
"CSCI-654" : ["Distr"],
"CSCI-662" : ["Distr","Sec","Theory"],
"CSCI-759" : ["Distr","Sec"],
"CSCI-762" : ["Distr","Sec","Theory"],
"CSCI-630" : ["IS"],
"CSCI-631" : ["IS"],
"CSCI-632" : ["IS"],
"CSCI-633" : ["IS"],
"CSCI-731" : ["IS"],
"CSCI-732" : ["IS"],
"CSCI-735" : ["IS","Sec"],
"CSCI-736" : ["IS"],
"CSCI-737" : ["IS"],
"CSCI-739" : ["IS","Sec"],
"CSCI-641" : ["Lang"],
"CSCI-740" : ["Lang","Theory"],
"CSCI-742" : ["Lang"],
"CSCI-746" : ["Lang"],
"CSCI-749" : ["Lang","Theory"],
"CSCI-642" : ["Sec"],
"CSCI-734" : ["Sec"],
"CSCI-769" : ["Sec","Theory"],
"CSCI-664" : ["Theory"],
"CSCI-761" : ["Theory"]
};
$("#browse-contents > div.list-group-item.ng-scope.active > div:nth-child(2) > div > div.list-group-item.ng-scope.active > div:nth-child(2) > div").children().each(function(e) {
var courseName = $(this).find("div h4").html();
if(courseName in courses) {
var relevantClusters = courses[courseName];
for (var i = relevantClusters.length - 1; i >= 0; i--) {
var style = "style ='color:#FFF;padding:2px;margin:5px;-webkit-border-radius: 3px;-moz-border-radius: 3px;border-radius: 3px;background-color:" + clusters[relevantClusters[i]] + "'";
$(this).find("div h4").after("<span " + style + ">" + relevantClusters[i] + "</span>");
}
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment