aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2023-03-24 09:24:15 +0530
committerArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2023-03-24 09:24:15 +0530
commita9f2d88e1e5b1c7ddf524db8b5b185b8485f8d48 (patch)
tree7f39667b6fc56bbf06adbbb3fc2aa6c54cfe27d1
parent3b29d138bee5e98c9536d3606de3e4b5378338f0 (diff)
downloadbanglar-bhumi-utils-a9f2d88e1e5b1c7ddf524db8b5b185b8485f8d48.tar.gz
banglar-bhumi-utils-a9f2d88e1e5b1c7ddf524db8b5b185b8485f8d48.zip
Improved some functionality.
-rw-r--r--config/webpack/plugins/create-manifest-webpack-plugin/index.js2
-rw-r--r--config/webpack/plugins/inject-script-webpack-plugin/get-injection-code.js19
-rw-r--r--config/webpack/plugins/inject-script-webpack-plugin/index.js2
-rw-r--r--src/scripts.json12
-rw-r--r--src/scripts/auto-login.ts34
-rw-r--r--src/scripts/captcha.ts (renamed from src/scripts/autofill-captcha.ts)13
-rw-r--r--src/scripts/functionality/application-receipt.ts (renamed from src/scripts/fix-application-receipt.ts)6
-rw-r--r--src/scripts/functionality/view-khatian.ts21
-rw-r--r--src/scripts/login.ts60
-rw-r--r--src/scripts/optimize/home-page/modify-dom.ts (renamed from src/scripts/optimize/home-page/index.ts)0
-rw-r--r--src/scripts/optimize/home-page/styles.ts12
-rw-r--r--src/scripts/otps/grievance-application.ts (renamed from src/scripts/autofill-otps/grievance-application.ts)0
-rw-r--r--src/scripts/show-plot-information.ts11
13 files changed, 112 insertions, 80 deletions
diff --git a/config/webpack/plugins/create-manifest-webpack-plugin/index.js b/config/webpack/plugins/create-manifest-webpack-plugin/index.js
index f571986..f0d9084 100644
--- a/config/webpack/plugins/create-manifest-webpack-plugin/index.js
+++ b/config/webpack/plugins/create-manifest-webpack-plugin/index.js
@@ -18,7 +18,7 @@ class CreateManifestPlugin {
const scripts = formatScripts(require(path.resolve(SOURCE_DIR, "scripts.json")));
const manifest = webpackRequire("plugins/create-manifest-webpack-plugin/manifest-template.json");
manifest.version = require(path.resolve(ROOT_DIR, "package.json")).version;
- manifest.content_scripts = []
+ manifest.content_scripts = [];
for (const scriptPath in scripts) {
for (const scriptType in scripts[scriptPath]) {
diff --git a/config/webpack/plugins/inject-script-webpack-plugin/get-injection-code.js b/config/webpack/plugins/inject-script-webpack-plugin/get-injection-code.js
index 6f3c9b3..2993c44 100644
--- a/config/webpack/plugins/inject-script-webpack-plugin/get-injection-code.js
+++ b/config/webpack/plugins/inject-script-webpack-plugin/get-injection-code.js
@@ -1 +1,18 @@
-module.exports = code => `(()=>{const o=new MutationObserver(()=>{let t=document.querySelector("head > script:nth-child(54)");if(t){let e=\`(()=>{${code.replaceAll("`","\\`")}})();\`;null==t.getAttribute("data-replaced")?(t.innerHTML=e,t.setAttribute("data-replaced","")):t.innerHTML+=e,o.disconnect()}});o.observe(document,{childList:!0,subtree:!0});})();`;
+module.exports.getInjectionCode = code => {
+ const escapeSequences = [["\b", "\\b"],
+ ["\f", "\\f"],
+ ["\n", "\\n"],
+ ["\r", "\\r"],
+ ["\t", "\\t"],
+ ["\v", "\\v"]
+ ];
+ let finalCode = code.replaceAll("`","\\`");
+
+ for (const escapeSequence of escapeSequences) {
+ finalCode = finalCode
+ .replaceAll(escapeSequence[1], "\\" + escapeSequence[1])
+ .replaceAll(escapeSequence[0], escapeSequence[1]);
+ }
+
+ return `(()=>{const o=new MutationObserver(()=>{let t=document.querySelector("head > script:nth-child(54)");if(t){let e=\`(()=>{${finalCode}})();\`;null==t.getAttribute("data-replaced")?(t.innerHTML=e,t.setAttribute("data-replaced","")):t.innerHTML+=e,o.disconnect()}});o.observe(document,{childList:!0,subtree:!0});})();`;
+};
diff --git a/config/webpack/plugins/inject-script-webpack-plugin/index.js b/config/webpack/plugins/inject-script-webpack-plugin/index.js
index b7b5940..a0ee1f7 100644
--- a/config/webpack/plugins/inject-script-webpack-plugin/index.js
+++ b/config/webpack/plugins/inject-script-webpack-plugin/index.js
@@ -1,7 +1,7 @@
const { sources } = require("webpack");
const terser = require("terser");
-const getInjectionCode = webpackRequire("plugins/inject-script-webpack-plugin/get-injection-code");
+const { getInjectionCode } = webpackRequire("plugins/inject-script-webpack-plugin/get-injection-code");
class InjectScriptPlugin {
apply(compiler) {
diff --git a/src/scripts.json b/src/scripts.json
index f5611fe..c6caca8 100644
--- a/src/scripts.json
+++ b/src/scripts.json
@@ -1,17 +1,17 @@
{
"before": {
"optimize/index.ts": "*",
- "optimize/home-page/index.ts": "Home"
+ "optimize/home-page/modify-dom.ts": "Home"
},
"injected": {
"stop-blocking.js": "*",
- "auto-login.ts": "*",
- "autofill-otps/grievance-application.ts": "GrievAppViewAction.action",
- "show-plot-information.ts": "KnowYourProperty.action"
+ "login.ts": "*",
+ "otps/grievance-application.ts": "GrievAppViewAction.action",
+ "functionality/view-khatian.ts": "KnowYourProperty.action"
},
"loaded": {
- "autofill-captcha.ts": "*",
+ "captcha.ts": "*",
"optimize/home-page/styles.ts": "Home",
- "fix-application-receipt.ts": "Apprecrep.action"
+ "functionality/application-receipt.ts": "Apprecrep.action"
}
}
diff --git a/src/scripts/auto-login.ts b/src/scripts/auto-login.ts
deleted file mode 100644
index ae1682b..0000000
--- a/src/scripts/auto-login.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-document.addEventListener("DOMContentLoaded", () => {
- const proxiedPost = $.post;
-
- let loginData: any | null = null;
-
- $.post = function() {
- if (arguments[0].endsWith("login.action")) {
- const callback = arguments[2];
- arguments[2] = (data: any) => {
- if (!data.exception && data.checkmsg === "success") {
- loginData = arguments[1];
- }
- callback(data);
- };
- }
-
- return proxiedPost.apply(this, Array.from(arguments) as any);
- };
-
- setInterval(() => {
- if (loginData) {
- $.post(
- "/BanglarBhumi/login.action",
- loginData,
- data => {
- if (data.exception || data.checkmsg !== "success") {
- loginData = null;
- }
- },
- "json"
- );
- }
- }, 1000 * 60 * 5);
-});
diff --git a/src/scripts/autofill-captcha.ts b/src/scripts/captcha.ts
index f290fda..0eb36c9 100644
--- a/src/scripts/autofill-captcha.ts
+++ b/src/scripts/captcha.ts
@@ -1,16 +1,5 @@
const autofillCaptcha = () => {
- let captchas = Array.from(document.querySelectorAll("#txtCaptcha")) as HTMLInputElement[];
-
- for (const captcha of captchas) {
- const captchaInput = captcha.parentElement!.querySelector("#txtInput") as HTMLInputElement | null;
- if (captchaInput) {
- captchaInput.value = captcha.value.replaceAll(" ", "");
- captchaInput.style.display = "none";
- captcha.style.display = "none";
- }
- }
-
- captchas = Array.from(document.querySelectorAll("#captchaText")) as HTMLInputElement[];
+ const captchas = Array.from(document.querySelectorAll("#captchaText")) as HTMLInputElement[];
for (const captcha of captchas) {
const captchaParentElement = captcha.parentElement!;
if (captchaParentElement.id === "drawTextSpan") {
diff --git a/src/scripts/fix-application-receipt.ts b/src/scripts/functionality/application-receipt.ts
index 11dddf0..7fdf4d0 100644
--- a/src/scripts/fix-application-receipt.ts
+++ b/src/scripts/functionality/application-receipt.ts
@@ -1,4 +1,4 @@
-const receiptFormElement = document.querySelector("#form_reprint_request")!;
+const receiptFormElement = document.querySelector("#form_reprint_request") as HTMLElement;
receiptFormElement.removeAttribute("id");
receiptFormElement.removeAttribute("name");
receiptFormElement.removeAttribute("onsubmit");
@@ -6,7 +6,7 @@ receiptFormElement.removeAttribute("target");
receiptFormElement.removeAttribute("autocomplete");
receiptFormElement.removeAttribute("rel");
-let captchaElement = document.querySelector("#werter > div > div:nth-child(4)");
+let captchaElement = document.querySelector("#werter > div > div:nth-child(4)") as HTMLElement;
if (captchaElement) {
captchaElement = captchaElement!;
@@ -14,7 +14,7 @@ if (captchaElement) {
const captchaFieldElement = document.querySelector("[name=txtDrawText]") as HTMLInputElement;
const removeCaptcha = () => {
captchaFieldElement.value = captchaValueElement.value;
- (captchaElement as any).style.display = "none";
+ captchaElement.style.display = "none";
setTimeout(removeCaptcha, 1000);
};
removeCaptcha();
diff --git a/src/scripts/functionality/view-khatian.ts b/src/scripts/functionality/view-khatian.ts
new file mode 100644
index 0000000..9f35762
--- /dev/null
+++ b/src/scripts/functionality/view-khatian.ts
@@ -0,0 +1,21 @@
+declare function loadKhatian(): void;
+
+document.addEventListener("DOMContentLoaded", () => {
+ const proxiedPost = $.post;
+
+ $.post = function() {
+ if (arguments[0].startsWith("khDetailsAction_LandInfo.action")) {
+ const callback = arguments[2];
+ arguments[2] = (data: any) => {
+ callback(data);
+ const tableElement = document.querySelector("#khdetails > table > tbody > tr > td:nth-child(1) > div:nth-child(5) > table > tbody") as HTMLElement | null;
+ if (tableElement) {
+ tableElement.style.height = "auto";
+ tableElement.style.width = "100%";
+ }
+ }
+ }
+
+ return proxiedPost.apply(this, Array.from(arguments) as any);
+ }
+});
diff --git a/src/scripts/login.ts b/src/scripts/login.ts
new file mode 100644
index 0000000..e2d5d5b
--- /dev/null
+++ b/src/scripts/login.ts
@@ -0,0 +1,60 @@
+document.addEventListener("DOMContentLoaded", () => {
+ const proxiedPost = $.post;
+
+ let loginData: any | null = null;
+
+ $.post = function() {
+ if (arguments[0].endsWith("viewLoginAreaAction")) {
+ (window as any).DrawLoginCaptcha = () => {};
+ const callback = arguments[1];
+ arguments[1] = (html: any) => {
+ callback(html);
+ const captchaValueElement = document.getElementById("txtCaptcha") as HTMLInputElement;
+ const captchaInputElement = document.getElementById("txtInput") as HTMLInputElement;
+ captchaValueElement.value = "ffffff";
+ captchaInputElement.value = "ffffff";
+ captchaValueElement.style.display = "none";
+ captchaInputElement.style.display = "none";
+ (document.querySelector(".captcharefresh") as HTMLElement).style.display = "none";
+ }
+ } else if (arguments[0].endsWith("viewPasswordRecoveryArea")) {
+ (window as any).Captcha = () => {};
+ const callback = arguments[1];
+ arguments[1] = (html: any) => {
+ callback(html);
+ const captchaInputElement = document.getElementById("dText") as HTMLInputElement;
+ const captchaValueElement = document.getElementById("captaText") as HTMLInputElement;
+ captchaValueElement.value = "ffffff";
+ captchaInputElement.value = "ffffff";
+ captchaValueElement.style.display = "none";
+ captchaInputElement.style.display = "none";
+ (document.getElementById("captchaRef") as HTMLElement).style.display = "none";
+ }
+ } else if (arguments[0].endsWith("login.action")) {
+ const callback = arguments[2];
+ arguments[2] = (data: any) => {
+ if (!data.exception && data.checkmsg === "success") {
+ loginData = arguments[1];
+ }
+ callback(data);
+ };
+ }
+
+ return proxiedPost.apply(this, Array.from(arguments) as any);
+ };
+
+ setInterval(() => {
+ if (loginData) {
+ $.post(
+ "/BanglarBhumi/login.action",
+ loginData,
+ data => {
+ if (data.exception || data.checkmsg !== "success") {
+ loginData = null;
+ }
+ },
+ "json"
+ );
+ }
+ }, 1000 * 60 * 5);
+});
diff --git a/src/scripts/optimize/home-page/index.ts b/src/scripts/optimize/home-page/modify-dom.ts
index 762b4f8..762b4f8 100644
--- a/src/scripts/optimize/home-page/index.ts
+++ b/src/scripts/optimize/home-page/modify-dom.ts
diff --git a/src/scripts/optimize/home-page/styles.ts b/src/scripts/optimize/home-page/styles.ts
index 91d273a..249b361 100644
--- a/src/scripts/optimize/home-page/styles.ts
+++ b/src/scripts/optimize/home-page/styles.ts
@@ -1,20 +1,10 @@
import { styles } from "@/utils/styling";
-styles("#form_MainMenuPage > div > div.logo-div.row.ng-scope > div.top_link_icon.col-sm-7.float-right", {
- width: "100%",
- display: "flex",
- justifyContent: "space-around",
- paddingTop: "5px"
-});
-styles("#form_MainMenuPage > div > div.logo-div.row.ng-scope > div.top_link_icon.col-sm-7.float-right > a > span > i", {
- height: "40px",
- width: "40px",
- paddingTop: "10px"
-});
styles("#slider", {
overflow: "visible",
position: "initial"
});
+
styles("#slider > img", {
width: "100vw",
position: "initial"
diff --git a/src/scripts/autofill-otps/grievance-application.ts b/src/scripts/otps/grievance-application.ts
index 140504c..140504c 100644
--- a/src/scripts/autofill-otps/grievance-application.ts
+++ b/src/scripts/otps/grievance-application.ts
diff --git a/src/scripts/show-plot-information.ts b/src/scripts/show-plot-information.ts
deleted file mode 100644
index aec56d6..0000000
--- a/src/scripts/show-plot-information.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-declare function loadKhatian(): void;
-
-document.addEventListener("DOMContentLoaded", () => {
- (window as any).customLoadKhatian = () => {
- loadKhatian();
- setTimeout(() => {
- (document.querySelector("#khdetails > table > tbody > tr > td:nth-child(1) > div:nth-child(5) > table > tbody") as any).style.height = "auto";
- }, 1000);
- };
- document.querySelector("#khbutton")!.setAttribute("onclick", "customLoadKhatian()");
-});