Conkeror: Add chickadee webjump

From the conkeror wiki
This commit is contained in:
Tom Willemsen 2013-01-16 01:31:55 +01:00
parent 777530f57a
commit 2f27e1e3ac

View file

@ -112,6 +112,31 @@ define_webjump("arch/packages",
"https://www.archlinux.org/packages/?sort=&q=%s&limit=50",
$alternative="https://packages.archlinux.org");
/// Chickadee
// From http://conkeror.org/Webjumps
function chickadee_completer (input, cursor_position, conservative) {
var completions = [];
var content = yield send_http_request(
load_spec({uri: "http://api.call-cc.org/cdoc/ajax/prefix?q="+
encodeURIComponent(input)}));
if (content.responseText) {
var parser = Cc["@mozilla.org/xmlextras/domparser;1"]
.createInstance(Ci.nsIDOMParser);
var doc = parser.parseFromString(content.responseText, "text/xml");
var res = doc.getElementsByTagName("li");
for (let i = 0, n = res.length; i < n; ++i) {
completions.push(res[i].textContent);
}
}
yield co_return(prefix_completer($completions = completions)
(input, cursor_position, conservative));
}
define_webjump("chickadee",
"http://api.call-cc.org/cdoc?q=%s&query-name=Lookup",
$alternative = "http://api.call-cc.org/doc/",
$completer = chickadee_completer);
/// /Chickadee
// content_policy_bytype_table.object = oni_block_flash;
cwd = make_file("/home/slash/downloads/");
hint_digits = "arstdhneio";