Greasy Fork

Greasy Fork is available in English.

9gag show video control

simple script to add html5 controls to 9gag gif and video post. Set default volume to 50%

目前为 2018-06-04 提交的版本,查看 最新版本

// ==UserScript==
// @name         9gag show video control
// @namespace    http://javalatte.xyz
// @version      1.3.1
// @description  simple script to add html5 controls to 9gag gif and video post. Set default volume to 50% 
// @author       JavaLatte
// @match        https://9gag.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var timer;
    function addVideoControl(){
        var vids = document.getElementsByTagName('video');
        for( var i = 0; i < vids.length; i++ ){
            var elem = vids.item(i);
            if(!elem.hasAttribute("controls")){
                elem.setAttribute("controls", "");
                elem.volume = 0.5;
                console.log('video controls added');
            }
        }
    }
    timer = setInterval(addVideoControl, 1000);
})();