Created
November 1, 2017 02:57
-
-
Save solarshado/bd733596aca6c8abbad001d335396155 to your computer and use it in GitHub Desktop.
JS one-liner/bookmarklet to set volume of audio/video controls
This file contains 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
/* gets value between 0-1 or 2-100 with prompt() and sets volume of all <audio> and <video> tags to that fraction */ | |
(function(n){if(n>1) n/=100; if(n>1) n=1; if(!n) return; var g=t=>Array.from(document.getElementsByTagName(t)); var e=g("audio").concat(g("video")); e.forEach(p=>p.volume=n);})(+prompt("enter volume")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment