mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 09:07:45 +01:00
Changed endscreen check to use replay button instead.
This commit is contained in:
parent
ac3d27bf88
commit
d1748f1758
1 changed files with 9 additions and 6 deletions
|
@ -1130,13 +1130,16 @@ function getRoughCurrentTime(): number {
|
|||
let htmlCurrentTimeString = document.querySelector(".ytp-time-current").textContent;
|
||||
let htmlDurationString = document.querySelector(".ytp-time-duration").textContent;
|
||||
|
||||
// Used to check if endscreen content is visible
|
||||
let endScreenContent = document.querySelector(".ytp-endscreen-content");
|
||||
// Used to check autoplay display
|
||||
let autoPlayDisplay: HTMLDivElement = document.querySelector(".ytp-upnext");
|
||||
if (htmlCurrentTimeString == htmlDurationString) {
|
||||
// At the end of the video
|
||||
return video.duration;
|
||||
}
|
||||
|
||||
if (htmlCurrentTimeString == htmlDurationString
|
||||
|| endScreenContent.childElementCount > 0 || autoPlayDisplay.style.display !== "none") {
|
||||
// Used to check if replay button
|
||||
let playButtonSVGData = document.querySelector("ytp-play-button")?.querySelector("ytp-svg-fill")?.getAttribute("d");
|
||||
let replaceSVGData = "M 18,11 V 7 l -5,5 5,5 v -4 c 3.3,0 6,2.7 6,6 0,3.3 -2.7,6 -6,6 -3.3,0 -6,-2.7 -6,-6 h -2 c 0,4.4 3.6,8 8,8 4.4,0 8,-3.6 8,-8 0,-4.4 -3.6,-8 -8,-8 z";
|
||||
|
||||
if (playButtonSVGData === replaceSVGData) {
|
||||
// At the end of the video
|
||||
return video.duration;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue