Skip to content

Commit df21d08

Browse files
committed
Fix current time being wrong when at end of video on new YouTube layout
Fixes ajayyy#2343
1 parent 7a605b8 commit df21d08

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/content.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2063,9 +2063,11 @@ function updateEditButtonsOnPlayer(): void {
20632063
function getRealCurrentTime(): number {
20642064
// Used to check if replay button
20652065
const playButtonSVGData = document.querySelector(".ytp-play-button")?.querySelector(".ytp-svg-fill")?.getAttribute("d");
2066+
const playButtonSVGDataNew = document.querySelector(".ytp-play-button")?.querySelector("path")?.getAttribute("d");
20662067
const 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";
2068+
const replaceSVGDataNew = "M11.29 2.92C14.85 1.33 18.87 1.06 22";
20672069

2068-
if (playButtonSVGData === replaceSVGData) {
2070+
if (playButtonSVGData === replaceSVGData || playButtonSVGDataNew.startsWith(replaceSVGDataNew)) {
20692071
// At the end of the video
20702072
return getVideoDuration();
20712073
} else {

0 commit comments

Comments
 (0)