Itsnotlupus' Tiny Utilities

small utilities that I'm tired of digging from old scripts to put in new ones.

Seznam verzí skriptu, při kterých došlo ke změnám v kódu. Zobrazit všechny verze.

  • v1.27.1 07. 09. 2023
  • v1.27 07. 09. 2023

    renamed `visit()` to `traverse()`, because it seems slightly more self-explanatory.

  • v1.26 07. 09. 2023

    added `visit()` to recurse through a json-ish object structure.

  • v1.25 04. 09. 2023

    Added `makeDraggable` to scaffold boring event plumbing. Don't like the name. whatever.

  • v1.24 02. 09. 2023

    fix minor brain damage in custom()

  • v1.23 27. 08. 2023

    added `decodeEntities()`

  • v1.22 25. 08. 2023

    log() is now log()/warn()/error(). yay.

  • v1.21 16. 08. 2023

    Great. Another helpful polyfill (dom-shims) breaks basic browser behavior by refusing to run `element.append()` without arguments.
    Thanks helpful polyfill for old browsers that's something running in latest chrome.

  • v1.20 14. 08. 2023

    keep `addStyles()` working even when we run super-early and document.head is still null.

  • v1.19 07. 08. 2023

    added a `logGroup` function, works along `withLog()` and `log()`, but unlike log(), it collapses its args past the msg.

  • v1.18 07. 08. 2023
  • v1.17 07. 08. 2023

    use a lighter touch in fixConsole.

  • v1.16 06. 08. 2023

    `fixConsole()` returns a method to undo its changes (and therefore, "unfix" the console object.)

  • v1.15 03. 08. 2023

    memoize tweaks:
    - slightly more expansive mkKey() default,
    - changed semantics to no longer memoize null or undefined values.
    (I probably have a reason for this, and the nullish coalescing golfing is entirely coincidental. erm.)

  • v1.14 31. 07. 2023
  • v1.13 31. 07. 2023

    unbreaking async contract in `until` and `untilDOM`

  • v1.13 31. 07. 2023

    until and untilDOM return without waiting if the condition passed is already truthy/the CSS selector is found.

  • v1.12 31. 07. 2023
  • v1.11 31. 07. 2023

    add an EZ-cleanup return function to events().

  • v1.10 29. 07. 2023

    memoization

  • v1.9.1 27. 07. 2023

    document is a Node.

  • v1.9 16. 07. 2023

    add `fixConsole()`

  • v1.8 11. 07. 2023

    Brownian golfing.

  • v1.7 10. 07. 2023

    gotta commit to the bit. ah! get it?

  • v1.6 10. 07. 2023

    renamed getHTML/getJSON to fetchHTML/fetchJSON. more pointless golfing.

  • v1.5 09. 07. 2023

    Some basic network stuff: xhr, getHTML, getJSON, and prefetch methods

    None of them require a @grant.

  • v1.4 09. 07. 2023

    many user scripts add styles, so here's `addStyles()`. cool.

  • v1.3 09. 07. 2023
    • added events() utility to define multiple listeners in one shot.

    Example usage:

    let [ delta, drag ] = [0,0];
    events({
      mousedown() { [ delta, drag ] = [0,1] },
      mousemove(e) { if (drag) scrollBy(0, delta=-e.movementY) },
      mouseup() { drag=0; rAF((_,n) => Math.abs(delta*=0.95)>1 && n(scrollBy(0, delta))) }
    });
    
  • v1.2 09. 07. 2023

    added requestAnimationFrame wrapper

  • v1.1 25. 06. 2023

    Added some DOM query shortcuts.

  • v1.0.1 11. 06. 2023

    Typo fix

  • v1.0 10. 06. 2023