-
Notifications
You must be signed in to change notification settings - Fork 2
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 button not being inject #33
Conversation
newYouTube.injectCommentsCount(e) | ||
}, 500) | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Case of issue: heart-action typed video watched then next another video.
The next video's parse target comments node is rewritten late.
} else { | ||
clearInterval(tryRewrite); | ||
} | ||
}, 100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fetch of the number of comments may end before the button's injection. So wait for the button.
Checked out the branch and ran it locally but I'm still seeing the issue on this video of the button not being injecting. I can try having a better look tomorrow night. |
No, this was my mistake, I was in the master branch locally (Master doesn't contain this fix). |
Here are the steps I'm using to reproduce the bug:
If dynamic navigation is used for the last step, for example clicking on the video from another video, then the button will be injected as expected. Otherwise with static navigation, the button isn't being injected. I'll be able to help with the debugging later this week. |
Well...apparently it seems that whether or not we are logged into YouTube affects the behavior. I use a separate Chrome account for development, and I haven't logged into YouTube over there. As I tried with YouTube logged in then static navigation to video, so didn't work as you said. The specific cause is yet to be understood. Please help me if I can't solve it by the weekend…! 🙏 |
😱 That was a tricky one to find, good spot. I think it's time to introduce some automated tests (#9). There are a lot of cases we have to cover now and doing it manually is becoming too time consuming. I'll try starting that this weekend. 🤞 |
( | ||
e.target.tagName === 'YTD-ITEM-SECTION-RENDERER' || // this mean: rendered childNode of comments'DOM(<ytd-comments>) | ||
e.target.tagName === 'YTD-CREATOR-HEART-RENDERER' // this case: video type with heart action to user comments by creator. | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix problem the user logged in YouTube and watching video with heart-action-comment page.
@dideler, I fixed an issue where the logged in user and the un-logged in user behaved differently. My local is working well in either state, on the issue video page! Please check this again. 🤞 |
c0e45d6
to
ade568a
Compare
ade568a
to
8384575
Compare
Hey @1natsu172, sorry for the slow reply and thanks for your patience! I tried the fix with the latest changes and it worked on video I listened to every YT event I could find const events = [
'yt-action',
'yt-add-element-to-app',
'yt-autonav-pause-blur',
'yt-autonav-pause-focus',
'yt-autonav-pause-guide-closed',
'yt-autonav-pause-guide-open',
'yt-autonav-pause-player',
'yt-autonav-pause-player-ended',
'yt-autonav-pause-player-scroll',
'yt-focus-searchbox',
'yt-guide-close',
'yt-guide-toggle',
'yt-history-load',
'yt-history-pop',
'yt-masthead-height-changed',
'yt-navigate',
'yt-navigate-finish',
'yt-navigate-set-page-offset',
'yt-navigate-start',
'yt-page-type-changed',
'yt-page-data-updated',
'yt-preconnect-urls',
'yt-register-action',
'yt-report-form-closed',
'yt-report-form-opened',
'yt-request-panel-mode-change',
'yt-retrieve-location',
'yt-service-request-completed',
'yt-set-theater-mode-enabled',
'yt-swatch-changed',
'yt-theater-mode-allowed',
'yt-unregister-action',
'yt-update-title',
'yt-update-unseen-notification-count',
'yt-visibility-refresh',
];
events.forEach(eventName => {
console.log(`listening for ${eventName}`);
document.addEventListener(eventName, e => {
console.log(e);
});
}); And I noticed that the event See the result in #35 and give it a try. It also benefits from not showing the loading animation by the comments which would appear with the timer strategy, which could confuse users as it looks like comments are about to show and then they are hidden. |
Thanks for checking. As an aside, I had seen a lot of "yt-*" events when I implemented the number of comments, but it seems I didn't have |
Interestingly, the event I'm not sure if |
Issue: #31
Button was not injected in the video with creator-heart-action in the comment.
Compared to other video pages this video type is slow to load comments.
Moreover, when navigating from this video type to another video, it turned out that the rewriting of the parse target node was delayed.