您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
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.1a // @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 propagate Facebook does not know the video has stopped buffering and will show a buffering icon over the video. window.addEventListener('play', function(event) { event.stopImmediatePropagation(); event.target.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.childNodes[1].childNodes[0].childNodes[0].setAttribute('hidden', 'hidden'); event.target.parentNode.childNodes[1].childNodes[0].childNodes[0].setAttribute('hidden', 'hidden'); document.querySelector('[aria-label="Unmute"]').click(); event.target.muted = false; }, true); // Stops advertisements playing at the end of a video. // Makes the video overlay visible 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'); event.target.parentNode.childNodes[1].childNodes[0].childNodes[0].removeAttribute('hidden', 'hidden'); document.querySelector('[aria-label="Unmute"]').click(); event.target.muted = false; }, true);