Siarune / 4chan Base64 Decoder

// ==UserScript==
// @name         4chan Base64 Decoder
// @namespace    https://openuserjs.org/users/Siarune
// @copyright    2021, Siarune (https://openuserjs.org/users/Siarune)
// @license      MIT
// @version      1.0
// @description  Decode base64 test posts automatically
// @author       Siarune
// @match        https://boards.4chan.org/*
// @grant        none
// ==/UserScript==


function start() {
	var posts = document.getElementsByClassName("postMessage");

	for (let i = 0; i < posts.length; i++) {
		var text = posts[i].innerText;
		let lines = text.split(/\r?\n/);

		for (let ii = 0; ii < lines.length; ii++) {
			var line = lines[ii];
			let string = line.search('==');

			if (string != -1) {
				let src = window.atob(line);
				let original = posts[i].innerText;
				let edit = original + "\n\n" + src;
				posts[i].innerText = edit;
			}
		}
	}
}
start();