Wordfilter Bypass

By aeosynth Last update Jan 3, 2009 — Installed 1,012 times. Daily Installs: 5, 0, 1, 1, 4, 1, 0, 2, 1, 1, 0, 1, 2, 0, 1, 4, 1, 0, 0, 1, 0, 9, 1, 0, 1, 3, 2, 4, 0, 1, 5, 6

There are 2 previous versions of this script.

// ==UserScript==
// @name           Wordfilter Bypass
// @namespace      http://userscripts.org/users/64431
// @author         aeosynth !vonvEe850w
// @author         tkirby
// @description    Edit and bypass 4chan's /b/ wordfilters
// @include        http://img.4chan.org/b/*
// ==/UserScript==

var formText = document.getElementsByName('com')[0]

if (!formText) return

var bypassRow = document.createElement('tr')
bypassRow.appendChild(document.createElement('td'))

var bypassCell = document.createElement('td')
bypassCell.setAttribute('class', 'postblock')
bypassCell.appendChild(document.createTextNode('Bypass'))
bypassRow.appendChild(bypassCell)

var inputArea = document.createElement('td')
bypassRow.appendChild(inputArea)

var wordfilter = document.createElement('input')
wordfilter.value = GM_getValue('wordfilter', 'penis, vagina, buttsex, peanut, femanon')
wordfilter.size = 35
wordfilter.className = 'inputtext'
inputArea.appendChild(wordfilter)

var bypass = document.createElement('input')
bypass.type = 'checkbox'
bypass.checked = GM_getValue('bypass', true)
inputArea.appendChild(bypass)

var tbody = formText.parentNode.parentNode.parentNode
tbody.insertBefore(bypassRow, tbody.lastChild)

wordfilter.addEventListener('keyup', function(){GM_setValue('wordfilter', wordfilter.value)}, true)
bypass.addEventListener('click', function(){GM_setValue('bypass', bypass.checked)}, true)
document.addEventListener('submit', 
	function(event){
		if(event.target.name == 'post' && bypass.checked){
			var tempArray
			const re = /(\b[^,])([^,]*)/g
			while(tempArray = re(wordfilter.value)){
				const temp = new RegExp('(' + tempArray[1] + ')(' + tempArray[2] + ')', 'ig')
				formText.value = formText.value.replace(temp, '$1' + '\u200C' + '$2')
				}
			}
		},
	true)