billy-herrington-utils 1.6.0 → 2.0.1
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/README.md +2 -2
- package/dist/billy-herrington-utils.es.js +5908 -327
- package/dist/billy-herrington-utils.es.js.map +1 -1
- package/dist/billy-herrington-utils.umd.js +5912 -331
- package/dist/billy-herrington-utils.umd.js.map +1 -1
- package/dist/index.d.ts +111 -103
- package/package.json +7 -5
- package/src/index.ts +18 -5
- package/src/types/globals.d.ts +0 -2
- package/src/userscripts/data-manager/data-filter.ts +110 -0
- package/src/userscripts/data-manager/index.ts +77 -174
- package/src/userscripts/infinite-scroll/index.ts +72 -71
- package/src/userscripts/pagination-parsing/index.ts +21 -29
- package/src/userscripts/pagination-parsing/pagination-strategies/PaginationStrategy.ts +4 -12
- package/src/userscripts/pagination-parsing/pagination-strategies/PaginationStrategyDataParams.ts +11 -2
- package/src/userscripts/pagination-parsing/pagination-strategies/PaginationStrategyPathnameParams.ts +29 -2
- package/src/userscripts/pagination-parsing/pagination-strategies/PaginationStrategySearchParams.ts +15 -7
- package/src/userscripts/pagination-parsing/pagination-strategies/PaginationStrategyTrash.ts +9 -12
- package/src/userscripts/pagination-parsing/pagination-strategies/index.ts +1 -1
- package/src/userscripts/pagination-parsing/pagination-utils/index.ts +36 -7
- package/src/userscripts/router/router.ts +71 -0
- package/src/userscripts/rules/index.ts +228 -3
- package/src/userscripts/types/index.ts +19 -0
- package/src/utils/arrays/index.ts +3 -1
- package/src/utils/async/index.ts +22 -6
- package/src/utils/dom/index.ts +35 -68
- package/src/utils/dom/observers.ts +76 -0
- package/src/utils/events/index.ts +9 -2
- package/src/utils/fetch/index.ts +14 -7
- package/src/utils/objects/index.ts +25 -0
- package/src/utils/observers/index.ts +8 -2
- package/src/utils/parsers/index.ts +18 -11
- package/src/utils/strings/index.ts +5 -5
- package/src/utils/strings/regexes.ts +31 -0
- package/src/utils/userscript/index.ts +10 -0
- package/src/userscripts/jabroni-outfit-wrap/index.ts +0 -40
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ npm i billy-herrington-utils
|
|
|
32
32
|
|
|
33
33
|
| Function | Short Explanation | Input Parameters | Example Input/Output or Usage |
|
|
34
34
|
|---|---|---|---|
|
|
35
|
-
| `
|
|
35
|
+
| `splitWith(s)` | Splits a comma-separated string into an array of lowercase, trimmed words. | `s: string` | `splitWith("Hello, world!, Test_String")` -> `["hello", "world", "test_string"]` |
|
|
36
36
|
| `sanitizeStr(s)` | Cleans up a string by removing newlines/tabs, excess spaces, and converting to lowercase. | `s: string` | `sanitizeStr(" Hello \nWorld ")` -> `"hello world"` |
|
|
37
37
|
| `formatTimeToHHMMSS(timeString)` | Formats a time string (e.g., "1h 30min 15sec") into "HH:MM:SS". | `timeString: string` | `formatTimeToHHMMSS("1h 2min")` -> `"01:02:00"` |
|
|
38
38
|
| `timeToSeconds(t)` | Converts a time string (e.g., "1h 30min") or "HH:MM:SS" into total seconds. | `t: string` | `timeToSeconds("1h 2min")` -> `3720` |
|
|
@@ -58,7 +58,7 @@ npm i billy-herrington-utils
|
|
|
58
58
|
| `replaceElementTag(e, tagName)` | Replaces an element's tag while preserving its content and attributes. | `e: HTMLElement`, `tagName: string` | `replaceElementTag(document.querySelector('p'), 'div')` |
|
|
59
59
|
| `getAllUniqueParents(elements)` | Returns an array of unique parent elements. | `elements: Array<HTMLElement>` | `getAllUniqueParents([el1, el2])` |
|
|
60
60
|
| `findNextSibling(el)` | Finds the next sibling, or recursively checks parent elements. | `el: HTMLElement` | `findNextSibling(document.querySelector('li'))` |
|
|
61
|
-
| `
|
|
61
|
+
| `waitForElementToAppear(parent, selector, callback)` | Waits for an element to exist in the DOM and then runs a callback. | `parent: HTMLElement`, `selector: string`, `callback: Function` | `waitForElementToAppear(document.body, '.my-class', (el) => console.log(el))` |
|
|
62
62
|
| `watchElementChildrenCount(element, callback)` | Observes an element for changes in its number of children. | `element: HTMLElement`, `callback: Function` | `watchElementChildrenCount(list, (obs, count) => console.log(count))` |
|
|
63
63
|
| `watchDomChangesWithThrottle(element, callback, throttle, times, options)` | Watches for DOM changes with a throttle to prevent excessive callbacks. | `element: HTMLElement`, `callback: Function`, `throttle: number`, `times: number`, `options: object` | `watchDomChangesWithThrottle(body, () => ..., 500)` |
|
|
64
64
|
| `downloader(options)` | Creates a button to download a video from the page. | `options: object` | `downloader({ button: '<button>Download</button>', append: 'body' })` |
|