gauda / Reload CSS

// ==UserScript==
// @name        Reload CSS
// @namespace   gauda
// @description By pressing F4 the CSS of the current tab is reloaded
// @version     1
// @grant       none
// ==/UserScript==
  document.addEventListener('keydown', function (e) {
    // keyCode for F4 == 115
    if (e.keyCode == 115) {
      var h, a, f;
      a = document.getElementsByTagName('link');
      for (h = 0; h < a.length; h++) {
        f = a[h];
        if (f.rel.toLowerCase().match(/stylesheet/) && f.href) {
          var g = f.href.replace(/(&|\?)forceReload=\d+/, '');
          f.href = g + (g.match(/\?/) ? '&' : '?') + 'forceReload=' + (new Date().valueOf())
        }
      }
    }
  }, false);