Skip to content

Instantly share code, notes, and snippets.

@bombadillo
Created September 30, 2023 15:15
Show Gist options
  • Save bombadillo/f168ac8081de29d7c67128b3467f4c75 to your computer and use it in GitHub Desktop.
Save bombadillo/f168ac8081de29d7c67128b3467f4c75 to your computer and use it in GitHub Desktop.
Youtube progress bar segment styling
const progressBar = document.querySelector('.ytp-progress-bar')
progressBar.addEventListener('mouseover', (event) => {
const tooltipContent = document.querySelector(
'.ytp-tooltip-title span'
).innerHTML
if (tooltipContent !== '') {
addStyles();
}
})
function addStyles() {
var style = document.createElement('style')
style.innerHTML = `
.ytp-tooltip-title {
background: white;
padding: 10px;
color: black;
border-radius: 5px;
font-size: 1.5rem;
box-shadow: rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px;
}
.ytp-tooltip-title span {
text-shadow: none;
}
`
document.head.appendChild(style)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment