// ==UserScript== // @name Set HTML5 media player volume // @description Script to set the volume of and elements to reduced value (defaults to 50%), with a menu item to change for the current page. // @namespace JeffersonScher // @author Jefferson "jscher2000" Scher // @copyright Copyright 2017 Jefferson Scher // @license BSD-3-clause // @include * // @version 0.6 // @grant GM_registerMenuCommand // @downloadURL https://update.greasyfork.org/scripts/36270/Set%20HTML5%20media%20player%20volume.user.js // @updateURL https://update.greasyfork.org/scripts/36270/Set%20HTML5%20media%20player%20volume.meta.js // ==/UserScript== var setvol_volumepct = 0.5; // Set volume to 50% // == == == Detect added nodes / attach MutationObserver == == == if (document.body){ // Check existing videos setvol_checkNode(document.body); // Watch for changes that could be new videos var setvol_MutOb = (window.MutationObserver) ? window.MutationObserver : window.WebKitMutationObserver; if (setvol_MutOb){ var setvol_chgMon = new setvol_MutOb(function(mutationSet){ mutationSet.forEach(function(mutation){ for (var setvol_node_count=0; setvol_node_count 0){ for (var j=0; j 1) newnum = 1; setvol_volumepct = newnum; setvol_checkNode(document.body); } } GM_registerMenuCommand('Change volume for this page', chgVol);