Itsnotlupus' Tiny Utilities

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

Tästä skriptistä on versioita, joissa koodia päivitettiin. Näytä kaikki versiot.

  • v1.27.1 7.9.2023
  • v1.27 7.9.2023

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

  • v1.26 7.9.2023

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

  • v1.25 4.9.2023

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

  • v1.24 2.9.2023

    fix minor brain damage in custom()

  • v1.23 27.8.2023

    added `decodeEntities()`

  • v1.22 25.8.2023

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

  • v1.21 16.8.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.8.2023

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

  • v1.19 7.8.2023

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

  • v1.18 7.8.2023
  • v1.17 7.8.2023

    use a lighter touch in fixConsole.

  • v1.16 6.8.2023

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

  • v1.15 3.8.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.7.2023
  • v1.13 31.7.2023

    unbreaking async contract in `until` and `untilDOM`

  • v1.13 31.7.2023

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

  • v1.12 31.7.2023
  • v1.11 31.7.2023

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

  • v1.10 29.7.2023

    memoization

  • v1.9.1 27.7.2023

    document is a Node.

  • v1.9 16.7.2023

    add `fixConsole()`

  • v1.8 11.7.2023

    Brownian golfing.

  • v1.7 10.7.2023

    gotta commit to the bit. ah! get it?

  • v1.6 10.7.2023

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

  • v1.5 9.7.2023

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

    None of them require a @grant.

  • v1.4 9.7.2023

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

  • v1.3 9.7.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 9.7.2023

    added requestAnimationFrame wrapper

  • v1.1 25.6.2023

    Added some DOM query shortcuts.

  • v1.0.1 11.6.2023

    Typo fix

  • v1.0 10.6.2023