Last active
December 23, 2022 19:30
-
-
Save Syynth/bbe7be8e2fafd0b9f51fa2c744d161c8 to your computer and use it in GitHub Desktop.
Add volume slider to Overcast.fm player page
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
(() => { | |
const container = document.createElement('div'); | |
container.innerHTML = | |
`<div>Volume</div> | |
<input type="range" value="1" min="0" step="0.01" max="1">`; | |
document.querySelector('#playcontrols_container').after(container); | |
const audio = document.querySelector('#audioplayer'); | |
const volume = container.querySelector('input[type="range"]'); | |
volume.addEventListener('change', event => { | |
audio.volume = (+event.target.value); | |
}); | |
container.style.display = 'flex'; | |
container.style.flexDirection = 'column'; | |
container.style.alignItems = 'stretch'; | |
container.style.textAlign = 'center'; | |
container.style.accentColor = '#fc7e0f'; | |
container.style.marginBottom = '20px'; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment