Facebook Video Preload Blocker

Evita la precarga de videos en Facebook

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Facebook Video Preload Blocker
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Evita la precarga de videos en Facebook
// @author       Jose Enrique Ayala Villegas
// @match        https://www.facebook.com/*
// @grant        none
// @run-at document-start
// ==/UserScript==
var v1 = true;
var list = {};
var mmm;
(function(open) {
    XMLHttpRequest.prototype.realOpen = XMLHttpRequest.prototype.open;
    XMLHttpRequest.prototype.open = function() {
        try{
            var url = arguments[1];
            if(url.indexOf('https://video') !== -1){
                var vname = url.split('/')[5].split('?')[0];
                var vid = vname.split('_')[1].substring(0,5);
                var dO = window.photos_snowlift === undefined ? true : photos_snowlift.classList.contains('hidden_elem');
                if(dO){
                    return;
                } else {
                    if(list[vname] === undefined) { list[vname] = 0; }
                    else {
                        if(list[vname] !== -1){
                            list[vname]++;
                            if(list[vname]>2){
                                list[vname] = -1;
                                mmm();
                            }
                        }
                    }
                }
            }
        } catch(e){}
        open.apply(this, arguments);
    };
    XMLHttpRequest.prototype.fakeOpen = XMLHttpRequest.prototype.open;
})(XMLHttpRequest.prototype.open);


window.onmousedown = function(e){
    if(e.target.tagName === 'I'){
        if(document.querySelectorAll('input[type="button"]',e.target).length>0){
            mmm = ((function(ee){
                var kke = ee.target.querySelector('input');
                if(kke.hasClick) return;
                kke.hasClick = true;
                kke.click();
            }).bind(null,e));
            console.log('Video Reproducir');
        }
    }
};