1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
Oinktube/plugin/Bookmark/script.js
Daniel Neto 254c74323f Update
2024-07-03 19:01:42 -03:00

20 lines
No EOL
628 B
JavaScript

function adjustMarkerWidths() {
const markers = document.querySelectorAll('.vjs-marker');
const totalWidth = 100; // Representing 100%
markers.forEach((marker, index) => {
const currentLeft = parseFloat(marker.style.left);
let nextLeft = totalWidth;
if (index < markers.length - 1) {
nextLeft = parseFloat(markers[index + 1].style.left);
}
const width = nextLeft - currentLeft;
marker.style.width = `calc(${width}% - 3px)`;
marker.classList.add('marker-width-changed');
});
}
document.addEventListener("DOMContentLoaded", adjustMarkerWidths);