Video controls on hover for i.imgur.com

Show video controls on mouse hover for for imgur.com

// ==UserScript==
// @name           Video controls on hover for i.imgur.com
// @description    Show video controls on mouse hover for for imgur.com
// @include        https://i.imgur.com/*
// @grant          none
// @icon           https://imgur.com/favicon.ico
// @require        https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// @author         flowscript
// @version 1.0
// @namespace https://greasyfork.org/users/158563
// ==/UserScript==

jQuery(document).ready(function($){    
  var attachVideoControls = function(){
    var containers = $('.video-container');
    if (containers.length) {
      containers.on('mouseenter', 'video', function(evt){
        $(this).prop('controls', true);
      }).on('mouseleave', 'video', function(evt){
        $(this).prop('controls', false);
      });
    } else {
      window.setTimeout(attachVideoControls, 250);
    }
  };
  window.setTimeout(attachVideoControls, 250);
});