Last active
November 5, 2021 04:43
-
-
Save marcinantkiewicz/0f691a69d9aaf140ae0234c76f11a175 to your computer and use it in GitHub Desktop.
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
// userscript parts to pause playback in all open tabs, save for the current one. | |
// handles http video and audio tags, this will pause what is playing. | |
// Swap pause() to play() to reverse. Other controls: | |
// .volume (goes on interval from 0-1.0) | |
// .muted (bool) | |
['video','audio'].forEach((tag)=>{ | |
player = document.getElementsByTagName(tag) | |
if(!![...player].find((e)=>e && !(e.paused && e.ended && e.muted))){ | |
player[0].pause() | |
} | |
}) | |
// storage - session/localStorage for same domain, else GM_setValue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment