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 option) playlist popup button #1832

Merged
merged 7 commits into from
Nov 15, 2023

Conversation

MAZ01001
Copy link
Contributor

More info is in #1805 section [2].

The option is under the Playlist menu and is defaulted off.

Works with (tested):

  • open a playlist page
  • open a video page (with a playlist)
  • change the video in the playlist panel (video page)
  • change to the mini player (with playlist)
  • change video in the playlist panel (in mini player)
  • navigate to a different playlist page (within YouTube, without reloading the page)
  • open another video page (with another playlist)

The button may reappear with some delay when it is removed by page updates.

WIP of code-charity#1805 [2]

Idea is to have a popup button in every playlist menu (mini player with playlist / video page with playlist / playlist page)
changed playlist popup setting name and section
finished functionality (split into two functions)
- create a popup button element
- adds or updates popup buttons to the UI
@ImprovedTube
Copy link
Member

🥰🥰

@ImprovedTube ImprovedTube merged commit bbe2df3 into code-charity:master Nov 15, 2023
@ImprovedTube
Copy link
Member

wish we could do both: merge & keep it open for bragging.

@ImprovedTube
Copy link
Member

The button may reappear with some delay when it is removed by page updates.

critical! 🥳 449fbdc
please adopt init.js, functions.js, core.js! (in other words: the author of these is gone, so they should have comments /documentation.)

@@ -34,6 +34,9 @@ ImprovedTube.observer = new MutationObserver(function (mutationList) {
for (var j = 0, k = mutation.addedNodes.length; j < k; j++) {
ImprovedTube.childHandler(mutation.addedNodes[j]);
}
for (const node of mutation.removedNodes){
Copy link
Member

Choose a reason for hiding this comment

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

we might should fix our other playlist buttons like this too @MAZ01001 👍

Copy link
Contributor Author

@MAZ01001 MAZ01001 Feb 21, 2024

Choose a reason for hiding this comment

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

Yes, or really every element that gets inserted into the DOM

That's how I wrote this playlist-popup button:

  1. One function that only creates the button (as an object) and returns it (does not insert it into the DOM)
  2. and another that checks if it should add a button to the current page (and adds it via 1.) or update any existing buttons

Then 2. can be called anytime since it checks for itself if it should insert something to the DOM, so I added it to every page where a button might be needed (in the ImprovedTube.childHandler) and whenever any existing buttons got deleted by YT (the for-loop you highlighted).

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.

2 participants