From 7023e4c7c8f158df78b5e71ddc2640290409eca1 Mon Sep 17 00:00:00 2001 From: chers Date: Fri, 31 Jul 2026 09:18:39 +0000 Subject: Update cl-bbs --- static/userscripts/wordfilter.user.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 static/userscripts/wordfilter.user.js (limited to 'static/userscripts/wordfilter.user.js') 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; + } +})(); -- cgit v1.2.3