Skip to content

Instantly share code, notes, and snippets.

@ZaneHannanAU
Last active April 13, 2018 07:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZaneHannanAU/efb0479867336fad3372c8486851e169 to your computer and use it in GitHub Desktop.
Save ZaneHannanAU/efb0479867336fad3372c8486851e169 to your computer and use it in GitHub Desktop.
mangadex forums fuck up your text
// ==UserScript==
// @name Rainbowfy
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://mangadex.org/forum
// @match https://mangadex.org/forums
// @match https://mangadex.org/forum/*
// @match https://mangadex.org/forums/*
// @match https://mangadex.org/thread/*
// @match https://mangadex.org/manga/*/*/com*
// @match https://mangadex.org/chapter/*/com*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const fuckUp = tx => Array.from(
tx,
(s,i)=>!s.trim()?s
:`[color=hsla(${
Math.ceil(360*i/Math.min(tx.length,360))
},${
Math.ceil(100*i/tx.length)
}%,${
Math.ceil(90*i/tx.length)
}%,${
Math.round(100*i/tx.length)/100
})]${
s
}[/color]`
).join('');
let qs = document.querySelectorAll('#post_reply_button,#start_thread_button,.edit_post_button');
let okay = Array.from(qs, e => e.parentElement.appendChild(document.createElement('button')));
let okey = Array.from(qs, e => e.parentElement.appendChild(document.createElement('button')));
console.log({okay,okey});
okay.forEach(k => {
k.innerHTML = 'Fuck it ↑.';
k.addEventListener('click', e => {
e.preventDefault();
let tx = k.form.querySelector('#text');
console.log(tx.value);
tx.value = fuckUp(tx.value);
console.log(tx.value);
});
});
const fuckUpMore = tx => Array.from(
tx,
(s,i)=>!s.trim()?s
:`[color=hsla(${
Math.ceil(360*Math.random())
},${
Math.ceil(100*Math.random())
}%,${
Math.ceil(100*Math.random())
}%,${
Math.round(100*Math.random())/100
})]${
s
}[/color]`
).join('');
okey.forEach(k => {
k.innerHTML = 'Fuck it ↑ BADLY.';
k.addEventListener('click', e => {
e.preventDefault();
let tx = k.form.querySelector('#text');
console.log(tx.value);
tx.value = fuckUpMore(tx.value);
console.log(tx.value);
});
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment