This Is not Greasy Fork

Tired of Greasy Fork? Well Make your Own Fork :3

目前为 2025-01-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name This Is not Greasy Fork
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @license CC BY-NC
  6. // @description Tired of Greasy Fork? Well Make your Own Fork :3
  7. // @author Unknown Hacker
  8. // @match *://greasyfork.org/*
  9. // @match *://sleazyfork.org/*
  10. // @grant GM_getValue
  11. // @grant GM_setValue
  12. // @grant GM_registerMenuCommand
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17.  
  18. // IF THIS DOES NOT ABIDE BY THE RULES THEN LET ME KNOW LIKE A HUMAN BEING AND I WILL EITHER REMOVE THE SCRIPT OR CHANGE THE DEFAULT
  19. const defaultText = "Sleazy Fork"; // Sleazy Fork to Greasy Fork will come soon..
  20.  
  21. let replacementText = GM_getValue("replacementText", defaultText);
  22.  
  23. function setReplacementText() {
  24. const userInput = prompt("Enter the text to replace 'Greasy Fork' with:", replacementText);
  25. if (userInput !== null && userInput.trim() !== "") {
  26. GM_setValue("replacementText", userInput.trim());
  27. replacementText = userInput.trim();
  28. alert(`Replacement text set to: ${replacementText}`);
  29. }
  30. }
  31.  
  32. function resetReplacementText() {
  33. GM_setValue("replacementText", defaultText);
  34. replacementText = defaultText;
  35. alert(`Replacement text reset to default: ${defaultText}`);
  36. }
  37.  
  38. GM_registerMenuCommand("Set Replacement Text", setReplacementText);
  39. GM_registerMenuCommand("Reset to Default Text", resetReplacementText);
  40.  
  41. function replaceTextInNode(node) {
  42. if (node.nodeType === Node.TEXT_NODE) {
  43. node.textContent = node.textContent.replace(/Greasy Fork/g, replacementText);
  44. } else {
  45. for (let child of node.childNodes) {
  46. replaceTextInNode(child);
  47. }
  48. }
  49. }
  50.  
  51. replaceTextInNode(document.body);
  52.  
  53. document.title = document.title.replace(/Greasy Fork/g, replacementText);
  54. })();