Last active
October 4, 2022 06:11
-
-
Save hsayed21/a0bae8133deeba509494b72471b6428f to your computer and use it in GitHub Desktop.
Revisions
-
hsayed21 revised this gist
Oct 4, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ for (var i = 0; i < elements.length; i++) { // scroll to bottom of page window.scrollTo(0, document.body.scrollHeight); // get downloaded link var link = document.querySelector(".dropdown-menu > #download_pdf_searchable"); // append the full href to result result += link.href + "\n"; // remove the class "selected" from the current element -
hsayed21 created this gist
Oct 4, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,54 @@ var result = ""; // for each on all elements in div with id "grid" var elements = document.getElementById("grid").children; // get all children divs in div with id "grid" for (var i = 0; i < elements.length; i++) { // get the current element var element = elements[i]; // add the class "selected" to the current element element.classList.add("selected"); // after that click on ocr button document.querySelector(".pdf_ocr").click(); // wait 2 second await new Promise(r => setTimeout(r, 2000)); // get div with class "modal" var modal = document.querySelector("#spin_box"); // wait until modal class to be "modal" because it will be "modal show" and display: block while (modal.classList.contains("show") && modal.style.display == "block") { // wait 100ms await new Promise(r => setTimeout(r, 1000)); } // scroll to bottom of page window.scrollTo(0, document.body.scrollHeight); // get downloaded link var link = document.querySelector(".dropdown-menu > #download_pdf_searchable");he link // append the full href to result result += link.href + "\n"; // remove the class "selected" from the current element element.classList.remove("selected"); // scroll to top of page window.scrollTo(0, 0); } function CopyToClipboard(copyText) { navigator.clipboard .writeText(copyText) .then(() => { console.log('copied to clipboard'); }) .catch(() => { const input = document.createElement('input') document.body.appendChild(input) input.setAttribute('value', copyText) input.select() if (document.execCommand('copy')) { document.execCommand('copy') } document.body.removeChild(input) console.log('copied to clipboard2'); }) } console.log(result); // copy the result to clipboard CopyToClipboard(result);