Prevents Facebook advertisements playing while watching videos on facebook.
// ==UserScript== // @name Remove Facebook Video Advertisements // @namespace https://greasyfork.org/en/scripts/462105-remove-facebook-video-advertisements // @version 1.0.0 // @description Prevents Facebook advertisements playing while watching videos on facebook. // @author Daile Alimo // @match https://www.facebook.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=facebook.com // @license MIT // @grant none // ==/UserScript== // Stops advertisements playing during a video. // Hides the video overlay, this is done because since event doesn't propergate Facebook does not know the video has stopped buffering and will show a buffering icon over the video. window.addEventListener('playing', function(event) { event.stopImmediatePropagation(); event.target.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.childNodes[1].childNodes[0].childNodes[0].setAttribute('hidden', 'hidden'); }, true); // Stops advertisments playing at the end of a video. // Makes the video overlay visable again. window.addEventListener('ended', function(event) { event.stopImmediatePropagation(); event.target.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.childNodes[1].childNodes[0].childNodes[0].removeAttribute('hidden'); }, true);