Greasy Fork is available in English.

↻ Refresh Script (QA Tool)

🔸Use with creating scripts: Creates a button to refresh your Script without having to reload website server. Read More↗

Ekde 2025/04/30. Vidu La ĝisdata versio.

  1. // ==UserScript==
  2. // @name ↻ Refresh Script (QA Tool)
  3. // @namespace https://bowHip.org/foster
  4. // @version 1.0
  5. // @description 🔸Use with creating scripts: Creates a button to refresh your Script without having to reload website server. Read More↗
  6. // @author jAdkins
  7. // @match https://*/*
  8. // @License Free usage, use this QA Tool however you like.
  9. // @Email adkinscc@gmail.com
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // 🟨🟨 START YOUR SCRIPT HERE 🟨🟨 //
  16.  
  17. function scriptName() {
  18. const div = document.createElement('div');
  19. div.textContent = 'Hello, world!';
  20. return div;
  21. }
  22.  
  23. // << END YOUR SCRIPT HERE >>
  24. //_____________________________________________________________________________________________________________
  25.  
  26.  
  27. // This code below adds " ↻ " icon at top of Browser that refreshes the your script.
  28.  
  29. function setup() {
  30. const wrap = document.createElement('div');
  31. wrap.id = '↻-refresh';
  32. const content = myScript(); //🟨 << ADD NAME OF SCRIPT HERE
  33. wrap.appendChild(content);
  34. document.body.appendChild(wrap);
  35. }
  36.  
  37. function cleanup() {
  38. document.getElementById('↻-refresh')?.remove();
  39. }
  40.  
  41. function refreshScript() {
  42. cleanup();
  43. setup();
  44. }
  45.  
  46. function injectButton() {
  47. if (!document.getElementById('refresh-icon')) {
  48. const refreshIcon = document.createElement('div');
  49. refreshIcon.id = 'refresh-icon';
  50. refreshIcon.textContent = '↻';
  51. refreshIcon.title = 'Refreshes your script';
  52. refreshIcon.style.position = 'fixed';
  53. refreshIcon.style.top = '10px';
  54. refreshIcon.style.left = '50%';
  55. refreshIcon.style.right = '25px';
  56. refreshIcon.style.width = '32px';
  57. refreshIcon.style.height = '32px';
  58. refreshIcon.style.lineHeight = '28px'; // vertical centering
  59. refreshIcon.style.fontSize = '14px'; // shrink text too
  60. refreshIcon.style.padding = '0';
  61. refreshIcon.style.borderRadius = '55%';
  62. refreshIcon.style.fontWeight = '200';
  63. refreshIcon.style.background = '#444';
  64. refreshIcon.style.color = '#fff';
  65. refreshIcon.style.fontSize = '18px';
  66. refreshIcon.style.textAlign = 'center';
  67. refreshIcon.style.userSelect = 'none';
  68. refreshIcon.style.cursor = 'pointer';
  69. refreshIcon.style.zIndex = '9999';
  70. refreshIcon.style.padding = '0'; // <- Important: no padding!
  71.  
  72. document.body.appendChild(refreshIcon);
  73.  
  74. let rotation = 0;
  75.  
  76. refreshIcon.addEventListener('click', () => {
  77. rotation += 360;
  78. refreshIcon.style.transition = 'transform 0.5s';
  79. refreshIcon.style.transform = `rotate(${rotation}deg)`;
  80.  
  81. setTimeout(() => {
  82. }, 400);
  83. });
  84. }
  85. }
  86.  
  87. const tryAdd = setInterval(() => {
  88. if (!document.getElementById('refresh-icon')) {
  89. injectButton();
  90. } else {
  91. clearInterval(tryAdd); // Stop once it's added
  92. }
  93. }, 500); // Check faster but only until it succeeds
  94.  
  95. // First launch
  96. setup();
  97.  
  98. })();