Fakultas Ilmu Komputer UI

Commit ad7ddc9e authored by wajdifarid's avatar wajdifarid
Browse files

Add assignment urls to content script

parent 3eaf1505
......@@ -38,8 +38,23 @@ for (var key in coursePerSemester) {
var courseFooter = myCoursesDiv.getElementsByClassName("footer")[0];
myCoursesContent.insertBefore(newCourseList, courseFooter);
// get assignment urls
var xhr = new XMLHttpRequest();
// get today's assignments
var assignment_urls = null
xhr.onload = function() {
assignment_urls = this.response.getElementsByClassName("referer");
var today_assignment_url = document.getElementsByClassName("today")[0].children[1].href;
xhr.open('GET', today_assignment_url);
xhr.responseType = "document";
// add listener to send assignments data to popup
chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
message: "Ini pesan dari content script untuk popup"
message: assignment_urls[0].innerHTML
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