9gag.com video controls on hover

Show video controls on mouse hover

  1. // ==UserScript==
  2. // @name 9gag.com video controls on hover
  3. // @namespace pl.srsbiz
  4. // @description Show video controls on mouse hover
  5. // @include https://9gag.com/*
  6. // @grant none
  7. // @version 0.0.1.20180611200256
  8. // ==/UserScript==
  9.  
  10. jQuery(document).ready(function($){
  11. var attachVideoControls = function(){
  12. var containers = $('#list-view-2,#individual-post,.listview,.post-page');
  13. if (containers.length) {
  14. containers.on('mouseenter', 'video', function(evt){
  15. $(this).prop('controls', true);
  16. }).on('mouseleave', 'video', function(evt){
  17. $(this).prop('controls', false);
  18. });
  19. } else {
  20. window.setTimeout(attachVideoControls, 250);
  21. }
  22. };
  23. window.setTimeout(attachVideoControls, 250);
  24. });