From 96c37726ebf084efda4c6088455f63a68b2e7876 Mon Sep 17 00:00:00 2001 From: Eduardo Rosendo Date: Thu, 20 Jul 2023 19:13:33 -0400 Subject: [PATCH 1/5] feat(utils): Add the logic to create a warning about combined PDFs --- src/utils.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/utils.js b/src/utils.js index 26876912..8aa69e2e 100644 --- a/src/utils.js +++ b/src/utils.js @@ -408,6 +408,43 @@ const insertAvailableDocBanner = (doc_url, html_element) =>{ .appendTo($(html_element)); } +// Creates a div element to let user know they're trying to buy a combined PDF +const combinedPdfWarning = () => { + let img = document.createElement('img'); + img.src = chrome.extension.getURL('assets/images/disabled-38.png'); + img.style.width = 'auto'; + img.style.height = 'auto'; + img.style.maxWidth = '38px'; + img.style.maxHeight = '38px'; + + let imgDiv = document.createElement('div'); + imgDiv.style.padding = '12px'; + imgDiv.style.display = 'flex'; + imgDiv.style.alignItems = 'center'; + imgDiv.appendChild(img); + + let text = document.createElement('p'); + text.innerHTML = `This document will not be uploaded to the RECAP Archive because the extension has detected that this page may return a combined PDF and consistently splitting these files in a proper manner is not possible for now.`; + + let messageDiv = document.createElement('div'); + messageDiv.style.display = 'flex'; + messageDiv.style.alignContent = 'center'; + messageDiv.appendChild(text); + + let innerDiv = document.createElement('div'); + innerDiv.classList.add('recap-banner'); + innerDiv.style.display = 'flex'; + innerDiv.appendChild(imgDiv); + innerDiv.appendChild(messageDiv); + + let outerDiv = document.createElement('div'); + outerDiv.style.display = 'flex'; + outerDiv.style.justifyContent = 'center'; + outerDiv.appendChild(innerDiv); + + return outerDiv; +}; + //Given a pacer_doc_id, return the pacer_case_id that it is associated with async function getPacerCaseIdFromPacerDocId(tabId, pacer_doc_id) { const tabStorage = await getItemsFromStorage(tabId); From 41085093df02113d45b40bd2673e3fd35262b368 Mon Sep 17 00:00:00 2001 From: Eduardo Rosendo Date: Thu, 20 Jul 2023 19:13:45 -0400 Subject: [PATCH 2/5] feat(pacer): Add a helper to identify combined PDF pages --- src/pacer.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/pacer.js b/src/pacer.js index e08055c8..fc062a51 100644 --- a/src/pacer.js +++ b/src/pacer.js @@ -335,7 +335,27 @@ let PACER = { inputs[inputs.length-1].value === "Download Documents" return !!pageCheck }, + + // Returns true if this is a combined PDF page (confirmation of + // pricing for all documents to receive a combined PDF file with + // all of them) + isCombinedPdfPage: function (url, document) { + // This method checks the page has the following elements: + // - The URL contains the "zipit" parameters and its value is 0 + // - The URL contains the word "show_multidocs.pl" + // - shows 2 or more buttons + let queryParameters = new URLSearchParams(window.location.search); + let isZipFile = queryParameters.get('zipit'); + let buttons = document.getElementsByTagName('input'); + let pageCheck = + !!url.match(/\/show_multidocs\.pl\?/) && + isZipFile == 0 && + buttons.length > 1 && + buttons[buttons.length - 1].value === 'View Document'; + return !!pageCheck; + }, + // Claims Register Page includes an h2 tag with the court and words "Claims Register" // exampleUrl: https://ecf.nyeb.uscourts.gov/cgi-bin/SearchClaims.pl?610550152546515-L_1_0-1 // exampleHeader:

Eastern District of New York
Claims Register

From 3acd79e66dadcf3af63c5c0a221d94f715e6ef98 Mon Sep 17 00:00:00 2001 From: Eduardo Rosendo Date: Thu, 20 Jul 2023 19:14:50 -0400 Subject: [PATCH 3/5] feat(district): Add a method to insert warning in district courts --- src/content.js | 4 ++++ src/content_delegate.js | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/content.js b/src/content.js index c1474b64..3ab29260 100644 --- a/src/content.js +++ b/src/content.js @@ -77,6 +77,10 @@ async function addRecapInformation(msg) { // creates a
element and calls submit() on it, so we hook into submit(). content_delegate.handleSingleDocumentPageView(); + // If this page offers a combined document, inserts a warning to let the user + // know this document is not supported. + content_delegate.handleCombinedPDFView(); + // If this is a Clams Register, we upload it to RECAP content_delegate.handleClaimsPageView(); diff --git a/src/content_delegate.js b/src/content_delegate.js index 7d14bdfe..f6e2fd29 100644 --- a/src/content_delegate.js +++ b/src/content_delegate.js @@ -682,6 +682,18 @@ ContentDelegate.prototype.handleZipFilePageView = function () { window.addEventListener('message', this.onDownloadAllSubmit.bind(this)); }; +// If the page offers a combined document, inserts a warning to let +// the user know this document won't be uploaded. +ContentDelegate.prototype.handleCombinedPDFView = function () { + if (!PACER.isCombinedPdfPage(this.url, document)) { + return false; + } + // query the main div of the page + let mainDiv = document.getElementById(id='cmecfMainContent') + pdfWarning = combinedPdfWarning() + mainDiv.append(pdfWarning) +}; + ContentDelegate.prototype.handleClaimsPageView = function () { // return if not a claims register page if (!PACER.isClaimsRegisterPage(this.url, document)) { From 66fc121d43a1708b8412c512d2ea31744f8bace7 Mon Sep 17 00:00:00 2001 From: Eduardo Rosendo Date: Thu, 20 Jul 2023 19:15:10 -0400 Subject: [PATCH 4/5] feat(appellate): Add a method to insert warning in appellate courts. --- src/appellate/appellate.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/appellate/appellate.js b/src/appellate/appellate.js index c52d89d7..cdd09cc2 100644 --- a/src/appellate/appellate.js +++ b/src/appellate/appellate.js @@ -32,6 +32,9 @@ AppellateDelegate.prototype.dispatchPageHandler = function () { case 'CaseQuery.jsp': this.handleCaseQueryPage(); break; + case 'ShowDocMulti': + this.handleCombinedPdfPageView(); + break default: if (APPELLATE.isAttachmentPage()) { this.handleAttachmentPage(); @@ -386,6 +389,11 @@ AppellateDelegate.prototype.handleAttachmentPage = async function () { ); }; +AppellateDelegate.prototype.handleCombinedPdfPageView = async function () { + let warning = combinedPdfWarning() + document.body.appendChild(warning) +}; + // If this page offers a single document, intercept navigation to the document view page. AppellateDelegate.prototype.handleSingleDocumentPageView = async function () { overwriteFormSubmitMethod(); From e088fc455af43156e8e2dd48e48c4c2fba892d17 Mon Sep 17 00:00:00 2001 From: Eduardo Rosendo Date: Thu, 20 Jul 2023 19:22:09 -0400 Subject: [PATCH 5/5] docs(changelog): Update the changes.md file --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index c1d03e31..7605f4a9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,7 +5,7 @@ The following changes are not yet released, but are code complete: Features: - - None yet + - Adds a warning to let users know that combined PDFs won't be uploaded to the RECAP Archive([#337](https://github.com/freelawproject/recap/issues/337), [#341](https://github.com/freelawproject/recap-chrome/pull/341)) Changes: - None yet