billy-herrington-utils 1.6.0 → 2.0.0

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.
Files changed (36) hide show
  1. package/README.md +2 -2
  2. package/dist/billy-herrington-utils.es.js +5907 -327
  3. package/dist/billy-herrington-utils.es.js.map +1 -1
  4. package/dist/billy-herrington-utils.umd.js +5911 -331
  5. package/dist/billy-herrington-utils.umd.js.map +1 -1
  6. package/dist/index.d.ts +110 -103
  7. package/package.json +7 -5
  8. package/src/index.ts +18 -5
  9. package/src/types/globals.d.ts +0 -2
  10. package/src/userscripts/data-manager/data-filter.ts +110 -0
  11. package/src/userscripts/data-manager/index.ts +77 -174
  12. package/src/userscripts/infinite-scroll/index.ts +72 -71
  13. package/src/userscripts/pagination-parsing/index.ts +21 -29
  14. package/src/userscripts/pagination-parsing/pagination-strategies/PaginationStrategy.ts +4 -12
  15. package/src/userscripts/pagination-parsing/pagination-strategies/PaginationStrategyDataParams.ts +11 -2
  16. package/src/userscripts/pagination-parsing/pagination-strategies/PaginationStrategyPathnameParams.ts +29 -2
  17. package/src/userscripts/pagination-parsing/pagination-strategies/PaginationStrategySearchParams.ts +15 -7
  18. package/src/userscripts/pagination-parsing/pagination-strategies/PaginationStrategyTrash.ts +9 -12
  19. package/src/userscripts/pagination-parsing/pagination-strategies/index.ts +1 -1
  20. package/src/userscripts/pagination-parsing/pagination-utils/index.ts +36 -7
  21. package/src/userscripts/router/router.ts +71 -0
  22. package/src/userscripts/rules/index.ts +227 -3
  23. package/src/userscripts/types/index.ts +19 -0
  24. package/src/utils/arrays/index.ts +3 -1
  25. package/src/utils/async/index.ts +22 -6
  26. package/src/utils/dom/index.ts +35 -68
  27. package/src/utils/dom/observers.ts +76 -0
  28. package/src/utils/events/index.ts +9 -2
  29. package/src/utils/fetch/index.ts +14 -7
  30. package/src/utils/objects/index.ts +25 -0
  31. package/src/utils/observers/index.ts +8 -2
  32. package/src/utils/parsers/index.ts +18 -11
  33. package/src/utils/strings/index.ts +5 -5
  34. package/src/utils/strings/regexes.ts +31 -0
  35. package/src/utils/userscript/index.ts +10 -0
  36. 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
- | `stringToWords(s)` | Splits a comma-separated string into an array of lowercase, trimmed words. | `s: string` | `stringToWords("Hello, world!, Test_String")` -> `["hello", "world", "test_string"]` |
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
- | `waitForElementExists(parent, selector, callback)` | Waits for an element to exist in the DOM and then runs a callback. | `parent: HTMLElement`, `selector: string`, `callback: Function` | `waitForElementExists(document.body, '.my-class', (el) => console.log(el))` |
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' })` |