From bfdb9f5ab6a7cc14a42ac02c061000e93727f8ac Mon Sep 17 00:00:00 2001 From: Draken Wan Date: Wed, 8 Dec 2021 06:52:00 +0530 Subject: [PATCH] Bug fix temporary Fixed a bug with temporary solution --- scripts/content.js | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/scripts/content.js b/scripts/content.js index c73dc00..32bca0f 100644 --- a/scripts/content.js +++ b/scripts/content.js @@ -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"); @@ -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///// @@ -429,4 +423,4 @@ function getCleanText(text) { } -//////// * ----- UTILS ENDS -------* ///////// +//////// * ----- UTILS ENDS -------* ///////// \ No newline at end of file