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

New Leetcode UI #465

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

New Leetcode UI #465

wants to merge 3 commits into from

Conversation

varun-s22
Copy link

Here is a temporary solution to this problem, using merely DOM manipulation.
I tried to edit the code in the same file, but there were some functions which are not written asynchronously, but their intended work is the to produce the async effect.

I created a new file called newLeetcode.js, which has all these synchronous functions, for the newer version of Leetcode,
There are certain major updates awaiting this like:

  • Removing setTimeOut, setInterval, etc and making them async functions
  • Migrating from manifest v2 to v3, as its been deprecated in 2023
  • Refactoring a lot of code.

But currently here is the future work, as this solution lacks these features:

  • Currently this only pushes ReadMe (i.e question title, description.etc), and the solution, the Notes.md is not supported.
  • The difficulty of the problem is not available in the DOM, so in this PR, we don't show the difficulty
  • The questions from explore section are not considered.
  • The normal questions/solutions are being pushed only once.

The problems faced are:

  • Difficulty of the question is not available on the submission page DOM, so one can't just fetch it. One possible solution to it can be scanning the main(description) page of the question, and then storing the difficulty in the storage (more of a local storage).
  • The readme and the accepted code were being repeatedly uploaded to Github, as there is no workaround this. In previous UI, the successTag has only 1 class, and then after submission 2 classes are present. We can catch the one time uploading here (in the previous UI), but in this new UI, we don't have such a element to have a check. One workaround solution was to keep a check on code element, and the re-routing, as the page re-routes first, and then loads these components, so we may have a window for one-time execution, but again we were fetching the language/statistics of the solution, from the solution page, and so this fails.
  • Migrating from v2 to v3, may lead to a local undefined error in chrome.storage.local.

These issues/future work shall be addressed in a new PR, but for the time being, here is the output

Now the readMe can be easily pushed to github with the new leetcode
Here are features which are currently extracted

* Problem Title
* Problem Link
* Problem Statement
* Problem Description
* Language used by the user
* Submission stats
Now the code can be easily pushed as well
The Code and the ReadMe(question statement) can be pushed to github,
All the features are extracted. Notes/Discussions are not extracted
Fixed repeatly uploading of files
Currently one file/solution can be pushed one time.
@varun-s22
Copy link
Author

@QasimWani would you please review this?

@@ -0,0 +1,535 @@
/* Enum for languages supported by LeetCode. */
const programmingLanguages = {
Python: '.py',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are the changes done in this js file?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were basically DOM manipulation changes that I fixed with the new UI, but since i had to run it parallel with the old UI, i made a new file called newleetcode.js, which had the same boilerplate as leetcode.js , the old UI file, but with different methods and member functions. There is one major problem as discussed in the PR, which if someone helps me with, I can fix it. I have found the fix for difficulty tag of the problem and this can be migrated to v3 in the next PR, but for now, i want to address the 2nd issue.
Feel free to merge this in the dev branch, and later we can merge it to main

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @sandeepk97 what do u think about merging these changes?

@Ross-Finnegan
Copy link

Any update on this MR?

@yuletide
Copy link

yuletide commented Feb 13, 2023

Any updates? Looks like there are two competing PRs to fix this, the other had some activity from the author last month

@varun-s22
Copy link
Author

This PR was never reviewed, so there was no further development. :(
I'll try to add some changes, but until and unless no one reviews them, all i can do is wait.

@varun-s22
Copy link
Author

hey @abhinav7sinha, thanks for approving the changes.. if there's still no progress on this issue.. i can update this PR, and start working on this. although merging is blocked and requires a review from those with write access

@abhinav7sinha
Copy link

hey @abhinav7sinha, thanks for approving the changes.. if there's still no progress on this issue.. i can update this PR, and start working on this. although merging is blocked and requires a review from those with write access

Oh, right @varun-s22 I don't think it's a good idea to work on it until someone with write access approves it. Hopefully, it happens soon. This is a fairly useful project, and it will be a shame if it's not maintained well

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.

7 participants