Disable HTML5 Videos autoplay/preload

Prevent webbrowser from automatically playing/downloading HTML5 videos

18.02.2016 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name        Disable HTML5 Videos autoplay/preload
// @description Prevent webbrowser from automatically playing/downloading HTML5 videos
// @namespace   default
// @include     *
// @exclude     http*://www.youtube.com/*
// @version     1
// @grant       none
// @author      Ramast Magdy (ramast dot com at gmail dot com)
// ==/UserScript==

void(function() {
    var prevent_autoplay = function() {
        var videos = document.getElementsByTagName("video");
        var video;
        for (var i=0; i < videos.length; i++) {
            video = videos[i];
            video.removeAttribute("autoplay");
            video.removeAttribute("autobuffer");
            video.setAttribute("preload", "metadata");
        }
    };
    // after 0.3, 1, 2 and 4 seconds
    // This is because sometimes video is loaded through some JS code
    setTimeout(prevent_autoplay, 300);
    setTimeout(prevent_autoplay, 1000);
    setTimeout(prevent_autoplay, 2000);
    setTimeout(prevent_autoplay, 4000);
}());