billy-herrington-utils 2.0.3 → 2.0.4
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/dist/index.d.ts
CHANGED
|
@@ -216,7 +216,7 @@ export declare class RulesGlobal {
|
|
|
216
216
|
thumbsSelector: string;
|
|
217
217
|
getThumbsStrategy: 'default' | 'auto';
|
|
218
218
|
getThumbs(html: HTMLElement): HTMLElement[];
|
|
219
|
-
paginationStrategyOptions:
|
|
219
|
+
paginationStrategyOptions: Partial<PaginationStrategy>;
|
|
220
220
|
paginationStrategy: PaginationStrategy;
|
|
221
221
|
get observable(): HTMLElement;
|
|
222
222
|
mutationObservers: MutationObserver[];
|
package/package.json
CHANGED
|
@@ -10,28 +10,29 @@ import { DataManager } from '../data-manager';
|
|
|
10
10
|
import type { CustomSelector } from '../data-manager/data-filter';
|
|
11
11
|
import { InfiniteScroller, type OffsetGenerator } from '../infinite-scroll/';
|
|
12
12
|
import { getPaginationStrategy } from '../pagination-parsing';
|
|
13
|
+
import type { PaginationStrategy } from '../pagination-parsing/pagination-strategies';
|
|
13
14
|
|
|
14
15
|
type ThumbData = { title: string; duration?: number };
|
|
15
16
|
|
|
16
17
|
export class RulesGlobal {
|
|
17
|
-
delay?: number;
|
|
18
|
+
public delay?: number;
|
|
18
19
|
|
|
19
|
-
alternativeGenerator?: () => OffsetGenerator;
|
|
20
|
+
public alternativeGenerator?: () => OffsetGenerator;
|
|
20
21
|
|
|
21
|
-
getThumbUrl(thumb: HTMLElement | HTMLAnchorElement) {
|
|
22
|
+
public getThumbUrl(thumb: HTMLElement | HTMLAnchorElement) {
|
|
22
23
|
return ((thumb.querySelector('a[href]') || thumb) as HTMLAnchorElement).href;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
titleSelector: undefined | string;
|
|
26
|
-
uploaderSelector: undefined | string;
|
|
27
|
-
durationSelector: undefined | string;
|
|
28
|
-
getThumbDataStrategy: 'default' | 'auto-select' | 'auto-text' = 'default';
|
|
26
|
+
public titleSelector: undefined | string;
|
|
27
|
+
public uploaderSelector: undefined | string;
|
|
28
|
+
public durationSelector: undefined | string;
|
|
29
|
+
public getThumbDataStrategy: 'default' | 'auto-select' | 'auto-text' = 'default';
|
|
29
30
|
// durationParseStrategy: 'default' | 'auto' = 'default';
|
|
30
31
|
// timeToSeconds(thumb.innerText.match(/\d+m/)?.[0]);
|
|
31
32
|
|
|
32
|
-
getThumbDataCallback?: (thumb: HTMLElement, thumbData: ThumbData) => void;
|
|
33
|
+
public getThumbDataCallback?: (thumb: HTMLElement, thumbData: ThumbData) => void;
|
|
33
34
|
|
|
34
|
-
getThumbData(thumb: HTMLElement): ThumbData {
|
|
35
|
+
public getThumbData(thumb: HTMLElement): ThumbData {
|
|
35
36
|
let { titleSelector, uploaderSelector, durationSelector } = this;
|
|
36
37
|
const thumbData: ThumbData = { title: '' };
|
|
37
38
|
|
|
@@ -69,11 +70,11 @@ export class RulesGlobal {
|
|
|
69
70
|
return thumbData;
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
getThumbImgDataAttrSelector: string | undefined;
|
|
73
|
-
getThumbImgDataStrategy: 'default' | 'auto' = 'default';
|
|
73
|
+
public getThumbImgDataAttrSelector: string | undefined;
|
|
74
|
+
public getThumbImgDataStrategy: 'default' | 'auto' = 'default';
|
|
74
75
|
// getThumbImgDataRemLazy: boolean | string = false;
|
|
75
76
|
|
|
76
|
-
getThumbImgData(thumb: HTMLElement) {
|
|
77
|
+
public getThumbImgData(thumb: HTMLElement) {
|
|
77
78
|
const result: { img?: HTMLImageElement; imgSrc?: string } = {};
|
|
78
79
|
|
|
79
80
|
if (this.getThumbImgDataStrategy === 'auto') {
|
|
@@ -106,8 +107,8 @@ export class RulesGlobal {
|
|
|
106
107
|
return result;
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
containerSelector: string | (() => HTMLElement) = '.container';
|
|
110
|
-
intersectionObservable?: HTMLElement;
|
|
110
|
+
public containerSelector: string | (() => HTMLElement) = '.container';
|
|
111
|
+
public intersectionObservable?: HTMLElement;
|
|
111
112
|
|
|
112
113
|
get container() {
|
|
113
114
|
if (typeof this.containerSelector === 'string') {
|
|
@@ -116,10 +117,10 @@ export class RulesGlobal {
|
|
|
116
117
|
return this.containerSelector();
|
|
117
118
|
}
|
|
118
119
|
|
|
119
|
-
thumbsSelector = '.thumb';
|
|
120
|
-
getThumbsStrategy: 'default' | 'auto' = 'default';
|
|
120
|
+
public thumbsSelector = '.thumb';
|
|
121
|
+
public getThumbsStrategy: 'default' | 'auto' = 'default';
|
|
121
122
|
|
|
122
|
-
getThumbs(html: HTMLElement): HTMLElement[] {
|
|
123
|
+
public getThumbs(html: HTMLElement): HTMLElement[] {
|
|
123
124
|
if (this.getThumbsStrategy === 'auto') {
|
|
124
125
|
if (typeof this.containerSelector !== 'string') return [];
|
|
125
126
|
const container = html.querySelector(this.containerSelector);
|
|
@@ -131,8 +132,8 @@ export class RulesGlobal {
|
|
|
131
132
|
return thumbs;
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
paginationStrategyOptions:
|
|
135
|
-
paginationStrategy = getPaginationStrategy(this.paginationStrategyOptions);
|
|
135
|
+
public paginationStrategyOptions: Partial<PaginationStrategy> = {};
|
|
136
|
+
public paginationStrategy = getPaginationStrategy(this.paginationStrategyOptions);
|
|
136
137
|
|
|
137
138
|
// get paginationElement() {
|
|
138
139
|
// return this.paginationStrategy.getPaginationElement();
|
|
@@ -150,7 +151,7 @@ export class RulesGlobal {
|
|
|
150
151
|
// return this.paginationStrategy.getPaginationUrlGenerator();
|
|
151
152
|
// }
|
|
152
153
|
|
|
153
|
-
get observable(): HTMLElement {
|
|
154
|
+
public get observable(): HTMLElement {
|
|
154
155
|
return (this.intersectionObservable ||
|
|
155
156
|
this.paginationStrategy.getPaginationElement()) as HTMLElement;
|
|
156
157
|
}
|
|
@@ -165,7 +166,7 @@ export class RulesGlobal {
|
|
|
165
166
|
this.resetOn();
|
|
166
167
|
}
|
|
167
168
|
|
|
168
|
-
resetOnPaginationOrContainerDeath = true;
|
|
169
|
+
public resetOnPaginationOrContainerDeath = true;
|
|
169
170
|
|
|
170
171
|
resetOn() {
|
|
171
172
|
if (!this.resetOnPaginationOrContainerDeath) return;
|
|
@@ -183,9 +184,9 @@ export class RulesGlobal {
|
|
|
183
184
|
});
|
|
184
185
|
}
|
|
185
186
|
|
|
186
|
-
customSelectors: Record<string, CustomSelector<any>> = {};
|
|
187
|
+
public customSelectors: Record<string, CustomSelector<any>> = {};
|
|
187
188
|
|
|
188
|
-
animatePreview?: (doc?: HTMLElement) => void;
|
|
189
|
+
public animatePreview?: (doc?: HTMLElement) => void;
|
|
189
190
|
|
|
190
191
|
public storeOptions?: JabroniTypes.StoreStateOptions;
|
|
191
192
|
public customScheme?: JabroniTypes.SchemeInput;
|