Fakultas Ilmu Komputer UI

Commit a4619a28 authored by Farid Wajdi's avatar Farid Wajdi
Browse files

Setup course filter

parent f3c2b395
var myCoursesDiv = document.getElementById("inst25");
var myCoursesContent = myCoursesDiv.getElementsByClassName("content")[0];
var courses = myCoursesDiv.getElementsByTagName("li")
function getCourseSemester(courseId) {
return 1
}
var coursePerSemester = {};
// Group every course to its semester
for (var i = 0; i < courses.length; i++) {
const courseNode = courses[i];
const courseTitle = courseNode.getElementsByTagName("a")[0].title
const courseUrl = courseNode.getElementsByTagName("a")[0].href
const courseId = courseUrl.slice(courseUrl.indexOf("id=") + 3)
const courseSemester = getCourseSemester(courseId)
if (!coursePerSemester.hasOwnProperty(courseSemester)) {
coursePerSemester[courseSemester] = []
}
coursePerSemester[courseSemester].push(courseNode);
};
// Creating new course list
myCoursesDiv.getElementsByClassName("unlist")[0].remove();
var newCourseList = document.createElement("ul");
newCourseList.setAttribute("class","unlist");
// for (let i = 0; i < gasal2015.length; i++) {
// const element = gasal2015[i];
// newCourseList.appendChild(element)
// }
var courseFooter = myCoursesDiv.getElementsByClassName("footer")[0];
myCoursesContent.insertBefore(newCourseList, courseFooter);
......@@ -3,5 +3,22 @@
"name": "SCELE Fasilkom UI",
"version": "0.1",
"description": "This extension will improve your experience with SCELE in Fasilkom UI",
"author": "Farid Wajdi"
"author": "Farid Wajdi",
"permissions": [
"tabs", "http://*/*", "https://*/*","activeTab", "storage", "declarativeContent"
],
"background": {
"persistent": false,
"scripts": ["background.js"]
},
"content_scripts": [
{
"matches": [
"https://scele.cs.ui.ac.id/*"
],
"js": [
"contentScript.js"
]
}
]
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment