-
Notifications
You must be signed in to change notification settings - Fork 0
/
fixer.js
40 lines (32 loc) · 1.24 KB
/
fixer.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
34
35
36
37
38
39
40
(function() {
//var inStr = "CS265[A] - Software Testing (2017: S1)";
//var inStr = "MT212A[A] - Linear Algebra 2 (A) (2017:S2)";
//Selects the courses
var courses = document.getElementsByClassName("course_title");
for(var j = 1; j < courses.length; j++){
//Selects the link title
var anchor = courses[j].getElementsByTagName('a');
var inStr = anchor.item(1).title;
var fullCourse = false;
var fullName = "";
for (var i = 0; i < inStr.length - 3; i++) {
if (inStr.substring(i, i + 3) == "[A]") {
//Adds in the Module Code
fullName += inStr.substring(0, 5);
fullName += " - ";
//Adds in the Module Name
fullName += inStr.substring(i + 6, inStr.length - 10);
fullName += " - ";
//Adds in the Semester the module is covered
fullName += inStr.substring(inStr.length - 3, inStr.length - 1);
//Enables you to replace the code
fullCourse = true;
break;
}
}
//Changes the code if it's a proper module
if(fullCourse){
anchor[1].innerHTML = fullName;
}
}
})();