Spaces:
Runtime error
Runtime error
Update templates/gui.html
Browse files- templates/gui.html +14 -7
templates/gui.html
CHANGED
|
@@ -14,26 +14,33 @@
|
|
| 14 |
///////////////////////////////////////////////BEGIN JS CODE//////////////////////////////////////////////////
|
| 15 |
// Function to send the Dropbox link and keyword to the server
|
| 16 |
function getURLParams() {
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
return {
|
| 19 |
-
pdfLink: urlParams.get('
|
| 20 |
-
keyword: decodeURIComponent(urlParams.get('keyword') || '')
|
| 21 |
// pageNumber: parseInt(urlParams.get('page')) || 1,
|
| 22 |
// zoomRect: urlParams.get('zoom') || '' // Expecting format: "x,y,width,height"
|
| 23 |
};
|
| 24 |
}
|
| 25 |
|
| 26 |
function processPdf() {
|
| 27 |
-
const
|
| 28 |
|
| 29 |
-
if (!pdfLink
|
| 30 |
console.error("Missing PDF link or keyword.");
|
| 31 |
return;
|
| 32 |
}
|
| 33 |
|
| 34 |
console.log("Extracted PDF Link:", pdfLink);
|
| 35 |
-
console.log("Extracted Keyword:", keyword);
|
| 36 |
-
|
| 37 |
// Create a new FormData object to send the data as form data
|
| 38 |
const formData = new FormData();
|
| 39 |
formData.append('pdf_link', pdfLink);
|
|
|
|
| 14 |
///////////////////////////////////////////////BEGIN JS CODE//////////////////////////////////////////////////
|
| 15 |
// Function to send the Dropbox link and keyword to the server
|
| 16 |
function getURLParams() {
|
| 17 |
+
// Get URL parameters
|
| 18 |
+
const params = new URLSearchParams(window.location.search);
|
| 19 |
+
const pdfLink = params.get("pdfLink");
|
| 20 |
+
|
| 21 |
+
if (dropboxLink) {
|
| 22 |
+
const pdfLink = decodeURIComponent(pdfLink);
|
| 23 |
+
console.log("Decoded Dropbox Link:", decodedLink);
|
| 24 |
+
}
|
| 25 |
return {
|
| 26 |
+
pdfLink: urlParams.get('pdfLink')
|
| 27 |
+
// keyword: decodeURIComponent(urlParams.get('keyword') || '')
|
| 28 |
// pageNumber: parseInt(urlParams.get('page')) || 1,
|
| 29 |
// zoomRect: urlParams.get('zoom') || '' // Expecting format: "x,y,width,height"
|
| 30 |
};
|
| 31 |
}
|
| 32 |
|
| 33 |
function processPdf() {
|
| 34 |
+
const pdfLink = getURLParams();
|
| 35 |
|
| 36 |
+
if (!pdfLink ) {
|
| 37 |
console.error("Missing PDF link or keyword.");
|
| 38 |
return;
|
| 39 |
}
|
| 40 |
|
| 41 |
console.log("Extracted PDF Link:", pdfLink);
|
| 42 |
+
// console.log("Extracted Keyword:", keyword);
|
| 43 |
+
keyword='mysetkeywrod'
|
| 44 |
// Create a new FormData object to send the data as form data
|
| 45 |
const formData = new FormData();
|
| 46 |
formData.append('pdf_link', pdfLink);
|