Closed sn-o-w closed 2 weeks ago
Because the URL does not update when switching within the same section, "isHighlightStory" will only be called once. In summary, your approach will cause the video thumbnail detection function to fail. @sn-o-w
Because the URL does not update when switching within the same section, "isHighlightStory" will only be called once. In summary, your approach will cause the video thumbnail detection function to fail. @sn-o-w
Can't we use "scroll" event listener for this instead of relying on URL? I mean for both stories and highlights? 🤔
Basically, to use "scroll" event listener as long as the adress bar contains "/stories/" and/or "/highlights/". 🤔
Do you have code samples?
Do you have code samples?
Nope. The thing related to "scroll" event listener was just a plain idea. 🤔
I didn't find a listener for the scroll event in DevTools, so I don't think the scroll event is triggered when switching stories or highlights
I didn't find a listener for the scroll event in DevTools, so I don't think the scroll event is triggered when switching stories or highlights
Can't we use "load" and "loadedmetadata" event listeners as long as the adress bar contains "/stories/" and/or "/highlights/"? "load" is used for photos and "loadedmetadata" for videos. They are triggered always for stories and highlights, is either "load" or "loadedmetadata". 🤔
This would lead to a more correct behaviour instead of relying on manual timers.
But they are dynamically inserted DOM elements, so you still need to manually add listeners through timers such as setTimeout. In fact, there is no fundamental difference from the current implementation method.
But they are dynamically inserted DOM elements, so you still need to manually add listeners through timers such as setTimeout. In fact, there is no fundamental difference from the current implementation method.
The thing is, sometimes thumbnail button is still missing. Relying on these event listeners could make a positive impact.
In fact, thumbnails already have event listeners, right?
In fact, thumbnails already have event listeners, right?
Recently, we worked on something related to stories and highlights that involved event listeners, which were originally meant to remove buttons but not for adding the buttons. 🤔
That's right, but I'm referring to the timeupdate event listener added earlier.
But maybe we can start with the audio observer that I just updated. Wait for me.
I changed it to check whether the thumbnail is inserted through the audio observer. You can see if there are any related issue with this way of writing. @sn-o-w
@SN-Koarashi Should I check the latest commits or the commits in this PR? 🤔
the comments in this PR
So I just updated the script inside Violentmonkey and I need more time to test it.
One thing I saw a few secs ago:
I've switched from a highlight section to another highlight section and this happened.
For some reason, only thumbnail button spawned. 🤣
@SN-Koarashi Since thumbnail button inside highlights/stories relies now on event listener, the regular buttons (download & preview) don't rely on event listener.
As I said, it looks like event listeners like 'timeupdate' does indeed seem to lead to more accurate timing. 🤔
The main thing is to insert the event listener through the observer, which ensures that the event is inserted after the DOM is generated.
But judging from the thumbnail, at least it works well and can be merged, right?
But judging from the thumbnail, at least it works well and can be merged, right?
So far, it doesn't seem to cause any harm. 🤔
@SN-Koarashi What am I missing?
It will work if you switch from a highlights section to another highlights section, but if you scroll highlights inside same section, you won't see "isHighlightsStory" triggering in console between them. 🤔