Greasy Fork

9gag show video control

simple script to add html5 controls to 9gag gif and video post

当前为 2018-01-13 提交的版本,查看 最新版本

// ==UserScript==
// @name         9gag show video control
// @namespace    http://javalatte.xyz
// @version      1.1
// @description  simple script to add html5 controls to 9gag gif and video post
// @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++ ){
            if(!vids.item(i).hasAttribute("controls")){
                console.log('add video controls');
                vids.item(i).setAttribute("controls", "");
            }
        }
    }

    timer = setInterval(addVideoControl, 1000);
})();