Zalgo Word Corruptor

Replaces random words on a webpage with deranged Zalgo text

  1. // ==UserScript==
  2. // @name Zalgo Word Corruptor
  3. // @namespace http://scream.from/the.void
  4. // @version 1.0
  5. // @description Replaces random words on a webpage with deranged Zalgo text
  6. // @match *://*/*
  7. // @grant none
  8. // @license MIT
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. 'use strict';
  13.  
  14. // Number of words to corrupt per page load (or set to a percentage)
  15. const NUM_WORDS_TO_ZALGO = 30;
  16.  
  17. // Generate Zalgo text
  18. function zalgo(text) {
  19. const zalgo_up = [
  20. '\u030d', '\u030e', '\u0304', '\u0305',
  21. '\u033f', '\u0311', '\u0306', '\u0310',
  22. '\u0352', '\u0357', '\u0351', '\u0307',
  23. '\u0308', '\u030a', '\u0342', '\u0343',
  24. '\u0344', '\u034a', '\u034b', '\u034c',
  25. '\u0303', '\u0302', '\u030c', '\u0350',
  26. '\u0300', '\u0301', '\u030b', '\u030f',
  27. '\u0312', '\u0313', '\u0314', '\u033d',
  28. '\u0309', '\u0363', '\u0364', '\u0365',
  29. '\u0366', '\u0367', '\u0368', '\u0369',
  30. '\u036a', '\u036b', '\u036c', '\u036d',
  31. '\u036e', '\u036f', '\u033e', '\u035b',
  32. '\u0346', '\u031a'
  33. ];
  34.  
  35. return text.split('').map(char => {
  36. let result = char;
  37. const count = Math.floor(Math.random() * 6) + 1;
  38. for (let i = 0; i < count; i++) {
  39. result += zalgo_up[Math.floor(Math.random() * zalgo_up.length)];
  40. }
  41. return result;
  42. }).join('');
  43. }
  44.  
  45. // Text walker
  46. const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, null, false);
  47. let textNodes = [];
  48. let node;
  49. while ((node = walker.nextNode())) {
  50. if (node.nodeValue.trim().length > 0) {
  51. textNodes.push(node);
  52. }
  53. }
  54.  
  55. // Shuffle utility
  56. function shuffle(array) {
  57. for (let i = array.length - 1; i > 0; i--) {
  58. const j = Math.floor(Math.random() * (i + 1));
  59. [array[i], array[j]] = [array[j], array[i]];
  60. }
  61. }
  62.  
  63. shuffle(textNodes);
  64.  
  65. let replaced = 0;
  66. for (const textNode of textNodes) {
  67. const words = textNode.nodeValue.split(/\b/);
  68. let changed = false;
  69. for (let i = 0; i < words.length; i++) {
  70. if (/^\w+$/.test(words[i]) && Math.random() < 0.2) { // ~20% chance per word
  71. words[i] = zalgo(words[i]);
  72. replaced++;
  73. changed = true;
  74. if (replaced >= NUM_WORDS_TO_ZALGO) break;
  75. }
  76. }
  77. if (changed) {
  78. const newNode = document.createTextNode(words.join(''));
  79. textNode.parentNode.replaceChild(newNode, textNode);
  80. }
  81. if (replaced >= NUM_WORDS_TO_ZALGO) break;
  82. }
  83. })();

QingJ © 2025

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