From fc5f50f7b5910fed347eaa5fbef8f75114aba371 Mon Sep 17 00:00:00 2001 From: Shreya Sinha Date: Fri, 22 Jul 2022 09:16:30 -0400 Subject: [PATCH 1/2] Adding Related Topics in the Commit Message --- scripts/leetcode.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/leetcode.js b/scripts/leetcode.js index 6389a681..a256614d 100644 --- a/scripts/leetcode.js +++ b/scripts/leetcode.js @@ -498,8 +498,18 @@ function parseStats() { const space = probStats[2].textContent; const spacePercentile = probStats[3].textContent; + /* Adding Related Topics in Commit Message */ + const relatedTags = document.getElementsByClassName( + 'topic-tag__1jni', + ); + let allTags = []; + for (let i = 0; i < relatedTags.length; i++) { + allTags.push(relatedTags.item(i).innerText); + } + let relatedTopics = allTags.join('| '); + // Format commit message - return `Time: ${time} (${timePercentile}), Space: ${space} (${spacePercentile}) - LeetHub`; + return `Related Topics: ${relatedTopics}, Time: ${time} (${timePercentile}), Space: ${space} (${spacePercentile}) - LeetHub`; } document.addEventListener('click', (event) => { From 0a1724a64cb044be6ce0ec80cbf017663bdf34e0 Mon Sep 17 00:00:00 2001 From: Shreya Sinha Date: Fri, 22 Jul 2022 09:31:00 -0400 Subject: [PATCH 2/2] Cosmetic change --- scripts/leetcode.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/leetcode.js b/scripts/leetcode.js index a256614d..a5bb28c1 100644 --- a/scripts/leetcode.js +++ b/scripts/leetcode.js @@ -506,7 +506,7 @@ function parseStats() { for (let i = 0; i < relatedTags.length; i++) { allTags.push(relatedTags.item(i).innerText); } - let relatedTopics = allTags.join('| '); + let relatedTopics = allTags.join(' | '); // Format commit message return `Related Topics: ${relatedTopics}, Time: ${time} (${timePercentile}), Space: ${space} (${spacePercentile}) - LeetHub`;