jquery.pageaction is a simple jQuery library which handles hash links and interprets them as javascript actions.
Hash links usally look like this:
http://example.com/page.html#action__option1__option2
The link part after the hash mark is splitted by "__" delimiter. First
chunk is interpreted as function name and the rest is considered as function
options. For example, the link above makes the following code to be executed:
action("option1", "option2")
First, define some plain javascript functions handling pageaction events. Next, hook up pageaction to a number of DOM events. There are two variants, basically.
First variant handles hash part of the document.location. It's activated by one line of code and executed once the document has loaded:
$.pageaction();
Second variant handles links with leading "#", such as
<a href="#action__option1__option2">
, for example. To make it work you need to
define selector to apply and call pageaction
then. It can look like
$(".action_link").pageaction();
Very basic example is avaliable in the sample
directory.