Skip to content

Instantly share code, notes, and snippets.

@eric-wieser
Last active October 5, 2016 18:24
Show Gist options
  • Select an option

  • Save eric-wieser/07c5e1091af8ad59c306420dc7f46c57 to your computer and use it in GitHub Desktop.

Select an option

Save eric-wieser/07c5e1091af8ad59c306420dc7f46c57 to your computer and use it in GitHub Desktop.
Engineering lecture calendar tool

A tiny script to open a pair of web calendars for your course choices

  1. Visit http://www3.eng.cam.ac.uk/comet/student/y4/module_selection/index.html
  2. Open the web inspector (F12 usually), paste the code below into the javascript console, and hit enter
  3. Two windows should appear, one for each of lent and michaelmas. With any luck, these will open your calendar program, and ask you to add the calendars!
[].slice.call(document.getElementsByTagName('form')[1].getElementsByTagName('table'), 2).map(function(column) {
return [].slice.call(column.getElementsByTagName('tr'), 1).map(function(row) {
return row.getElementsByTagName('td')[0].innerText;
});
}).map(function(courses, term) {
return 'webcal://td.eng.cam.ac.uk/tod/public/view_ical.php?yearval=2016_17&term=' + 'ML'[term] + '&course=' + courses.join(',');
}).forEach(window.open);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment