aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts/autofill-otps.ts
diff options
context:
space:
mode:
authorArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2023-02-04 12:20:46 +0530
committerArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2023-02-04 12:20:46 +0530
commita08607762db5681785159358084213558a5f11f9 (patch)
treef3a6245c685ca942ce5fcf918e116509506b7c5a /src/scripts/autofill-otps.ts
downloadbanglar-bhumi-utils-a08607762db5681785159358084213558a5f11f9.tar.gz
banglar-bhumi-utils-a08607762db5681785159358084213558a5f11f9.zip
Initial commit
Diffstat (limited to 'src/scripts/autofill-otps.ts')
-rw-r--r--src/scripts/autofill-otps.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/scripts/autofill-otps.ts b/src/scripts/autofill-otps.ts
new file mode 100644
index 0000000..f299540
--- /dev/null
+++ b/src/scripts/autofill-otps.ts
@@ -0,0 +1,20 @@
+const proxiedPost = $.post;
+
+$.post = function() {
+ let element: HTMLInputElement | null = null;
+ if (arguments[0].endsWith("MISPetitionSmsSend.action")) {
+ element = document.querySelector("input[name=mobile_Code]") as HTMLInputElement;
+ } else if (arguments[0].endsWith("MISPetitionEmailSend.action")) {
+ element = document.querySelector("input[name=txtemail_Code]") as HTMLInputElement;
+ }
+
+ if (element !== null) {
+ const callback = arguments[2];
+ arguments[2] = (data: any) => {
+ element!.value = data?.messageShow || "";
+ callback(data);
+ };
+ }
+
+ return proxiedPost.apply(this, Array.from(arguments) as any);
+};