Skip to content

Instantly share code, notes, and snippets.

@PoomSmart
Last active February 16, 2018 12:09
Show Gist options
  • Save PoomSmart/b03208d446624791847a32639cbf6cb8 to your computer and use it in GitHub Desktop.
Save PoomSmart/b03208d446624791847a32639cbf6cb8 to your computer and use it in GitHub Desktop.
My Courses recolored cancel classes.
$(function() {
if (top.location.hostname === "mycourses.ict.mahidol.ac.th") {
var events = $(".calendar_event_group");
var eventLinks = $(".calendar_event_group > a");
$.each(events, function() {
var link = this.childNodes[0];
if (typeof link.text != 'undefined' && link.text.startsWith("Cancel")) {
this.style.backgroundColor = this.style.borderColor = "#ffb3b3";
var day = this.parentElement.parentElement.childNodes[0].childNodes[0].text;
$.each(eventLinks, function() {
if (this.text === day) {
this.parentElement.style.backgroundColor = "#ffb3b3";
return false;
}
});
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment