From 5edb52e9e58fe3ea9062fda420f68aaecc9c37ef Mon Sep 17 00:00:00 2001 From: John Foerch Date: Sun, 2 Dec 2012 09:51:12 -0500 Subject: [PATCH] webjump.js: ordering, remove deprecated aliases add_delicious_webjumps: removed; use define_delicious_webjumps instead add_lastfm_webjumps: removed; use define_lastfm_webjumps instead --- modules/webjump.js | 104 ++++++++++++++++++++++++++--------------------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/modules/webjump.js b/modules/webjump.js index 570326b..003266c 100644 --- a/modules/webjump.js +++ b/modules/webjump.js @@ -94,60 +94,10 @@ function define_webjump (key, handler) { alternative: alternative}; } -function define_delicious_webjumps (username) { - define_webjump("delicious", "http://www.delicious.com/" + username + "/%s", - $alternative = "http://www.delicious.com/" + username); - define_webjump("adelicious", "javascript:location.href='http://www.delicious.com/save"+ - "?v=2&url='+encodeURIComponent(location.href)+'&title='+"+ - "encodeURIComponent(document.title);"); - define_webjump("sdelicious", "http://www.delicious.com/search?p=%s&u="+username+ - "&chk=&context=userposts&fr=del_icio_us&lc=1"); - define_webjump("sadelicious", "http://www.delicious.com/search/all?search=%s"); -} - -add_delicious_webjumps = define_delicious_webjumps; - -function define_lastfm_webjumps (username) { - if (! username) username = ""; - define_webjump("lastfm", "http://www.last.fm/user/"+username); - define_webjump("lastfm-user", "http://www.last.fm/user/%s"); - define_webjump("lastfm-music", "http://www.last.fm/search?m=all&q=%s"); - define_webjump("lastfm-group", "http://www.last.fm/users/groups?s_bio=%s"); - define_webjump("lastfm-tag", "http://www.last.fm/search?m=tag&q=%s"); - define_webjump("lastfm-label", "http://www.last.fm/search?m=label&q=%s"); - define_webjump("lastfm-event", "http://www.last.fm/events?by=artists&q=%s"); -} - -add_lastfm_webjumps = define_lastfm_webjumps; - function clear_webjumps () { webjumps = {}; } -// Some built in web jumps -function define_default_webjumps () { - define_webjump("conkerorwiki", - "http://conkeror.org/?action=fullsearch&context=60&value=%s&fullsearch=Text"); - define_webjump("lucky", "http://www.google.com/search?q=%s&btnI=I'm Feeling Lucky"); - define_webjump("maps", "http://maps.google.com/?q=%s"); - define_webjump("scholar", "http://scholar.google.com/scholar?q=%s"); - define_webjump("slang", "http://www.urbandictionary.com/define.php?term=%s"); - define_webjump("dictionary", "http://dictionary.reference.com/search?q=%s"); - define_webjump("image", "http://images.google.com/images?q=%s"); - define_webjump("clhs", - "http://www.xach.com/clhs?q=%s", - $alternative = "http://www.lispworks.com/documentation/HyperSpec/Front/index.htm"); - define_webjump("cliki", "http://www.cliki.net/admin/search?words=%s"); - define_webjump("ratpoisonwiki", "http://ratpoison.antidesktop.net/?search=%s"); - define_webjump("stumpwmwiki", "http://stumpwm.antidesktop.net/wiki?search=%s"); - define_webjump("savannah", - "http://savannah.gnu.org/search/?words=%s&type_of_search=soft&Search=Search&exact=1"); - define_webjump("sourceforge", "http://sourceforge.net/search/?words=%s"); - define_webjump("freshmeat", "http://freshmeat.net/search/?q=%s"); - define_webjump("slashdot", "http://slashdot.org/search.pl?query=%s"); - define_webjump("kuro5hin", "http://www.kuro5hin.org/?op=search&string=%s"); -} - define_variable("webjump_partial_match", true, "When entering a url, if the input is not a webjump, " + "but would uniquely complete to a webjump, then accept " + @@ -210,8 +160,6 @@ function get_url_or_webjump (input) { return input; } -define_default_webjumps(); - function webjump_completer () { let base_completer = prefix_completer( $completions = [ v for ([k,v] in Iterator(webjumps)) ], @@ -236,4 +184,56 @@ function webjump_completer () { }; } + +/* + * Built-in webjumps + */ + +function define_delicious_webjumps (username) { + define_webjump("delicious", "http://www.delicious.com/" + username + "/%s", + $alternative = "http://www.delicious.com/" + username); + define_webjump("adelicious", "javascript:location.href='http://www.delicious.com/save"+ + "?v=2&url='+encodeURIComponent(location.href)+'&title='+"+ + "encodeURIComponent(document.title);"); + define_webjump("sdelicious", "http://www.delicious.com/search?p=%s&u="+username+ + "&chk=&context=userposts&fr=del_icio_us&lc=1"); + define_webjump("sadelicious", "http://www.delicious.com/search/all?search=%s"); +} + +function define_lastfm_webjumps (username) { + if (! username) username = ""; + define_webjump("lastfm", "http://www.last.fm/user/"+username); + define_webjump("lastfm-user", "http://www.last.fm/user/%s"); + define_webjump("lastfm-music", "http://www.last.fm/search?m=all&q=%s"); + define_webjump("lastfm-group", "http://www.last.fm/users/groups?s_bio=%s"); + define_webjump("lastfm-tag", "http://www.last.fm/search?m=tag&q=%s"); + define_webjump("lastfm-label", "http://www.last.fm/search?m=label&q=%s"); + define_webjump("lastfm-event", "http://www.last.fm/events?by=artists&q=%s"); +} + +function define_default_webjumps () { + define_webjump("conkerorwiki", + "http://conkeror.org/?action=fullsearch&context=60&value=%s&fullsearch=Text"); + define_webjump("lucky", "http://www.google.com/search?q=%s&btnI=I'm Feeling Lucky"); + define_webjump("maps", "http://maps.google.com/?q=%s"); + define_webjump("scholar", "http://scholar.google.com/scholar?q=%s"); + define_webjump("slang", "http://www.urbandictionary.com/define.php?term=%s"); + define_webjump("dictionary", "http://dictionary.reference.com/search?q=%s"); + define_webjump("image", "http://images.google.com/images?q=%s"); + define_webjump("clhs", + "http://www.xach.com/clhs?q=%s", + $alternative = "http://www.lispworks.com/documentation/HyperSpec/Front/index.htm"); + define_webjump("cliki", "http://www.cliki.net/admin/search?words=%s"); + define_webjump("ratpoisonwiki", "http://ratpoison.antidesktop.net/?search=%s"); + define_webjump("stumpwmwiki", "http://stumpwm.antidesktop.net/wiki?search=%s"); + define_webjump("savannah", + "http://savannah.gnu.org/search/?words=%s&type_of_search=soft&Search=Search&exact=1"); + define_webjump("sourceforge", "http://sourceforge.net/search/?words=%s"); + define_webjump("freshmeat", "http://freshmeat.net/search/?q=%s"); + define_webjump("slashdot", "http://slashdot.org/search.pl?query=%s"); + define_webjump("kuro5hin", "http://www.kuro5hin.org/?op=search&string=%s"); +} + +define_default_webjumps(); + provide("webjump"); -- 2.11.4.GIT