Skip to content

Commit

Permalink
feature: rename authorising act PDF as well
Browse files Browse the repository at this point in the history
  • Loading branch information
hueyy committed Aug 13, 2023
1 parent d6bd691 commit ebfe22a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ContentScript/DownloadInterceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ const interceptSSODownloads = async (port: Runtime.Port) => {
(qs.parse(search, { ignoreQueryPrefix: true })[`ViewType`] === `Sl`)
)
if (isSubsidiaryLegislationView){
// download button for authorising act
const authorisingActDownloadButton = (await waitForElement(`.legis-title a[title="Download PDF"]`, false) as Element)
const legislationName = authorisingActDownloadButton.parentElement.parentElement.querySelector(`.legis-title > span`).textContent.trim()
const fileName = Helpers.sanitiseFilename(`${legislationName}.pdf`)
augmentDownloadButton(port, authorisingActDownloadButton as HTMLAnchorElement, fileName)

// download buttons for subsidiary legislation
const downloadButtons = (await waitForElement(`td.hidden-xs a.file-download`, true) as NodeListOf<Element>)
for(const downloadButton of downloadButtons){
const legislationName = downloadButton.parentElement.parentElement.children[0].querySelector(`a.non-ajax`).textContent.trim()
Expand Down

0 comments on commit ebfe22a

Please sign in to comment.