The source for all your LEGO Castle needs!

Navigate Brickshelf with Keyboard Shortcuts (Chrome Script)

Discussion of general LEGO topics

Navigate Brickshelf with Keyboard Shortcuts (Chrome Script)

Postby mitah » Fri Aug 10, 2012 7:52 pm

Hello there!

I guess I'm not the only one who is spoiled by Flickr's intuitive navigation for the Photostream. Press LEFT and RIGHT arrows to navigate the Photostream, press L to view a photo in the lightbox.

After, again, clicking endlessly through Brickshelf folders I've had enough and made a small script that allows me to navigate folders using the same keyboard shortcuts as Flickr.

It is a simple user script that can be installed in Google's Chrome Browser using the Tampermonkey Extension and I guess it would also work in Firefox using Greasemonkey. (I've heard there is also some Plugin for Internet Explorer, but who cares ;-))

Installation is as simple as creating a new script in Tampermonkey pasting the code below into the field and save it... it should automatically load the next time you visit Brickshelf and enable the shortcuts

shortcuts are:
* ARROW LEFT and ARROW RIGHT calls the "Previous" and "Next" links above and below the images
* l (lower case L) zooms the image to full size
* ESC acts like the history back button when viewing the zoomed image OR acts like clicking the "Up" link above the images if there is one

I don't have an EB forum account, so if anyone thinks this would be useful feel free to post it over there too.

Code: Select all
// ==UserScript==
// @name       Brickshelf Keyboard Navigator
// @namespace
// @version    0.1
// @description  navigate brickshelf with cursor keys
// @match*
// @copyright  public domain
// @require
// ==/UserScript==

// list of all key codes:

$(document).ready(function() {
    var prev = $("b:contains('Previous')").parents("a");
    var next = $("b:contains('Next')").parents("a");
    var up =   $("a:contains('Up')");
    var zoom = $("a:contains('click here for full size')");
        switch(e.which) {
            case 37: // arrow left
                    window.location = prev[0].href;
            case 27: // Escape key
                    window.location = up[0].href;
                } else {
            case 39: // (arrow right)
                    window.location = next[0].href;
            case 76: // l (lower case L)
                    window.location = zoom[0].href;

PM me or post here if you have any questions, comments or suggestions.
Image “Accept His Noodly Magnificence into your heart, into your soul, and ye shall forever be free. R'Amen.” – Ragu
User avatar
Posts: 197
Joined: Tue Jan 04, 2011 11:46 am
Location: Karemdhâron/Lenfald/Roawia

Return to General LEGO

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 2 guests