Facebook Video Preload Blocker

Evita la precarga de videos en Facebook

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

Advertisement:

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Advertisement:

// ==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');
        }
    }
};