diff --git a/pacer.js b/pacer.js index f0f86a00..0dfc32c4 100644 --- a/pacer.js +++ b/pacer.js @@ -65,23 +65,6 @@ let PACER = { return !!url.match(/\/(DktRpt|HistDocQry)\.pl\?\d+$/); }, - // Given a URL that satisfies isDocketQueryUrl, gets its case number. - getCaseNumberFromUrls: function (urls) { - // Iterate over an array of URLs and get the case number from the first one - // that matches. Allows calling function to send a variety of URLs, like the - // referer and the actual URL, for example. - for (let url of urls){ - let hostname = getHostname(url); - // JS is trash. It lacks a way of getting the TLD, so we use endsWith. - if (hostname.endsWith('uscourts.gov')){ - let match = url.match(/\?(\d+)$/); - if (match){ - return match[1]; - } - } - } - }, - // Returns true if the given URL is for a docket display page (i.e. the page // after submitting the "Docket Sheet" or "History/Documents" query page). isDocketDisplayUrl: function (url) { @@ -118,6 +101,23 @@ let PACER = { } }, + // Given a URL that satisfies isDocketQueryUrl, gets its case number. + getCaseNumberFromUrls: function (urls) { + // Iterate over an array of URLs and get the case number from the first one + // that matches. Allows calling function to send a variety of URLs, like the + // referer and the actual URL, for example. + for (let url of urls) { + let hostname = getHostname(url); + // JS is trash. It lacks a way of getting the TLD, so we use endsWith. + if (hostname.endsWith('uscourts.gov')) { + let match = url.match(/\?(\d+)$/); + if (match) { + return match[1]; + } + } + } + }, + // Gets the last path component of a URL. getBaseNameFromUrl: function (url) { return url.replace(/\?.*/, '').replace(/.*\//, '');