您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Replaces Shift-JIS encoded Latin letters with Unicode equivalents, making pages a bit more searchable
当前为
- // ==UserScript==
- // @name Shift-JIS Letter Fixer
- // @namespace DoomTay
- // @description Replaces Shift-JIS encoded Latin letters with Unicode equivalents, making pages a bit more searchable
- // @version 1.0.0
- // @grant none
- // ==/UserScript==
- var replacementTable = [
- ["A","A"],
- ["B","B"],
- ["C","C"],
- ["D","D"],
- ["E","E"],
- ["F","F"],
- ["G","G"],
- ["H","H"],
- ["I","I"],
- ["J","J"],
- ["K","K"],
- ["L","L"],
- ["M","M"],
- ["N","N"],
- ["O","O"],
- ["P","P"],
- ["Q","Q"],
- ["R","R"],
- ["S","S"],
- ["T","T"],
- ["U","U"],
- ["V","V"],
- ["W","W"],
- ["X","X"],
- ["Y","Y"],
- ["Z","Z"],
- ["a","a"],
- ["b","b"],
- ["c","c"],
- ["d","d"],
- ["e","e"],
- ["f","f"],
- ["g","g"],
- ["h","h"],
- ["i","i"],
- ["j","j"],
- ["k","k"],
- ["l","l"],
- ["m","m"],
- ["n","n"],
- ["o","o"],
- ["p","p"],
- ["q","q"],
- ["r","r"],
- ["s","s"],
- ["t","t"],
- ["u","u"],
- ["v","v"],
- ["w","w"],
- ["x","x"],
- ["y","y"],
- ["z","z"],
- ["0","0"],
- ["1","1"],
- ["2","2"],
- ["3","3"],
- ["4","4"],
- ["5","5"],
- ["6","6"],
- ["7","7"],
- ["8","8"],
- ["9","9"]
- ];
- function replaceText(node, scan, replacement) {
- var nodes = node.childNodes;
- for (var n=0; n<nodes.length; n++) {
- if(nodes[n].nodeType == Node.TEXT_NODE && nodes[n].textContent.trim().indexOf(scan) > -1)
- {
- while(nodes[n].textContent.indexOf(scan) > -1) nodes[n].textContent = nodes[n].textContent.replace(scan,replacement);
- }
- //Nothing in this node. Look at the children of this node.
- else
- {
- replaceText(nodes[n],scan,replacement);
- }
- }
- }
- for(var i = 0; i < replacementTable.length; i++)
- {
- replaceText(document.body,replacementTable[i][0], replacementTable[i][1]);
- }