Anonymous
5/11/2025, 7:54:53 AM No.136393
I made a userscript that makes the pass more elegant (removes "You are using a 4chan pass" and adds a button to toggle your since4pass. 4chan devs are free to steal this idea.
[code]
// ==UserScript==
// @name 4chan pass script
// @namespace localhost
// @include *://boards.4chan.org/*
// @version 1
// @grant GM_addStyle
// @grant unsafeWindow
// @run-at document-end
// ==/UserScript==
function toggleSince4pass(ev) {
const options = document.forms.post.email;
if (/since4pass/.test(options.value)) {
options.value = options.value.replaceAll('since4pass', '');
ev.target.style.opacity = "0.5";
} else {
options.value+= 'since4pass';
ev.target.style.opacity = "1";
}
}
if (unsafeWindow.passEnabled) {
const formcaptcha = document.getElementById('captchaFormPart');
if (formcaptcha !== null) {
formcaptcha.style.display = 'none';
}
const submit = document.querySelector('#postForm [type="submit"]');
if (submit !== null) {
const options = document.forms.post.email;
submit.parentElement.style.whiteSpace = 'nowrap';
const pass = document.createElement('SPAN');
pass.classList.add('n-pu');
pass.style.opacity = '0.75';
pass.style.cursor = 'pointer';
pass.onclick = toggleSince4pass;
submit.insertAdjacentElement('afterend', pass);
options.addEventListener('input', () => {
pass.style.opacity = /since4pass/.test(options.value) ? '1' : '0.75';
});
}
}
[/code]
[code]
// ==UserScript==
// @name 4chan pass script
// @namespace localhost
// @include *://boards.4chan.org/*
// @version 1
// @grant GM_addStyle
// @grant unsafeWindow
// @run-at document-end
// ==/UserScript==
function toggleSince4pass(ev) {
const options = document.forms.post.email;
if (/since4pass/.test(options.value)) {
options.value = options.value.replaceAll('since4pass', '');
ev.target.style.opacity = "0.5";
} else {
options.value+= 'since4pass';
ev.target.style.opacity = "1";
}
}
if (unsafeWindow.passEnabled) {
const formcaptcha = document.getElementById('captchaFormPart');
if (formcaptcha !== null) {
formcaptcha.style.display = 'none';
}
const submit = document.querySelector('#postForm [type="submit"]');
if (submit !== null) {
const options = document.forms.post.email;
submit.parentElement.style.whiteSpace = 'nowrap';
const pass = document.createElement('SPAN');
pass.classList.add('n-pu');
pass.style.opacity = '0.75';
pass.style.cursor = 'pointer';
pass.onclick = toggleSince4pass;
submit.insertAdjacentElement('afterend', pass);
options.addEventListener('input', () => {
pass.style.opacity = /since4pass/.test(options.value) ? '1' : '0.75';
});
}
}
[/code]
Replies: