Forum Hide

Hides content from the forums, very quick and dirty

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Forum Hide
// @namespace    dev.kwack.torn.forum-hide
// @version      1.1.0
// @description  Hides content from the forums, very quick and dirty
// @author       Kwack [2190604]
// @match        https://www.torn.com/forums.php
// @grant		 GM_registerMenuCommand
// @grant        GM_addStyle
// @run-at 		 document-end
// ==/UserScript==

GM_addStyle(`
	body.kw-forum-hide-images .post-container img {
		display: none !important;
	}
`);

const loadPrevious = () => {
	const old = localStorage.getItem("kw-forum-hide-images-enabled") === "true";
	return old;
};

const persistentToggle = () => {
	const old = loadPrevious();
	if (!old) {
		localStorage.setItem("kw-forum-hide-images-enabled", "true");
		document.body.classList.add("kw-forum-hide-images");
	} else {
		localStorage.setItem("kw-forum-hide-images-enabled", "false");
		document.body.classList.remove("kw-forum-hide-images");
	}
};

if (typeof GM_registerMenuCommand === "function") {
	GM_registerMenuCommand("Toggle images", persistentToggle);
	if (loadPrevious()) document.body.classList.add("kw-forum-hide-images");
} else {
	console.warn("No function GM_registerMenuCommand, enabling by default...");
	document.body.classList.add("kw-forum-hide-images");
}