aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2024-07-28 09:49:26 +0530
committerArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2024-07-28 09:49:26 +0530
commitaa7d86dbf28ece5a90c3848262d6a75b45370cfe (patch)
treecddfbcb4c0717bca9ef9f532ff60317539e6bf74
parente7bc5246987c5ac30995308595680ac280ada75b (diff)
downloadbanglar-bhumi-utils-aa7d86dbf28ece5a90c3848262d6a75b45370cfe.tar.gz
banglar-bhumi-utils-aa7d86dbf28ece5a90c3848262d6a75b45370cfe.zip
Added ability to download mouza maps.
Fixed view khatian and plot information download.
-rw-r--r--config/webpack/plugins/create-manifest-webpack-plugin/index.js4
-rw-r--r--config/webpack/utils/build-file.js3
-rw-r--r--src/scripts.json4
-rw-r--r--src/scripts/captcha/know-your-property.ts6
-rw-r--r--src/scripts/functionality/grn-search.ts31
-rw-r--r--src/scripts/functionality/sheet-map.ts20
-rw-r--r--src/scripts/functionality/view-khatian/download-information-pdf-page-content.html8
-rw-r--r--src/scripts/functionality/view-khatian/index.ts128
8 files changed, 96 insertions, 108 deletions
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 @@
}
</style>
<img class="banner" src="https://banglarbhumi.gov.in/BanglarBhumi/images/bl.png">
- <div class="details" id="$isPlotInformation$">$details$</div>
+ <!--<button id="print-button">Print</button>-->
+ <div class="details">$details$</div>
<footer>
<img class="footer" src="$sanghaFacilitationCentreBannerUrl$">
</footer>
@@ -229,20 +230,21 @@
};
if ($isPlotInformation$) {
+ document.querySelector(".details").setAttribute("id", "plot-information");
const tableElement = document.createElement("table");
tableElement.setAttribute("id", "locater-information");
tableBodyElement = document.createElement("tbody");
tableElement.appendChild(tableBodyElement);
- const detailsElement = document.querySelector("#plot-information > div:nth-child(1)");
+ const detailsElement = document.querySelector(".details > div:nth-child(1)");
detailsElement.insertBefore(tableElement, detailsElement.querySelector("div:nth-child(2)"));
} else {
+ document.querySelector(".details").setAttribute("id", "khatian-information");
tableBodyElement = document.querySelector(".details > table > tbody > tr > td:nth-child(1) > div:nth-child(2) > table > tbody");
}
createTableEntry("\u{99C}\u{9C7}\u{9B2}\u{9BE} (District):", "$district$");
createTableEntry("\u{9AC}\u{9CD}\u{9B2}\u{995} (Block):", "$block$");
createTableEntry("\u{9AE}\u{9CC}\u{99C}\u{9BE} (Mouza):", "$mouza$");
-
Promise.all(
Array.from(document.images)
.filter(img => !img.complete).map(img => new Promise(resolve => {
diff --git a/src/scripts/functionality/view-khatian/index.ts b/src/scripts/functionality/view-khatian/index.ts
index c54ef5a..741a3d0 100644
--- a/src/scripts/functionality/view-khatian/index.ts
+++ b/src/scripts/functionality/view-khatian/index.ts
@@ -4,80 +4,78 @@ import getDownloadInformationPDFPageContent from "@/scripts/functionality/view-k
const sanghaFacilitationCentreBannerUrl = "$l{ /assets/sangha-facilitation-centre-banner.jpg }l$";
-document.addEventListener("DOMContentLoaded", () => {
- const submitButtonElement = $("#khbutton");
- const separatorElement = $("#bodycover > div > form > hr:nth-child(2)");
- const formElement = $("#bodycover > div > form");
- let downloadPDFButton: JQuery<HTMLButtonElement> | null = null;
+const submitButtonElement = $("#khbutton");
+const separatorElement = $("#bodycover > div > form > hr:nth-child(2)");
+const formElement = $("#bodycover > div > form");
+let downloadPDFButton: JQuery<HTMLButtonElement> | null = null;
- const submitButtonElementComputedStyles = window.getComputedStyle(submitButtonElement[0]);
- const styles = Array.from(submitButtonElementComputedStyles)
- .reduce(
- (str, property) => `${str}${property}:${submitButtonElementComputedStyles.getPropertyValue(property)};`,
- ""
- );
+const submitButtonElementComputedStyles = window.getComputedStyle(submitButtonElement[0]);
+const styles = Array.from(submitButtonElementComputedStyles)
+ .reduce(
+ (str, property) => `${str}${property}:${submitButtonElementComputedStyles.getPropertyValue(property)};`,
+ ""
+ );
- const getValueOfSelectElement = (selector: string) => {
- const element = document.querySelector<HTMLSelectElement>(selector)!;
- return element.options[element.selectedIndex].text;
- };
+const getValueOfSelectElement = (selector: string) => {
+ const element = document.querySelector<HTMLSelectElement>(selector)!;
+ return element.options[element.selectedIndex].text;
+};
- let isPlotInformation: boolean | null = null;
+let isPlotInformation: boolean | null = null;
- const downloadInformationPDF = () => {
- generateWebPage(
- getDownloadInformationPDFPageContent({
- sanghaFacilitationCentreBannerUrl,
- isPlotInformation: !!isPlotInformation,
- details: $(isPlotInformation ? "#plotdetails" : "#khdetails").html(),
- district: getValueOfSelectElement("#lstDistrictCode1"),
- block: getValueOfSelectElement("#lstBlockCode1"),
- mouza: getValueOfSelectElement("#lstMouzaList")
- }),
- isPlotInformation
- ? "Plot Details"
- : "Khatian Details"
- );
- };
+const downloadInformationPDF = () => {
+ generateWebPage(
+ getDownloadInformationPDFPageContent({
+ sanghaFacilitationCentreBannerUrl,
+ isPlotInformation: !!isPlotInformation,
+ details: $(isPlotInformation ? "#plotdetails" : "#khdetails").html(),
+ district: getValueOfSelectElement("#lstDistrictCode1"),
+ block: getValueOfSelectElement("#lstBlockCode1"),
+ mouza: getValueOfSelectElement("#lstMouzaList")
+ }),
+ isPlotInformation
+ ? "Plot Details"
+ : "Khatian Details"
+ );
+};
- const showDownloadButton = (args: any) => {
- if (isPlotInformation !== null) {
- const callback = args[2];
- args[2] = (data: any) => {
- callback(data);
- const tableElement = $(isPlotInformation
- ? "#plotdetails > div:nth-child(1) > div:nth-child(4) > table > tbody"
- : "#khdetails > table > tbody > tr > td:nth-child(1) > div:nth-child(5) > table > tbody"
- );
+const showDownloadButton = (args: any) => {
+ if (isPlotInformation !== null) {
+ const callback = args[2];
+ args[2] = (data: any) => {
+ callback(data);
+ const tableElement = $(isPlotInformation
+ ? "#plotdetails > div:nth-child(1) > div:nth-child(4) > table > tbody"
+ : "#khdetails > table > tbody > tr > td:nth-child(1) > div:nth-child(5) > table > tbody"
+ );
- if (tableElement.length > 0) {
- tableElement.css("height", "auto");
- tableElement.css("width", "100%");
+ if (tableElement.length) {
+ tableElement.css("height", "auto");
+ tableElement.css("width", "100%");
- if (!downloadPDFButton) {
- downloadPDFButton = $(document.createElement("button"));
- downloadPDFButton.html("Download PDF");
- downloadPDFButton[0].style.cssText = styles;
- downloadPDFButton.css("width", "auto");
- downloadPDFButton.css("margin-bottom", "1rem");
- downloadPDFButton.click(downloadInformationPDF);
- formElement[0].insertBefore(downloadPDFButton[0], separatorElement[0]);
- }
- } else if (downloadPDFButton) {
- $(downloadPDFButton).remove();
- isPlotInformation = null;
- downloadPDFButton = null;
+ if (!downloadPDFButton) {
+ downloadPDFButton = $(document.createElement("button"));
+ downloadPDFButton.html("Download PDF");
+ downloadPDFButton[0].style.cssText = styles;
+ downloadPDFButton.css("width", "auto");
+ downloadPDFButton.css("margin-bottom", "1rem");
+ downloadPDFButton.click(downloadInformationPDF);
+ formElement[0].insertBefore(downloadPDFButton[0], separatorElement[0]);
}
+ } else if (downloadPDFButton) {
+ ($(downloadPDFButton as any) as any).remove();
+ isPlotInformation = null;
+ downloadPDFButton = null;
}
}
- };
+ }
+};
- interceptPost("plotDetailsAction_LandInfo.action", args => {
- isPlotInformation = true;
- showDownloadButton(args);
- });
- interceptPost("plotDetailsAction_LandInfo.action", args => {
- isPlotInformation = false;
- showDownloadButton(args);
- });
+interceptPost("plotDetailsAction_LandInfo.action", args => {
+ isPlotInformation = true;
+ showDownloadButton(args);
+});
+interceptPost("khDetailsAction_LandInfo.action", args => {
+ isPlotInformation = false;
+ showDownloadButton(args);
});