Last active
September 20, 2017 17:45
-
-
Save happylynx/16501806388699728799e15629f2f4f7 to your computer and use it in GitHub Desktop.
Video playback rate bookmarklet
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
javascript:(()=>{const%20rateString=%s||window.prompt("Set%20video%20playback%20rate","1.0");const%20rate=parseFloat(rateString);if(isNaN(rate)){window.alert(`Selected%20playback%20rate%20"${rate}"%20cannot%20be%20parsed.`);return}[...document.querySelectorAll('video')].forEach(videoElement=>videoElement.playbackRate=rate)})() |
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
/* | |
* Compatible with "keyword feature (https://superuser.com/questions/540076/how-to-add-keyword-to-bookmark-in-chrome, | |
* https://www-archive.mozilla.org/docs/end-user/keywords.html). Porvided the keyword is "rate", just type to address | |
* bar: | |
* | |
* rate 1.3 | |
*/ | |
(() => { | |
const rateString = %s || window.prompt("Set video playback rate", "1.0"); | |
const rate = parseFloat(rateString); | |
if (isNaN(rate)) { | |
window.alert(`Selected playback rate "${rate}" cannot be parsed.`); | |
return | |
} | |
[...document.querySelectorAll('video')] | |
.forEach(videoElement => videoElement.playbackRate = rate) | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment