Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ==UserScript==
- // @name Reddit Auto Unmute Videos
- // @namespace https://greasyfork.org/en/users/85671-jcunews
- // @version 1.0.1
- // @license AGPLv3
- // @author jcunews
- // @description https://www.reddit.com/r/userscripts/comments/eizq63/is_there_a_userscript_to_automatically_unmute_all/
- // @match https://*.reddit.com/*
- // @grant none
- // ==/UserScript==
- (e => {
- //old layout
- document.querySelectorAll('button.volume[data-action="unmute"]').forEach(e => e.click());
- //new layout
- (new MutationObserver(rs => {
- rs.forEach(r => {
- r.addedNodes.forEach((n, b) => {
- if (n.querySelector && (n = b = n.querySelector("._2W9KLflUho3xU7KURAaHwH>button"))) {
- while (n = n.parentNode) {
- if (n.classList.contains("_3QOPLw8PZipW3i8kDxod81")) {
- if ((n = n.querySelector("video")) && n.muted) b.click();
- break
- }
- }
- }
- });
- });
- })).observe(document.body, {childList: true, subtree: true})
- })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement