1. Adding half-page scrolling to Firefox

    This is partially googlable stuff, but I thought I might as well put it down in a post, for memory’s sake if nothing else.

    I found myself swearing over how pressing the space bar in Firefox scrolls almost a page down, which is less than ideal for continuous reading as you lose almost all context. It also means that sites with overlaid “menu bars”, like Twitter or Techcrunch, swallow some rows of each page.

    The ideal solution would be to have a built-in setting in Firefox for how large part of the viewport the space bar should scroll down, with the default at today’s 95% or whatnot. This seems to be controversial for whatever reason, but there’s fortunately a work-around:

    Download the keyconfig extension and add two new keyboard shortcuts (I’ve mapped them to ^D and ^U for half-page scrolling up and down, respectively) with the following code:

    /* Down */
    window.content.scrollBy(0, window.content.innerHeight / 2);

    /* Up */
    window.content.scrollBy(0, -(window.content.innerHeight / 2));

    It’s possible to bind these directly to space and shift-space as well, but unfortunately they don’t seem to work on 100% of web sites, so I kept the standard bindings around as a backup.

    Update: ^U seems to be a popular keyboard shortcut for sites to hog, so I went back to overriding space/shift-space - there’s always PgUp/-Dn when those fail.

    Update II: Updated the a better way to do this that seems to work on most sites as well as non-HTML pages.

    (Late) Update III: The previous update was a bit unclear - it refers to the (edited) code above. Unfortunately, this whole method has gotten increasingly irrelevant since so many pages now can’t be scrolled as HTML documents, but expect to have control over the space bar to implement their own (uniquely objectionable) javascript scrolling.