- ca8b62e: Made CJS bundle available on NPM too
- 99abaab: Made CJS bundle available on JSR
- 390110e: Throw an error when calling
interceptEvent()
onwindow
orunsafeWindow
on FireMonkey instead of crashing the entire page
- 1ecd63c: Added support for the
signal
property infetchAdvanced()
- 3fe8b25: Added overload to
mapRange()
that only needs bothmax
values and assumes 0 for bothmin
values - d7e8a31: Added utility type
Prettify
to make complex types more readable - 8ec2010: Added
randomCase
parameter to the functionrandomId()
(true by default) - d9a36d5: Added property
migrateIds
to the constructor ofDataStore
for easier ID migration - b2f757e: Added
enhancedEntropy
parameter to the functionrandRange()
(false by default)
- 6296529: Added new DataStoreSerializer methods
loadStoresData()
,resetStoresData()
anddeleteStoresData()
for parallelized bulk operations on DataStore instances - b0bce9c: Added DataStore method
migrateId()
to be able to migrate to a new ID
- a8bca8f: Added
exports.types
in addition to justtypes
in package.json
- a92000b: Added
exports
to package.json and correctedmodule
property
- 54ee0ce: Changed
hexToRgb()
andrgbToHex()
to support#RGBA
and#RRGGBBAA
color codes (with an alpha channel). Both functions now have analpha
value immediately afterblue
, which can be set toundefined
to restore the old behavior.
- 54ee0ce: Added parameter
upperCase
(false by default) tolightenColor()
anddarkenColor()
- 54ee0ce: Consolidated behavior of
lightenColor()
anddarkenColor()
when using non-number values
- 7e8e147: - Added
tr.forLang()
to get the translation for a specified language code- Added
tr.getTranslations()
to return the translations object for the given or currently active language
- Added
- a171b0d: Fix color functions not being exported 🥴
- e00d4d9: Fixed dev-only TypeScript shims being included in the final bundle
- 3b8aa88: Added color manipulation functions
hexToRgb()
,rgbToHex()
,lightenColor()
anddarkenColor()
- 7303aa2: Added
setInnerHtmlUnsafe()
for setting innerHTML unsanitized using a Trusted Types policy
- 7303aa2: Made
addGlobalStyle()
use the newsetInnerHtmlUnsafe()
to fix the error "This document requires 'TrustedHTML' assignment" on Chromium-based browsers
- 7335c59: Added Dialog class for easily creating customizable modal dialogs
- ca50132: Added NanoEmitter class for lightweight event emitter functionality in both OOP and FP
- d8f6852: Fix package.json exports
- fadebf0: Removed the function
insertAfter()
because the DOM API already has the methodinsertAdjacentElement()
that has the same functionality and even four positions to pick from. To get the same behavior asinsertAfter(refElem, newElem)
, you can userefElem.insertAdjacentElement("afterend", newElem)
- ca6ff58: Added option
checkInterval
to SelectorObserver to check on interval instead of on mutation - 1e2015c: Added
DataStoreSerializer
class for centralized and much easier and safer de-/serialization of any number of DataStore instances - 5190f0b: SelectorObserver's
addListener()
now returns an unsubscribe function to more easily remove a listener - e1d467c: Added function
computeHash()
to calculate the hash / checksum of a string - 948ac89: DataStore: made
runMigrations
,encodeData
anddecodeData
public and addedencodingEnabled
method - d7cdac0: Made
randomId()
default to using Math.random() and added the parameterenhancedEntropy
to revert back to the much slower but also much more entropic implementation - 287b006: Added ability to change DataStore storage engine from default "GM" to "localStorage" and "sessionStorage"
- fa09004: Made
openInNewTab()
useGM.openInTab
by default and fall back to the old behavior. Also addedbackground
param to specify if the tab should get focus when opened.
- 0173235: Add property to change the debounce edge in
SelectorObserver
instances
- a11ed77: Added parameter to switch
debounce()
to trigger on the rising edge, instead of just the falling edge (see docs)
- 08248c1: Fixed terminology in JSDoc comments of the
DataStore
class
- e921593: Renamed
ConfigManager
toDataStore
to make its implied purpose as a generic JSON database more clear.- the constructor property
defaultConfig
is now calleddefaultData
deleteConfig()
is now calleddeleteData()
- the internal GM storage keys will still have the prefix
_uucfg
for backwards compatibility
- the constructor property
- da679c6: Added function
getSiblingsFrame()
that returns a frame of an element's siblings, with a given alignment and size
- 0c716a6: Lowered the
Error.stackTraceLimit
by a multiple of 10 to preserve memory
- 2b885c3:
ConfigManager.loadData()
now returns a copy of the data
- c980ff3:
compress()
now uses the same value "string" (unlike previously "base64") for the outputType parameter likedecompress()
- ca1b596: Added
encodeData()
anddecodeData()
to the ConfigManager options to allow for easy data compression
- 0462e35: Fixed TS types for overload of SelectorObserver constructor
- 47639f0: Added SelectorObserver options
disableOnNoListeners
andenableOnAddListener
- 4a58caa:
addGlobalStyle
now returns the created style element - 5038967:
fetchAdvanced
is now a drop-in replacement and timeout can now optionally be disabled
- 17a6ad5:
randomizeArray
now returns a copy if an empty array is passed as well
- 885323d: Added function
observeElementProp
to allow observing element property changes
- dae5450: Removed
amplifyMedia
function due to massive inconsistencies in sound quality
- 168c2aa: Added functions
compress
anddecompress
to compress and decompress strings using gzip or deflate - 49bc85e: Added utility types
NonEmptyString
andLooseUnion
- 2ae665d: fixed wrong TS type for SelectorObserver options in constructor
-
1859022:
onSelector()
has been turned into theSelectorObserver
class to reduce the performance impact on larger sites:- its instances can be scoped to any element lower in the DOM tree, unlike before where it was always observing the entire body with all its children
- separate instances can be disabled and reenabled individually on demand
- separate instances can have different MutationObserver options set to further reduce performance impact
- the separation into instances allows for a new "chaining" paradigm where selector listeners are only added and checked for once they are actually needed (see examples in the documentation)
- when using chaining, separate instances can be created and have listeners added to them before their base element is available in the DOM tree
- every listener can have a set debounce time, so that it doesn't get called too often (works the same as the
debounce()
function, but is disabled by default) - there are now multiple methods to get and delete specific listeners
The
SelectorObserver.addListener()
method is backwards compatible with the oldonSelector()
function, so you can just add the class instance in front (for full backwards compat usedocument.body
for thebaseElement
parameter of the constructor), then change the old function's name and it should work as before. For more info and examples, please view the SelectorObserver documentation
-
0db73b5: Removed the limiter (DynamicsCompressorNode) from
amplifyMedia()
for clear and undistorted audio.Notable changes:
- The property
source
has been renamed tosourceNode
to fit the naming of thegainNode
property - A boolean property
enabled
has been added to check if the amplification is enabled or not - The parameter
initialMultiplier
has been renamed toinitialGain
to reduce confusion (it is not a multiplier strictly speaking)
- The property
-
736784f: Added function
randomId()
to randomly generate cryptographically strong hexadecimal IDs -
563e515: Added utility type
NonEmptyArray
for typing an array with at least 1 item
- a123da6: Added
@linkcode
references to the JSDoc in-IDE documentation
- 63af1a7: Change default limiter options to be more balanced
- b53a946: Added compression to
amplifyMedia()
to prevent audio clipping and distortion and modified return type accordingly:- Renamed:
amplify()
tosetGain()
andgetAmpLevel()
togetGain()
- Added properties:
enable()
,disable()
,setLimiterOptions()
andlimiterNode
- Other changes: Amplification is no longer enabled automatically,
enable()
must now be called manually after initializing
- Renamed:
- 84b37f1: Added utility type Stringifiable to describe a string or any value that can be converted to one
- 142c5e2: Added function insertValues() to insert values into a string with placeholders
- 16ce257: Added lightweight translation system
- ad17374: Add support for OpenUserJS
- 049aeb0: Export ConfigMigrationsDict for easier use with TypeScript
- 4799a9f: Fix TS error in ConfigManager migration functions
- db5cded: Added
isScrollable()
to check whether an element has a horizontal or vertical scroll bar
- 9e26464: Replaced most occurrences of
HTMLElement
in the docs withElement
for better compatibility
- a500a98: Added ConfigManager to manage persistent user configurations including data versioning and migration
- 6d0a700: Event interceptor can now be toggled at runtime (#16)
- d038b21: Global (IIFE) build now comes with a header
- f97dae6: change bundling process
- 18d4a10: make npm bundle smaller
- aa8efbd: fix documentation
-
54e7905: Features:
- add function
amplifyMedia()
to boost the volume of a MediaElement past its default maximum - allow all
MutationObserver.observe()
options to be passed toinitOnSelector()
Fixes:
- fix
onSelector()
not triggering correctly
- add function
- 85ec87b: fix missing export for array functions
- 231a79c: Refactored code and documentation and added new functions:
mapRange()
to map a number from one range to the same spot in another rangerandRange()
to generate a random number between a min and max boundaryrandomItem()
to return a random item from an arrayrandomItemIndex()
to return a tuple of a random item and its index from an arraytakeRandomItem()
to return a random item from an array and mutate it to remove the itemrandomizeArray()
to return a copy of the array with its items in a random order
- 7edf837: decrease npm bundle size
- 07ec443: add
getSelectorMap()
to return all currently registered selectors
- 0cf2254: add
onSelector()
to call a listener once a selector is found in the DOM
- bb60db0: minor fixes
- 9206f6e: Initial release - Features:
onSelector()
to call a listener once a selector is found in the DOMautoPlural()
to automatically pluralize a stringclamp()
to clamp a number between a min and max valuepauseFor()
to pause the execution of a function for a given amount of timedebounce()
to call a function only once, after a given amount of timegetUnsafeWindow()
to get the unsafeWindow object or fall back to the regular window objectinsertAfter()
to insert an element as a sibling after another elementaddParent()
to add a parent element around another elementaddGlobalStyle()
to add a global style to the pagepreloadImages()
to preload images into the browser cache for faster loading later onfetchAdvanced()
as a wrapper around the fetch API with a timeout optionopenInNewTab()
to open a link in a new tabinterceptEvent()
to conditionally intercept events registered byaddEventListener()
on any given EventTarget objectinterceptWindowEvent()
to conditionally intercept events registered byaddEventListener()
on the window object