From d28b233cff2599492ec7367547c39c3bc74f1e91 Mon Sep 17 00:00:00 2001 From: BRO3886 Date: Sat, 3 Apr 2021 16:28:21 +0530 Subject: [PATCH] fix(gfg): fix timeout and js detection issue --- scripts/gfg.js | 13 ++++++------- scripts/leetcode.js | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/gfg.js b/scripts/gfg.js index 85df52f9..83638874 100644 --- a/scripts/gfg.js +++ b/scripts/gfg.js @@ -55,11 +55,10 @@ function getCode() { let hackyScriptContent = ` console.log("trying to get editor content"); var editorContent = editor.getValue(); - console.log(editorContent); + // console.log(editorContent); var para = document.createElement("pre"); para.innerText+=editorContent; para.setAttribute("id","codeDataLeetHub") - // para.appendChild(node); document.body.appendChild(para); // console.log(para); `; @@ -103,8 +102,8 @@ const gfgLoader = setInterval(() => { let output = document.getElementsByClassName("out")[0].innerText; if (output.includes("Correct Answer")) { // clear timeout - clearTimeout(gfgLoader); - clearTimeout(submission); + clearInterval(gfgLoader); + clearInterval(submission); // get data title = findTitle().trim(); difficulty = findDifficulty(); @@ -152,16 +151,16 @@ const gfgLoader = setInterval(() => { SUBMIT_MSG, "upload" ); - }, 2000); + }, 1000); } }); } } else if (output.includes("Compilation Error")) { // clear timeout and do nothing - clearTimeout(submission); + clearInterval(submission); } - }, 3000); + }, 1000); }); } }, 1000); diff --git a/scripts/leetcode.js b/scripts/leetcode.js index 681efdda..d99799ad 100644 --- a/scripts/leetcode.js +++ b/scripts/leetcode.js @@ -7,6 +7,7 @@ const languages = { Java: '.java', 'C#': '.cs', JavaScript: '.js', + Javascript: '.js', Ruby: '.rb', Swift: '.swift', Go: '.go',