Skip to content

Instantly share code, notes, and snippets.

@baoanhng
Last active May 27, 2020 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baoanhng/a0baae3f04b73e39c757645018e4ea56 to your computer and use it in GitHub Desktop.
Save baoanhng/a0baae3f04b73e39c757645018e4ea56 to your computer and use it in GitHub Desktop.
Persist FB volume
// ==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