From aa7d86dbf28ece5a90c3848262d6a75b45370cfe Mon Sep 17 00:00:00 2001
From: Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>
Date: Sun, 28 Jul 2024 09:49:26 +0530
Subject: Added ability to download mouza maps.
Fixed view khatian and plot information download.
---
.../create-manifest-webpack-plugin/index.js | 4 +-
config/webpack/utils/build-file.js | 3 +-
src/scripts.json | 4 +-
src/scripts/captcha/know-your-property.ts | 6 +-
src/scripts/functionality/grn-search.ts | 31 -----
src/scripts/functionality/sheet-map.ts | 20 ++++
.../download-information-pdf-page-content.html | 8 +-
src/scripts/functionality/view-khatian/index.ts | 128 ++++++++++-----------
8 files changed, 96 insertions(+), 108 deletions(-)
delete mode 100644 src/scripts/functionality/grn-search.ts
create mode 100644 src/scripts/functionality/sheet-map.ts
diff --git a/config/webpack/plugins/create-manifest-webpack-plugin/index.js b/config/webpack/plugins/create-manifest-webpack-plugin/index.js
index 92c3096..8dc0ae4 100644
--- a/config/webpack/plugins/create-manifest-webpack-plugin/index.js
+++ b/config/webpack/plugins/create-manifest-webpack-plugin/index.js
@@ -57,10 +57,10 @@ class CreateManifestPlugin {
delete arrangedScripts["*"]["document_start"];
for (const scriptPath in arrangedScripts) {
- const matches = [`*://banglarbhumi.gov.in/BanglarBhumi/${scriptPath}`];
+ const matches = [`*://banglarbhumi.gov.in/BanglarBhumi/${scriptPath}*`];
if (scriptPath === "Home")
- matches.push(`*://banglarbhumi.gov.in/BanglarBhumi/${scriptPath}.action`);
+ matches.push(`*://banglarbhumi.gov.in/BanglarBhumi/${scriptPath}.action*`);
for (const scriptRuntime in arrangedScripts[scriptPath]) {
manifest.content_scripts.push({
diff --git a/config/webpack/utils/build-file.js b/config/webpack/utils/build-file.js
index 6d8fc85..2ab8d86 100644
--- a/config/webpack/utils/build-file.js
+++ b/config/webpack/utils/build-file.js
@@ -4,7 +4,8 @@ module.exports.getFileName = (fileName, prefix, justHash = false) => {
let hash = crypto
.createHash("md5")
.update(`${prefix}-${fileName}`)
- .digest("hex").substring(16);
+ .digest("hex")
+ .substring(16);
if (production) {
return hash;
diff --git a/src/scripts.json b/src/scripts.json
index bc522cd..5a821b4 100644
--- a/src/scripts.json
+++ b/src/scripts.json
@@ -7,8 +7,8 @@
"otps/warish-application.ts": "WarishAppViewAction.action",
"functionality/mutation-application.ts": "MuteApplication.action",
"functionality/view-khatian/index.ts": "KnowYourProperty.action",
- "functionality/grn-search.ts": "appGrnSrch",
"captcha/know-your-property.ts": "KnowYourProperty.action",
- "captcha/application-receipt.ts": "Apprecrep.action"
+ "captcha/application-receipt.ts": "Apprecrep.action",
+ "functionality/sheet-map.ts": "SheetMapViewAction.action?lstSheetNo=0"
}
}
diff --git a/src/scripts/captcha/know-your-property.ts b/src/scripts/captcha/know-your-property.ts
index ae74b92..eac33f1 100644
--- a/src/scripts/captcha/know-your-property.ts
+++ b/src/scripts/captcha/know-your-property.ts
@@ -1,4 +1,2 @@
-document.addEventListener("DOMContentLoaded", () => {
- (window as any).validateCaptcha = () => true;
- $("#khatianPlotDiv > div:nth-child(6) > div").hide();
-});
+(window as any).validateCaptcha = () => true;
+$("#khatianPlotDiv > div:nth-child(6) > div").hide();
diff --git a/src/scripts/functionality/grn-search.ts b/src/scripts/functionality/grn-search.ts
deleted file mode 100644
index 02471f5..0000000
--- a/src/scripts/functionality/grn-search.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-$("#frmpaymentDetails > div:nth-child(2) > div:nth-child(1) > div:nth-child(4)").hide();
-const captcha = $("#txtDrawText");
-const captchaText = $("#captchaText");
-captcha.val((captchaText.val() as string).replaceAll(" ", ""));
-
-const requestTypeElement = $("#lstRequestType");
-const grnNumberElement = $("#txtGRN_NO");
-const applicationNumberElement = $("#txtAPPLN_NO");
-
-const requestType = localStorage.getItem("requestType");
-const grnNumber = localStorage.getItem("grnNumber");
-const applicationNumber = localStorage.getItem("applicationNumber");
-
-if (requestType) {
- requestTypeElement.val(requestType);
-}
-
-if (grnNumber) {
- grnNumberElement.val(grnNumber);
-}
-
-if (applicationNumber) {
- applicationNumberElement.val(applicationNumber);
-}
-
-$("#btnSubmitGRNNo").click(() => {
- captcha.val((captchaText.val() as string).replaceAll(" ", ""));
- localStorage.setItem("requestType", requestTypeElement.val() as string);
- localStorage.setItem("grnNumber", grnNumberElement.val() as string);
- localStorage.setItem("applicationNumber", applicationNumberElement.val() as string);
-});
diff --git a/src/scripts/functionality/sheet-map.ts b/src/scripts/functionality/sheet-map.ts
new file mode 100644
index 0000000..4e3bc75
--- /dev/null
+++ b/src/scripts/functionality/sheet-map.ts
@@ -0,0 +1,20 @@
+const downloadButtonContainer = document.createElement("td");
+const downloadButton = document.createElement("button");
+downloadButton.innerHTML = "DOWNLOAD";
+downloadButtonContainer.appendChild(downloadButton);
+const svgElement = document.querySelector("svg");
+(document.querySelector("#headerTable > tbody > tr") as any).appendChild(downloadButtonContainer);
+downloadButton.addEventListener("click", e => {
+ e.preventDefault();
+ (document.querySelector("#btnResetZoom") as any).click()
+ function download(filename: string, text: string) {
+ const element = document.createElement("a");
+ element.setAttribute("href", "data:text/plain;charset=utf-8," + encodeURIComponent(text));
+ element.setAttribute("download", filename);
+ element.style.display = "none";
+ document.body.appendChild(element);
+ element.click();
+ document.body.removeChild(element);
+ }
+ download("map.svg", $("#OpenLayers_Layer_Vector_RootContainer_35").html());
+});
diff --git a/src/scripts/functionality/view-khatian/download-information-pdf-page-content.html b/src/scripts/functionality/view-khatian/download-information-pdf-page-content.html
index 44ced4f..668c36a 100644
--- a/src/scripts/functionality/view-khatian/download-information-pdf-page-content.html
+++ b/src/scripts/functionality/view-khatian/download-information-pdf-page-content.html
@@ -211,7 +211,8 @@
}
-