Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: πŸ› LeetCodeV2 detection mechanism #54

Closed
wants to merge 1 commit into from

Conversation

csbt
Copy link

@csbt csbt commented Nov 17, 2023

Content

  • Update LeetCodeV2 detection mechanism;
  • Rehandle submit by keyboard shortcuts;
  • Use MutationObserver to determine when the submit button elements are loaded

Note

  • Submit by Keyboard Shortcuts only support on LeetCode v2
  • Detecting LeetCodeV2 by the presence of submit button is really make sense

BREAKING CHANGE: 🧨 Detecting LeetCodeV2 by the presence of submit button

βœ… Closes: #51

Update LeetCodeV2 detection mechanism; Rehandle submit by keyboard
shortcuts; Use MutationObserver to determine when the submit button
elements are loaded

BREAKING CHANGE: 🧨 Detecting LeetCodeV2 by the presence of submit button

βœ… Closes: QasimWani#51
@csbt
Copy link
Author

csbt commented Nov 17, 2023

Perhaps you will wonder about the lines 1037~1038 in the script/leetcode.js file.
In the default mode of LeetCodeV2, we have three textarea element and the main textarea element is 2nd (index = 1).
When use raw testcase editor (below image), we have four textarea element and the main textarea element is 3rd (index = 2).

Line 1037~1038:

const textareaList = document.getElementsByTagName('textarea');
const textarea = textareaList.length === 4 ? textareaList[2] : textareaList[1];

Use raw testcase editor:

image

@arunbhardwaj
Copy link
Owner

Merged in PR #52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extension stopped working
2 participants