Greasy Fork is available in English.

CSSreloader

That allows you to reload all the CSS files of any site or local HTML file without you have to reload the page itself. Just press F8.

  1. // ==UserScript==
  2. // @name CSSreloader
  3. // @namespace DuKaT
  4. // @version 0.8
  5. // @description That allows you to reload all the CSS files of any site or local HTML file without you have to reload the page itself. Just press F8.
  6. // @author DuKaT
  7. // @match file:///*
  8. // @match http://*/*
  9. // @match https://*/*
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15.  
  16. const eventCode = 'F8';
  17. // @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
  18. const keyCode = 119; // F8
  19.  
  20. function reload() {
  21. const hrefSuffix = 'cssreloader=' + Date.now();
  22.  
  23. document.querySelectorAll('link[rel="stylesheet"][href]').forEach((linkEl) => {
  24. const href = linkEl.href.replace(/[?&]cssreloader=\d+$/, '');
  25. linkEl.href = href + (href.indexOf('?') === -1 ? '?' : '&') + hrefSuffix;
  26. });
  27. }
  28.  
  29. document.addEventListener('keyup', (evt) => {
  30. if (evt.code !== undefined) {
  31. if (evt.code === eventCode) {
  32. reload();
  33. }
  34. } else if (evt.keyCode === keyCode) {
  35. reload();
  36. }
  37. });
  38.  
  39. })();