Skip to content

Commit

Permalink
fix(gfg): fix timeout and js detection issue
Browse files Browse the repository at this point in the history
  • Loading branch information
BRO3886 committed Apr 3, 2021
1 parent 356910e commit d28b233
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
13 changes: 6 additions & 7 deletions scripts/gfg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
`;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
1 change: 1 addition & 0 deletions scripts/leetcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const languages = {
Java: '.java',
'C#': '.cs',
JavaScript: '.js',
Javascript: '.js',
Ruby: '.rb',
Swift: '.swift',
Go: '.go',
Expand Down

0 comments on commit d28b233

Please sign in to comment.