9gag Auto Gif Controls

Shows the gif/mp4 controls automatically

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

  1. // ==UserScript==
  2. // @name 9gag Auto Gif Controls
  3. // @namespace http://www.diamonddownloads.weebly.com
  4. // @version 1.0
  5. // @description Shows the gif/mp4 controls automatically
  6. // @author RF Geraci
  7. // @include http://9gag.*/gag/*
  8. // @include http://9gag.*/*
  9. // @include https://9gag.*/gag/*
  10. // @include https://9gag.*/*
  11. // @grant none
  12. // @run-at document-body
  13. // ==/UserScript==
  14.  
  15. gag = {
  16. init : function(t){
  17. setInterval(function(){
  18. var classN = "badge-animated-container-animated post-view"; //Default
  19. var winLoc = window.location.href;
  20. if (winLoc.indexOf('hot') > -1 || winLoc.indexOf('trending') > -1 || winLoc.indexOf('fresh')){
  21. classN = "badge-animated-container-animated"; //Change var if these pages are open
  22. }
  23. var ele = document.getElementsByClassName(classN);
  24. for(var i=0; i<ele.length; i++){
  25. var c = ele[i].childNodes[1];
  26. if (!c.hasAttribute('controls')){
  27. console.log(ele[i].className + " " + i + " did not have control attrib");
  28. c.setAttribute("controls", "");
  29. }
  30. }
  31. }, t);
  32. }
  33. };
  34.  
  35. gag.init(1000);