-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Use native web browser features instead of jquery #2360
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
Conversation
I think this is a good change. I think updating node to 18 might need to happen, however as that's when fetch is fully supported in node (i'm not sure if browser fetch is used for all requests or if node fetch is being used for some). If node does need to be updated then I think updating the workflows to use node 18 & updating babel for node 18 would be a good idea. Whether included in this PR or a separate one. Note: I have not yet tested this PR but I looked at the code changes and the code looks good to me so far. I would also like to note that 16 is the version that node is currently recommending for most users so updating a development document might be a good idea if node 18 is required: |
@ChunkyProgrammer As far as I can tell all of these fetch calls are run in the chromium part of electron not the node part, as they all work without updating node or electron. Electron 19 still uses node 16 according to the release notes, so 17 and 18 probably do too. This PR shouldn't need any updates to electron or node to work. |
I would also like to see #1525 merged before this PR |
I'll wait until the accessibility PR is merged before fixing the merge conflicts. |
Pull request was closed
Use native webbrowser features instead of jquery
Pull Request Type
Related issue
Please link the issue your pull request is referring to. If this pull request fully resolves the relevant issue, put "closes" before the issue number. Example: "closes #123456".
Description
Due to jquery's popularity most of jquery's features have now become web standards and are implemented into web browsers natively. This pull request replaces all uses of jquery in FreeTube with their web standards counter parts.
Here are some of the changes that I made:
replace
$.getJson()
withfetch()
(docs)replace
$()
and$().get(0)
withdocument.getElementById()
(docs),document.querySelector()
(docs) anddocument.querySelectorAll()
(docs)adding event listeners:
replace
.on()
with.addEventListener()
(docs)replace
.addClass()
and.removeClass()
with.classList.add()
(docs) and.classList.remove()
(docs)replace
.animate({ scrollTop: /* ... */})
with.scrollTo({ top: /* ... */ })
(docs)Testing
Everything should work the same as it did before this PR. It's a good idea to have an instance of the nightly build open, so you can compare the before and after.
0.15.0
in thepackage.json
fileDesktop (please complete the following information):
Additional context
The live chat stops smooth scrolling after a while, this seems to be a chromium/electron limitation, presumably some kind of power saving measure. Thankfully it keeps scrolling, it just jumps to the latest message instead of animating the scroll, manually scrolling still works smoothly, so this only affects scrolling programatically.