Update chickadee webjump

This commit is contained in:
Tom Willemse 2015-09-13 23:28:26 +02:00
parent efe56412a6
commit 1d766b5fb0

View file

@ -205,7 +205,15 @@ define_opensearch_webjump("wordpress", "wordpress.xml");
/// Chickadee /// Chickadee
// From http://conkeror.org/Webjumps // From http://conkeror.org/Webjumps
function chickadee_completer (input, cursor_position, conservative) { var chickadee_completer = function() {
completer.call(this);
};
chickadee_completer.prototype = {
__proto__: completer.prototype,
constructor: chickadee_completer,
toString: function () "#<chickadee_completer>",
complete: function (input, pos) {
var completions = []; var completions = [];
var content = yield send_http_request( var content = yield send_http_request(
load_spec({uri: "http://api.call-cc.org/cdoc/ajax/prefix?q="+ load_spec({uri: "http://api.call-cc.org/cdoc/ajax/prefix?q="+
@ -214,18 +222,20 @@ function chickadee_completer (input, cursor_position, conservative) {
var parser = Cc["@mozilla.org/xmlextras/domparser;1"] var parser = Cc["@mozilla.org/xmlextras/domparser;1"]
.createInstance(Ci.nsIDOMParser); .createInstance(Ci.nsIDOMParser);
var doc = parser.parseFromString(content.responseText, "text/xml"); var doc = parser.parseFromString(content.responseText, "text/xml");
var res = doc.getElementsByTagName("li"); var res = doc.getElementsByTagName("li")
for (let i = 0, n = res.length; i < n; ++i) { for (let i = 0, n = res.length; i < n; ++i) {
completions.push(res[i].textContent); completions.push(res[i].textContent);
} }
} }
yield co_return(prefix_completer($completions = completions)
(input, cursor_position, conservative)); yield co_return((new prefix_completer($completions = completions)).complete(input, pos));
} }
};
define_webjump("chickadee", define_webjump("chickadee",
"http://api.call-cc.org/cdoc?q=%s&query-name=Lookup", "http://api.call-cc.org/cdoc?q=%s&query-name=Lookup",
$alternative = "http://api.call-cc.org/doc/", $alternative = "http://api.call-cc.org/doc/",
$completer = chickadee_completer); $completer = new chickadee_completer());
/// /Chickadee /// /Chickadee
// content_policy_bytype_table.object = oni_block_flash; // content_policy_bytype_table.object = oni_block_flash;