Last active
January 14, 2018 14:46
-
-
Save pezcode/c7f01e8c935b5787d91c61f64e4af7cc to your computer and use it in GitHub Desktop.
Stop Facebook from maxing out your video volume. Slightly modified version of the original script by Daile Alimo: https://gist.github.com/JustDaile/478a4e1e07003648865984ede307093d. Modified to use local storage since I couldn't get it to work using cookies. Tested with Firefox 57 and Violentmonkey 2.8.24.
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 FBVVM | |
// @namespace http://tampermonkey.net/ | |
// @version 1.1 | |
// @description Maintains set volume of videos on play of native video links on Facebook. | |
// @author Daile Alimo, pezcode | |
// @match https://www.facebook.com/* | |
// @grant none | |
// @require http://code.jquery.com/jquery-latest.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var volume = parseFloat(localStorage.FBVVM_volume) || 1; | |
// scan for new videos | |
setInterval(function() { | |
var $scanning = $('video:not(.detected)'); | |
$scanning.each(function() { | |
var $elem = $(this).addClass("detected"); | |
$elem.on('play', function() { | |
this.volume = volume; | |
}); | |
$elem.extend({ | |
ready : false, | |
}); | |
$elem.on('volumechange', function() { | |
var $this = $(this); | |
if($this.ready) { | |
volume = this.volume; | |
localStorage.FBVVM_volume = volume; | |
} else { | |
$this.ready = true; | |
} | |
}); | |
}); | |
}, 200); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment