billy-herrington-utils 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/userscripts/pagination-parsing/pagination-strategies/PaginationStrategyPathnameParams.ts
CHANGED
|
@@ -39,6 +39,7 @@ export class PaginationStrategyPathnameParams extends PaginationStrategy {
|
|
|
39
39
|
const links = getPaginationLinks(
|
|
40
40
|
(this.getPaginationElement() || document) as HTMLElement,
|
|
41
41
|
this.url.href,
|
|
42
|
+
true,
|
|
42
43
|
this.pathnameSelector,
|
|
43
44
|
);
|
|
44
45
|
const pages = Array.from(links, this.extractPage);
|
|
@@ -6,6 +6,7 @@ export function parseURL(s: HTMLAnchorElement | Location | URL | string): URL {
|
|
|
6
6
|
export function getPaginationLinks(
|
|
7
7
|
doc: Element | HTMLElement | Document = document,
|
|
8
8
|
url: Location | URL | string = location.href,
|
|
9
|
+
pathnameStrict = true,
|
|
9
10
|
pathnameSelector = /\/(page\/)?\d+\/?$/,
|
|
10
11
|
): string[] {
|
|
11
12
|
const currentUrl = parseURL(url);
|
|
@@ -20,7 +21,7 @@ export function getPaginationLinks(
|
|
|
20
21
|
return (
|
|
21
22
|
// in case of origin sometimes it's protocols problem cause some links can be not https but http
|
|
22
23
|
linkUrl.hostname === currentUrl.hostname &&
|
|
23
|
-
linkUrl.pathname.startsWith(currentUrl.pathname)
|
|
24
|
+
(pathnameStrict ? linkUrl.pathname.startsWith(currentUrl.pathname) : true)
|
|
24
25
|
);
|
|
25
26
|
} catch {
|
|
26
27
|
return false;
|