Skip to content

Commit

Permalink
Add Question Link in leetcode readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
Tumin Sheth committed Dec 15, 2021
1 parent e59e311 commit bf31d77
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/leetcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,10 @@ function getProblemNameSlug(){

/* Parser function for the question and tags */
function parseQuestion() {
var questionUrl = window.location.href
if(questionUrl.endsWith('/submissions/')){
questionUrl = questionUrl.substring(0, questionUrl.lastIndexOf("/submissions/")+1)
}
const questionElem = document.getElementsByClassName(
'content__u3I1 question-content__JfgR',
);
Expand Down Expand Up @@ -410,7 +414,7 @@ function parseQuestion() {
difficulty = 'Hard';
}
// Final formatting of the contents of the README for each problem
const markdown = `<h2>${qtitle}</h2><h3>${difficulty}</h3><hr>${qbody}`;
const markdown = `<h2>${qtitle}</h2><h3>${difficulty}</h3><hr><a href="${questionUrl}">Question Link</a><hr>${qbody}`;
return markdown;
} else if(checkElem(questionDescriptionElem)){

Expand Down

0 comments on commit bf31d77

Please sign in to comment.