Greasy Fork is available in English.

Unicode字符串转中文

将网页中所有的Unicode字符串替换为中文

// ==UserScript==
// @name         Unicode字符串转中文
// @version      1.0
// @author        ChatGPT
// @description  将网页中所有的Unicode字符串替换为中文
// @match        *://*/*
// @run-at      document-end
// @grant        none
// @namespace https://greasyfork.org/users/452911
// ==/UserScript==

(function() {
  'use strict';

  function replaceUnicodeWithChinese() {
    var elements = document.getElementsByTagName('*');

    for (var i = 0; i < elements.length; i++) {
      var element = elements[i];
      var nodes = element.childNodes;

      for (var j = 0; j < nodes.length; j++) {
        var node = nodes[j];

        if (node.nodeType === Node.TEXT_NODE) {
          var text = node.nodeValue;
          var replacedText = text.replace(/\\u([\d\w]{4})/gi, function(match, grp) {
            return String.fromCharCode(parseInt(grp, 16));
          });

          if (replacedText !== text) {
            element.replaceChild(document.createTextNode(replacedText), node);
          }
        }
      }
    }
  }

  replaceUnicodeWithChinese();
})();