Let search page webjumps with no arguments fall back to a home page.
commit358ec6e4553142830469c07aef1dbd931384111c
authorDavid Kettler <kettler@internode.on.net>
Sat, 29 Nov 2008 01:41:38 +0000 (29 12:11 +1030)
committerDavid Kettler <kettler@internode.on.net>
Sat, 29 Nov 2008 01:54:19 +0000 (29 12:24 +1030)
treee3a81d4a3ecd7e58b9995211c089523217a6f102
parent61b46f1d8a0c575c645d3f155743b556cbe81ad7
Let search page webjumps with no arguments fall back to a home page.

Most webjumps are used as a shorthand to a web site search page.  But
when no arguments are supplied to the webjump, the effect is either an
error from conkeror (when there are no spaces) or a search with a
blank search term.  Neither is particularly useful.

This commit alters the default webjump handler so that a webjump with
no arguments will visit a relevant page, usually the associated home
page.  In most cases this is just the base URL of the webjump.  For
instance, visiting the emacswiki webjump with no arguments will now
load the emacswiki.org front page.

Most webjumps gain this new functionality without needing
modification.  However in some cases the search url is unrelated to
the desired home page url.  In this case the webjump definition can
supply an array of two elements; the first is the search url and the
second is the home page url.  The provided clhs and xulplanet webjumps
are treated in this way.

A similar fall back facility could be provided for search engine
webjumps, but that is not done here.

The meaning of the webjump no_argument keyword is extended to support
these optional arguments.  As previously, a value of true means that
no arguments are allowed and a false value means that arguments are
required.  The extension is that any other value ("maybe" is used)
means that arguments are optional.

This commit also includes a small fix to match_webjump().  A webjump
keyword followed by spaces is now interpreted as meaning no arguments.

The function compute_url_pre_path() is also included to calculate a
base URL from a given URL.
modules/utils.js
modules/webjump.js