Skip to content

Commit

Permalink
Bug fix temporary
Browse files Browse the repository at this point in the history
Fixed a bug with temporary solution
  • Loading branch information
DrakenWan committed Dec 8, 2021
1 parent fe482dd commit bfdb9f5
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions scripts/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ function extract() {

//first, extract out the array of nodes containing different sections
var acc_nodes = document.querySelectorAll(".pv-accomplishments-section > div")
if(acc_nodes.length != 0) {
if(acc_nodes.length != 0) {//check accomplishments nodelist length is not 0
var course_nodes = acc_nodes[0].querySelectorAll("div > ul > li");
var project_nodes = acc_nodes[1].querySelectorAll("div > ul > li");
var lang_nodes = acc_nodes[2].querySelectorAll("div > ul > li");
Expand All @@ -331,20 +331,14 @@ function extract() {
var courses = []
if(course_nodes) { //if course_nodes exists

for(var node of course_nodes) {
var courseNameNode = node.querySelector("h4")
var course_name = courseNameNode?.textContent.replace("Course name", "") || null
var courseCodeNode = node.querySelector("p")
var course_code = courseCodeNode?.textContent.replace("Course number", "") || null

courses.push({
"courseName": getCleanText(course_name),
"courseCode": getCleanText(course_code)
});
for(var nodo of course_nodes) {
var courseName = nodo.textContent;
courses.push(
getCleanText(courseName)
);
}
//alert(acc_nodes.length)
}
}
}
/////COURSES EXTRACTION ENDS HERE/////


Expand Down Expand Up @@ -429,4 +423,4 @@ function getCleanText(text) {
}


//////// * ----- UTILS ENDS -------* /////////
//////// * ----- UTILS ENDS -------* /////////

0 comments on commit bfdb9f5

Please sign in to comment.