9gag Auto Gif Controls

Shows the gif/mp4 controls automatically

目前为 2015-07-27 提交的版本。查看 最新版本

// ==UserScript==
// @name           9gag Auto Gif Controls
// @namespace      http://www.diamonddownloads.weebly.com
// @version        1.0
// @description    Shows the gif/mp4 controls automatically
// @author         RF Geraci
// @include        http://9gag.*/gag/*
// @include        http://9gag.*/*
// @include        https://9gag.*/gag/*
// @include        https://9gag.*/*
// @grant          none
// @run-at         document-body
// ==/UserScript==

gag = {
    
    init : function(t){
        
        setInterval(function(){
            
        var classN = "badge-animated-container-animated post-view"; //Default
        var winLoc = window.location.href;
        
        if (winLoc.indexOf('hot') > -1 || winLoc.indexOf('trending') > -1 || winLoc.indexOf('fresh')){
            classN = "badge-animated-container-animated"; //Change var if these pages are open
            }
            
      var ele = document.getElementsByClassName(classN);
            
            for(var i=0; i<ele.length; i++){
                
                var c  = ele[i].childNodes[1];
                
                if (!c.hasAttribute('controls')){
                    console.log(ele[i].className + " " + i + " did not have control attrib");
                  c.setAttribute("controls", "");
                }
            }     
    
        }, t);
    }
    
};

gag.init(1000);