Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(banners): Add logic to avoid duplicating RECAP banners #287

Merged
merged 11 commits into from
Dec 12, 2022
Merged
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Changes:
Fixes:
- Tighten security by verifying the sender's identity in communication between Window objects. This prevents a theoretical attack vector that might, with a lot of care and effort, have been able to send bad data to the RECAP Archive. ([#236](https://github.com/freelawproject/recap/issues/236))
- Fix logic to handle links from appellate PACER to district PACER ([#222](https://github.com/freelawproject/recap/issues/222))
- Fix logic to avoid duplicating RECAP banners ([#318](https://github.com/freelawproject/recap/issues/318))

For developers:
- Nothing yet
Expand Down
6 changes: 1 addition & 5 deletions src/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,7 @@ if (allCaseInput) {
if (caseNumberInput) {
// Add listener to the search bar
caseNumberInput.addEventListener('input', () => {
let banners = document.querySelectorAll('.recap-banner');
// Remove all HTML elements that the extension inserted
banners.forEach((banner) => {
banner.remove();
});
PACER.removeBanners();
});
}

Expand Down
1 change: 1 addition & 0 deletions src/content_delegate.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ ContentDelegate.prototype.handleDocketQueryUrl = function () {
);
} else {
if (result.results) {
PACER.removeBanners()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious...no semi-colon here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created the commit before We fixed the issue with Prettier. After I merged the main branch with this one, the code formatter made a lot of changes to this file, so I created a .git-blame-ignore-revs file to avoid messing with the blame view.

Thanks for mentioning that file during the meeting.

const form = document.querySelector('form');
const div = document.createElement('div');
div.classList.add('recap-banner');
Expand Down
6 changes: 6 additions & 0 deletions src/pacer.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ let PACER = {
return /iquery.pl/.test(url) && /[\d_-]+[A-Z]+[\d_-]+/.test(url)
},

// Remove banners inserted by the extension
removeBanners: ()=>{
let banners = document.querySelectorAll('.recap-banner')
banners.forEach(banner => { banner.remove(); });
},

// Returns true if the URL is for the iQuery page.
isBlankQueryReportUrl: function(url){
// The URL for the query form used in CM/ECF to search cases is:
Expand Down