github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

hiddenloop / paging_keys_js

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 147
    • 9
  • Source
  • Commits
  • Network (9)
  • Issues (0)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Page navigation (scrolling) and pagination using keyboard shortcuts with micro-formatted html (hentry), inspired by interaction on ffffound.com — Read more

  cancel

http://homebrew.hiddenloop.com/sandbox/paging_keys/examples/prototype/example.html

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

rewording example (typo) 
hiddenloop (author)
Mon Feb 08 08:52:28 -0800 2010
commit  fc14a6b29c0e06984693d58e476b593ee2f130a0
tree    7fa7c982756b76b93e09d7892ae39bfedc5dc255
parent  a5f943d7ee8feaa7f11baeeba8922976da7e9ebf
paging_keys_js /
name age
history
message
file README.textile Mon Feb 08 08:44:54 -0800 2010 fixed wording in README [hiddenloop]
directory examples/ Mon Feb 08 08:52:28 -0800 2010 rewording example (typo) [hiddenloop]
directory javascripts/ Fri Oct 30 10:30:21 -0700 2009 fix for floating nav selector on jQuery [hiddenloop]
directory stylesheets/ Mon Aug 31 02:25:20 -0700 2009 tidier CSS, added minified version (YUI compres... [hiddenloop]
directory test/ Sat Oct 17 10:53:44 -0700 2009 adding jquery version with example thanks to pe... [hiddenloop]
README.textile

Paging Keys

About

Keyboard short cuts for paging through listings one item at at time (and across entire pages). Inspired by the navigation at FFFFOUND!

The example operates on micro-formatted html ( hAtom ). The script uses either the prototype or jquery js libraries and hotkey.js for key event hooks. Take a look at this video explanation from Ryan Singer of 37 Signals

Demo

Holy explanations Batman!, there is a working demo here

Latest Changes

  • Fixed floating navigation positioning in jquery version (wrong selector doh!)
  • Added jquery support thanks to Peter O’Toole (peteot)
  • Fixed floating navigation links, (next/prev were linked the wrong way round)
  • Abstracted out library specific javascript functions (e.g. selector etc.)
  • Added some jquery unit testing, and jquery examples

Caveats

Ongoing issues with this script include;

  • needs more testing on different browsers
  • needs more testing coverage in general
  • there are some places where CSS id selectors would suit better over class selectors
  • so far manually tested on the following mac browsers;
    • Safari 3/4, FireFox 3/3.5, Opera 9+, Camino 1.6.9

Setup / Using

Requirements

What do you need?

  • prototype (>= 1.6.0.3) OR jquery (>= 1.3.2)
  • a working keyboard and browser
  • for the example – a sense of 1970’s Batman humor

Using

To use on your own website, simply;

  • markup your entry titles with the following CSS hierarchy; .hentry h2 a.entry-title (the example uses the hAtom style)
  • include the prototype OR jquery library (e.g. from ajax.googleapis.com)
  • include the appropriate paging_keys.js javascript somewhere on your page
  • add pagination html to each page as shown in the example (in Rails, if you’re using will_paginate, you’ll get this for free)
  • optionally add the paging-nav element somewhere on each page, and include the CSS for it
  • thats it!

Make your browser height small enough to engage vertical scrolling, then use j/k to move up/down through listing (and across the pagination). You can also use h/l to move between entire pages. So;

  • j next item (down)
  • k prev item (up)
  • h next page
  • l next page

Configuration

The config variable in pagingKeys can be used to customize the class to suit your own HTML/CSS selectors. See the comments alongside each attribute for more info.

Minimized

The YUI compressor has been used successfully to minimise paging_keys.js (a minimised version is NOT included in the release). All unit tests included run on a non-compressed script.

Example Configuration Explanation

Four micro-formatted ( hAtom ) example pages with pagination links (in the will_paginate style) The example uses the #bottom anchor link on the last post of each page, so paging backwards will start at the bottom and work its way up through the page. Each example page has an optional paging navigation key at the top right corner (when javascript is available). In the example the prototype OR jquery library is loaded from ajax.googleapis.com (this is a good idea).

Have a look at the example html documents and the tests for more information.

Why use the ‘HJKL’ keys?

Everyone has their own preferences/ideas on which keys work best. I chose what seems to be the accepted default right now and the comments below enforce this point somewhat.

“…because j and k are on the home row. Most keyboards have a little nubbin on the j so you can find it by touch. There is also some precedent for the pair. j/k move the cursor down/up in vi for example…”

“…Google reader / Google Mail use the same keys…”

“…Earlier computers had no need for arrow keys, so all the basic vi commands use keys you’d find on a very limited keyboard…”

“…But they’re also very nice since it’s where the right hand sits when you’re a touch typist. j and k take almost no effort to type…”

“…page up/down and cursor keys are not always available on every keyboard, or can be hard to find on laptops or shortened keyboards…”

Credits

Who’s who?

  • Authored by Matthew Hutchinson
  • Some jQuery work by Peter O’Toole
  • Inspired by FFFFOUND! keyboard naviagtion
  • Explained by Ryan Singer, 37 Signals
  • Includes hotkey.js
  • Wise words followed from 7 Rules of Unobtrusive Javascript

Get out clause

Right now this script is provided without warranty, or support from the author.

Creative Commons License

Creative Commons License

Paging Keys by Matthew Hutchinson is licensed under a Creative Commons Attribution 2.0 UK: England & Wales License.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server