UserUtils

Various utilities for userscripts - register listeners for when CSS selectors exist, intercept events, manage persistent user configurations, modify the DOM more easily, useful math and array functions and more

These are versions of this script where the code was updated. Show all versions.

  • v6.3.0 2024-04-06
    • Made openInNewTab() use GM.openInTab by default and fall back to the old behavior.
      Also added background param to specify if the tab should get focus when opened.
  • v6.2.0 2024-04-02
    • Add property to change the debounce edge in SelectorObserver instances
  • v6.1.0 2024-04-02
    • Added parameter to switch debounce() to trigger on the rising edge, instead of just the falling edge (see docs)
  • v6.0.1 2024-03-24
    • Fixed terminology in JSDoc comments of the DataStore class
  • v6.0.0 2024-03-23
    • Renamed ConfigManager to DataStore to make its implied purpose as a generic JSON database more clear.
      • the constructor property defaultConfig is now called defaultData
      • deleteConfig() is now called deleteData()
      • the internal GM storage keys will still have the prefix _uucfg for backwards compatibility
    • Added function getSiblingsFrame() that returns a frame of an element's siblings, with a given alignment and size
    • Lowered the Error.stackTraceLimit by a multiple of 10 to preserve memory
  • v5.0.1 2024-02-28
    • ConfigManager.loadData() now returns a copy of the data instead of a reference
  • v5.0.0 2024-02-20
    • compress() now uses the same value "string" (unlike previously "base64") for the outputType parameter like decompress()
    • Added encodeData() and decodeData() to the ConfigManager options to allow for easy data compression
  • v4.2.1 2024-02-16
    • Fixed TS types for overload of SelectorObserver constructor
  • v4.2.0 2024-02-16
    • Added SelectorObserver options disableOnNoListeners and enableOnAddListener
    • addGlobalStyle now returns the created style element
    • fetchAdvanced is now a drop-in replacement and timeout can now optionally be disabled
  • v4.1.0 2024-01-05

    - Added function `observeElementProp` to watch for a property of an element to change that isn't observable with MutationObserver

  • v4.0.0 2023-11-21
    • Removed amplifyMedia function due to massive inconsistencies in sound quality
    • Added functions compress and decompress to compress and decompress strings using gzip or deflate
    • Added TS utility types NonEmptyString and LooseUnion
    • Fixed wrong TS type for SelectorObserver options in constructor
  • v3.0.0 2023-11-12

    - `onSelector()` has been turned into the `SelectorObserver` class to reduce the performance impact on larger sites ([see migration info here](https://github.com/Sv443-Network/UserUtils/blob/main/CHANGELOG.md#300))
    - Removed the limiter from `amplifyMedia()` for clear and undistorted audio and renamed properties ([see migration info here](https://github.com/Sv443-Network/UserUtils/blob/main/CHANGELOG.md#300))
    - Added function `randomId()` to randomly generate cryptographically strong hexadecimal IDs
    - Added utility type `NonEmptyArray` for typing an array with at least 1 item

  • v2.0.1 2023-10-04

    Changed default limiter options to be more balanced

  • v2.0.0 2023-10-01

    Added compression to amplifyMedia() to prevent audio clipping and distortion and modified return type accordingly:

    • Renamed: amplify() to setGain() and getAmpLevel() to getGain()
    • Added properties: enable(), disable(), setLimiterOptions() and limiterNode
    • Other changes: Amplification is no longer enabled automatically, enable() must now be called manually after initializing
  • v1.2.0 2023-09-21
    • Added function insertValues() to insert values into a string with placeholders
    • Added lightweight translation system using tr()
  • v1.1.3 2023-09-19

    Added UserLibrary header

  • v1.1.2 2023-09-16

    Exported ConfigMigrationsDict for easier use with TypeScript

  • v1.1.1 2023-09-14

    Fixed TypeScript error in ConfigManager migrations

  • v1.1.0 2023-09-12

    Added isScrollable() to check whether an element has a horizontal or vertical scroll bar

  • v1.0.0 2023-09-07

    Major Changes

    • a500a98: Added ConfigManager to manage persistent user configurations including data versioning and migration

    Patch Changes

    • 6d0a700: Event interceptor can now be toggled at runtime (#16)
    • d038b21: Global (IIFE) build now comes with a header
  • v0.5.3 2023-09-04

    code is no longer minified and now has a userscript header

  • v0.0.1.20230812204639 2023-08-12