Cache Clear Link

/cache-clear

  1. // ==UserScript==
  2. // @name Cache Clear Link
  3. // @namespace cache clear
  4. // @version 1.2
  5. // @description /cache-clear
  6. // @match *://*/*
  7. // @grant none
  8. // @license MIT
  9. // @author Samuel Araújo
  10. // @icon https://www.tiptip.pt/public/img/iconTiptip.png
  11. // @description corre rota de cache-clear
  12. // ==/UserScript==
  13.  
  14.  
  15. (function () {
  16. if (window.top !== window.self) return;
  17.  
  18. if (window.top.__clearCacheButtonInjected) return;
  19. window.top.__clearCacheButtonInjected = true;
  20.  
  21. const originalUrl = location.href;
  22.  
  23. const link = document.createElement('a');
  24. link.id = 'clear-cache-link';
  25. link.href = '#';
  26. link.textContent = 'clear';
  27. Object.assign(link.style, {
  28. position: 'fixed',
  29. bottom: '20px',
  30. left: '0px',
  31. zIndex: '9999',
  32. padding: '3px 6px',
  33. background: '#f00',
  34. color: '#fff',
  35. textDecoration: 'none',
  36. borderRadius: '4px',
  37. fontSize: '10px',
  38. });
  39.  
  40. link.addEventListener('click', function (e) {
  41. e.preventDefault();
  42.  
  43. fetch(`${location.origin}/cache-clear`)
  44. .then(() => {
  45. location.href = originalUrl;
  46. })
  47. .catch(() => {
  48. location.href = originalUrl;
  49. });
  50. });
  51.  
  52. window.top.document.documentElement.appendChild(link);
  53. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址