aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts/stop-blocking.ts
blob: bf9ae4eba8375ad3c753a33692fe05abfcf3cbea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
document.addEventListener("DOMContentLoaded", () => {
	const proxiedBind = $.prototype.bind;

	$.prototype.bind = function() {
		if (arguments[0].trim() === "cut copy paste") {
			arguments[1] = (e: any) => {};
		}

		return proxiedBind.apply(this, Array.from(arguments) as any);
	}

	const proxiedKeydown = $.prototype.keydown;

	$.prototype.keydown = function() {
		arguments[0] = (e: any) => true;

		return proxiedKeydown.apply(this, Array.from(arguments) as any);
	}

	$.prototype.bind = proxiedBind;
	$.prototype.keydown = proxiedKeydown;
	document.oncontextmenu = new Function("return true") as any;
});