Text Replacer

Replaces all text on a webpage with the letter A

当前为 2024-06-12 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Text Replacer
  3. // @namespace ReplaceTextInElements
  4. // @version 1.1
  5. // @description Replaces all text on a webpage with the letter A
  6. // @author ArpaRec
  7. // @match *://*/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. function replaceChars() {
  15. const allElements = document.querySelectorAll("p, span, h1, h2, h3, h4, h5, h6, li, a"); // Add more text elements as needed
  16. for (const element of allElements) {
  17. if (element.nodeType === Node.TEXT_NODE) continue; // Skip text nodes
  18. element.textContent = element.textContent.replace(/\S/g, "A");
  19. }
  20. }
  21.  
  22. replaceChars();
  23. })();