Itsnotlupus' Tiny Utilities

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

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

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

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

  • v1.26 2023-09-07

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

  • v1.25 2023-09-04

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

  • v1.24 2023-09-02

    fix minor brain damage in custom()

  • v1.23 2023-08-27

    added `decodeEntities()`

  • v1.22 2023-08-25

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

  • v1.21 2023-08-16

    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 2023-08-14

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

  • v1.19 2023-08-07

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

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

    use a lighter touch in fixConsole.

  • v1.16 2023-08-06

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

  • v1.15 2023-08-03

    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 2023-07-31
  • v1.13 2023-07-31

    unbreaking async contract in `until` and `untilDOM`

  • v1.13 2023-07-31

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

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

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

  • v1.10 2023-07-29

    memoization

  • v1.9.1 2023-07-27

    document is a Node.

  • v1.9 2023-07-16

    add `fixConsole()`

  • v1.8 2023-07-11

    Brownian golfing.

  • v1.7 2023-07-10

    gotta commit to the bit. ah! get it?

  • v1.6 2023-07-10

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

  • v1.5 2023-07-09

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

    None of them require a @grant.

  • v1.4 2023-07-09

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

  • v1.3 2023-07-09
    • 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 2023-07-09

    added requestAnimationFrame wrapper

  • v1.1 2023-06-25

    Added some DOM query shortcuts.

  • v1.0.1 2023-06-11

    Typo fix

  • v1.0 2023-06-10