From 6b8fe338154aa311e7e2899f0ef4cfb0a092d190 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Thu, 3 Dec 2020 12:20:13 -0800 Subject: [PATCH 1/4] Style problem difficulty and repo display --- popup.html | 12 ++++++++++++ popup.js | 25 ++++++++++++++++++------- scripts/leetcode.js | 13 ++++++++++--- scripts/welcome.js | 23 +++++++++++++++-------- welcome.html | 13 +++++++++++++ 5 files changed, 68 insertions(+), 18 deletions(-) diff --git a/popup.html b/popup.html index ac0034b1..3d5fbb62 100644 --- a/popup.html +++ b/popup.html @@ -60,9 +60,21 @@




From 7ce0401b0c68eb8a98d3cd9c3de0b7a833cce19e Mon Sep 17 00:00:00 2001 From: Qasim Wani <43754306+QasimWani@users.noreply.github.com> Date: Fri, 4 Dec 2020 01:48:57 +0300 Subject: [PATCH 2/4] adding exception for problem title. null check for problem title --- scripts/leetcode.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/leetcode.js b/scripts/leetcode.js index e07ab9f6..6875144a 100644 --- a/scripts/leetcode.js +++ b/scripts/leetcode.js @@ -168,8 +168,13 @@ function parseQuestion() { const qbody = questionElem[0].innerHTML; // Problem title. - const qtitlte = document.getElementsByClassName('css-v3d350')[0] - .innerHTML; + let qtitlte = document.getElementsByClassName('css-v3d350')[0]; + if(checkElem(qtitle)) { + qtitle = qtitle.innerHTML; + } + else { + qtitle = "unknown-problem"; + } // Problem difficulty, each problem difficulty has its own class. const isHard = document.getElementsByClassName('css-t42afm'); From 3039f1eed767484f377e604dfb947a78bf118ecb Mon Sep 17 00:00:00 2001 From: Jeremy Date: Thu, 3 Dec 2020 14:55:04 -0800 Subject: [PATCH 3/4] Fix typo --- scripts/leetcode.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/leetcode.js b/scripts/leetcode.js index 6875144a..5ab07d05 100644 --- a/scripts/leetcode.js +++ b/scripts/leetcode.js @@ -168,12 +168,11 @@ function parseQuestion() { const qbody = questionElem[0].innerHTML; // Problem title. - let qtitlte = document.getElementsByClassName('css-v3d350')[0]; - if(checkElem(qtitle)) { + let qtitle = document.getElementsByClassName('css-v3d350')[0]; + if (checkElem(qtitle)) { qtitle = qtitle.innerHTML; - } - else { - qtitle = "unknown-problem"; + } else { + qtitle = 'unknown-problem'; } // Problem difficulty, each problem difficulty has its own class. @@ -189,7 +188,7 @@ function parseQuestion() { difficulty = 'Hard'; } // Final formatting of the contents of the README for each problem - const markdown = `

${qtitlte}

${difficulty}


${qbody}`; + const markdown = `

${qtitle}

${difficulty}


${qbody}`; return markdown; } From 860999f6ac59117de229828dfe434210d04d39d5 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Thu, 3 Dec 2020 15:30:39 -0800 Subject: [PATCH 4/4] Remove repo and use leethub_hook --- popup.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/popup.js b/popup.js index d97abb30..b16a51c7 100644 --- a/popup.js +++ b/popup.js @@ -38,18 +38,19 @@ chrome.storage.sync.get('leethub_token', (data) => { $('#commit_mode').show(); /* Get problem stats and repo link */ chrome.storage.sync.get( - ['stats', 'repo'], - (psolved) => { - const { stats, repo } = psolved; + ['stats', 'leethub_hook'], + (data3) => { + const { stats } = data3; if (stats && stats.solved) { $('#p_solved').text(stats.solved); $('#p_solved_easy').text(stats.easy); $('#p_solved_medium').text(stats.medium); $('#p_solved_hard').text(stats.hard); } - if (repo) { + const leethubHook = data3.leethub_hook; + if (leethubHook) { $('#repo_url').html( - `Linked Repo`, + `Linked Repo`, ); } },