diff options
| author | chers <admin@tilde.tailb619f6.ts.net> | 2026-07-31 09:18:39 +0000 |
|---|---|---|
| committer | chers <admin@tilde.tailb619f6.ts.net> | 2026-07-31 09:18:39 +0000 |
| commit | 7023e4c7c8f158df78b5e71ddc2640290409eca1 (patch) | |
| tree | 077fb46bdb484bbbf7f9a81fd1d512f66650be10 /static/userscripts/wordfilter.user.js | |
Diffstat (limited to 'static/userscripts/wordfilter.user.js')
| -rw-r--r-- | static/userscripts/wordfilter.user.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/static/userscripts/wordfilter.user.js b/static/userscripts/wordfilter.user.js new file mode 100644 index 0000000..476706f --- /dev/null +++ b/static/userscripts/wordfilter.user.js @@ -0,0 +1,29 @@ +// ==UserScript== +// @name Word Filter for textboard.org +// @namespace http://textboard.org +// @description Replace words with other words +// @version 1 +// @match *://textboard.org/* +// @grant none +// ==/UserScript== +(function() { + 'use strict'; + var replacements, regex, key, textnodes, node, s; + replacements = { + "nigger": "mujina", + "faggot": "baku", + }; + regex = {}; + for (key in replacements) { + regex[key] = new RegExp(key, 'gi'); + } + textnodes = document.evaluate( "//body//text()", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); + for (var i = 0; i < textnodes.snapshotLength; i++) { + node = textnodes.snapshotItem(i); + s = node.data; + for (key in replacements) { + s = s.replace(regex[key], replacements[key]); + } + node.data = s; + } +})(); |
