Alt+Insert to Render Less

Allows users to use the key combination Alt+Insert to disable less essential rendering.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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         Alt+Insert to Render Less
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Allows users to use the key combination Alt+Insert to disable less essential rendering.
// @author       MTP3
// @match        *://manyland.com/*
// @icon         http://manyland.com/favicon.ico
// ==/UserScript==

function main() {
	entityTypesToMessWith = [
		"EntityDecoanim", "EntityDecotch", "EntityFurry", "EntityDecobig", "EntityDecovbig",
		"EntityDynathing", "EntityFarback", "EntityDeadPlayer",
		"EntityDust", "EntityRemovedust", "EntityFootdust", "EntityJumpdust",
		"EntityVignette", "EntityLiquidDrop", "EntitySparkle", "EntitySpot",
		"EntityBigDust", "EntityBackgroundBlock", "EntityCrumbleBlock"
	];

	renderingStuff = true;
	tmpfuncs = {};

	ig.input.bind(ig.KEY.ALT, "alt");

	document.addEventListener('keyup', (e) => {
		if (ig.input.state("alt") && e.key == "Insert")
		{
			if (renderingStuff)
			{
				for (let [_, typename] of Object.entries(entityTypesToMessWith))
				{
					tmpfuncs[typename] = unsafeWindow[typename].prototype.draw;
					unsafeWindow[typename].prototype.draw = () => {};
				}
			}
			else
			{
				for (let [_, typename] of Object.entries(entityTypesToMessWith))
					unsafeWindow[typename].prototype.draw = tmpfuncs[typename];
			}

			renderingStuff = !renderingStuff;
		}
	});
};

(() => {
	interval = setInterval(() => {
		if (ig === undefined) return;
		if (ig.input === undefined) return;

		clearInterval(interval);
		main();
	}, 50);
})();