From feac7acb91a78b117241abdd0a5d80f778e15f06 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> Date: Fri, 24 Mar 2023 11:36:54 +0530 Subject: Overriding the javascript on the page instead of locally replacing it. --- src/scripts/stop-blocking.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/scripts/stop-blocking.ts (limited to 'src/scripts/stop-blocking.ts') diff --git a/src/scripts/stop-blocking.ts b/src/scripts/stop-blocking.ts new file mode 100644 index 0000000..57357f8 --- /dev/null +++ b/src/scripts/stop-blocking.ts @@ -0,0 +1,21 @@ +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); +} + +document.addEventListener("DOMContentLoaded", () => { + $.prototype.bind = proxiedBind; + $.prototype.keydown = proxiedKeydown; + document.oncontextmenu = new Function("return true") as any; +}); -- cgit v1.2.3