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 DeArrow resetting tab titles of uploader-defined title translations #284

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

54ac
Copy link

@54ac 54ac commented Aug 16, 2024

  • I agree to license my contribution under GPL-3.0 and agree to allow distribution on app stores as outlined in LICENSE-APPSTORE

To test this pull request, follow the instructions in the wiki.


This adds support for uploader-defined translated tab titles for videos. Currently, DeArrow fires setCurrentVideoTitle on every video, including those without any custom titles, which resets the tab title back to the original, un-translated title on page load.

This simple workaround fixes this issue, although ideally setCurrentVideoTitle should probably only fire for videos with custom titles available, and the title variable should be dynamically updated (maybe reuse setupTitleChangeListener?)

@ajayyy
Copy link
Owner

ajayyy commented Aug 16, 2024

Could you show an example of the current implementation failing?

@54ac
Copy link
Author

54ac commented Aug 16, 2024

This applies to any video with a translated title, e.g. this video. The original title gets replaced with its English translation on load (on the page and in the tab title), but with DeArrow enabled the tab title switches back to the original.

@ajayyy
Copy link
Owner

ajayyy commented Sep 5, 2024

I'm not experiencing the issue on my end, the tab title is the translated one. Maybe it's a timing issue depending on load times?

With my understanding of this code, I don't think this change would have any effect.

image

It already fetches directly from the title element right before calling this function. So, that element should already have been updated. If it hasn't been update yet, even with this PR, it would still pull the wrong value from the title element.

@54ac
Copy link
Author

54ac commented Sep 5, 2024

Maybe it's a timing issue depending on load times?

I assume so. For me, it loads the original title (as intended), changes the tab title to the translated title on load, then quickly changes it back to the original within a second, so maybe there's some unfortunate timing there.

With my proposed change this doesn't happen, i.e. the title variable in setCurrentVideoTitle seems to not be updated when it fires.

As a workaround, I'm using a userscript with a mutation observer on the title to update it properly.

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