-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchangeLinks.js
33 lines (23 loc) · 852 Bytes
/
changeLinks.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var base = "https://www.uoguelph.ca/registrar/calendars/undergraduate/2019-2020/courses/";
fixTitles("SEC_SHORT_TITLE_");
fixTitles("CSVIEW1_SHORT_TITLE_");
fixTitles("LIST_VAR6_");
//Dirty work around for fixing title links and preventing webadvisors code from picking them up
function fixTitles(id) {
var i = 1;
element = document.getElementById(id + i);
while(element != null) {
var split = element.innerHTML.split("*");
var newElement = document.createElement('a');
var parent = element.parentNode;
newElement.href = base + split[0].toLowerCase() + split[1] + ".shtml";
newElement.target = "_blank";
newElement.class = element.class;
newElement.innerHTML = element.innerHTML;
newElement.id = element.id;
parent.innerHTML = "";
parent.appendChild(newElement);
i++
element = document.getElementById(id + i);
}
}