Created
July 5, 2022 22:07
-
-
Save dijux/411a2cdb343a7c8df7824a1344eaeecc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var redParts = document.querySelectorAll(".ytp-play-progress.ytp-swatch-background-color"); | |
| var fullCurrentWidth = (redParts.length) * 2*(-1); | |
| var fullWidth = (redParts.length - 1) * 2*(-1); | |
| redParts.forEach((e, index) => { | |
| var width = Number(e.parentElement.parentElement.style.width.replace("px", "")); | |
| var scale = parseFloat(e.style.transform.replace("scaleX(", "").replace(")", "")); | |
| var currentWidth = width * scale; | |
| fullCurrentWidth += (index == redParts.length -1 && scale != 0) ? parseFloat(currentWidth) + 1*2*(-1) : parseFloat(currentWidth); | |
| fullWidth += parseFloat(width); | |
| }); | |
| var fobj1 = { | |
| // currentPercentage: getYtMarkerPosition(obj.currentTimestamp, obj.fullLength), | |
| currentPercentage: redParts.length == 1 ? | |
| parseInt(redParts[playerIndex].style.transform.replace("scaleX(", "").replace(")", "")) | |
| : fullCurrentWidth/fullWidth, | |
| }; | |
| document.querySelectorAll(".ytp-play-progress.ytp-swatch-background-color") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment