DeviantArt More From Hider

For those that open far more tabs than your browser can handle (stupid x86 memory limits), this script hides the "More From" sidebar elements but adds button that toggles them on and off

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name        DeviantArt More From Hider
// @description For those that open far more tabs than your browser can handle (stupid x86 memory limits), this script hides the "More From" sidebar elements but adds button that toggles them on and off
// @namespace   arof
// @include     *//*.deviantart.com/art/*
// @version     1
// @grant       none
// ==/UserScript==

function inject(func)
{
	var script = document.createElement("script");
	script.setAttribute("type", "application/javascript");
	script.appendChild(document.createTextNode(func));
	document.body.appendChild(script);
}

function hideAll()
{
	var array = document.getElementsByClassName("deviation-mlt-preview deviation-mlt-preview-b");
	for(var key in array)
	{
		var elem = array[key];
		elem.setAttribute("hidden", "true");
	}
}

function expandAll()
{
	var array = document.getElementsByClassName("deviation-mlt-preview deviation-mlt-preview-b");
	for(var key in array)
	{
		var elem = array[key];
		if (elem.hasAttribute("hidden"))
			elem.removeAttribute("hidden");
		else
			elem.setAttribute("hidden", "true");
	}
}

function insertButton()
{
	var metaActions = document.getElementsByClassName("dev-meta-actions")[0];
	inject(expandAll);

	var button = document.createElement("input");
	button.type = "button";
	button.value = 'Show "More Froms"';
	button.setAttribute("onclick", "expandAll()");

	metaActions.insertBefore(button, metaActions.firstChild);
}

insertButton();
hideAll();