Last active
May 27, 2020 08:00
-
-
Save baoanhng/a0baae3f04b73e39c757645018e4ea56 to your computer and use it in GitHub Desktop.
Persist FB volume
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
// ==UserScript== | |
// @name Facebook video volume persistence | |
// @namespace http://tampermonkey.net/ | |
// @version 1.1 | |
// @description Maintains set volume of videos on play of videos on Facebook. | |
// @include https://facebook.com/* | |
// @include https://www.facebook.com/* | |
// @grant GM_setValue | |
// @grant GM_getValue | |
// ==/UserScript== | |
(function () { | |
"use strict"; | |
var volume = 0.3; | |
setInterval(() => { | |
var videos = document.querySelectorAll('video'); | |
for (let video of videos) { | |
video.addEventListener('play', (e) => { | |
// console.log(e.target.volume); | |
e.target.volume = volume; | |
// console.log(volume); | |
}); | |
} | |
}, 1000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment