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,27 +205,37 @@ 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() {
var completions = []; completer.call(this);
var content = yield send_http_request( };
load_spec({uri: "http://api.call-cc.org/cdoc/ajax/prefix?q="+
encodeURIComponent(input)})); chickadee_completer.prototype = {
if (content.responseText) { __proto__: completer.prototype,
var parser = Cc["@mozilla.org/xmlextras/domparser;1"] constructor: chickadee_completer,
.createInstance(Ci.nsIDOMParser); toString: function () "#<chickadee_completer>",
var doc = parser.parseFromString(content.responseText, "text/xml"); complete: function (input, pos) {
var res = doc.getElementsByTagName("li"); var completions = [];
for (let i = 0, n = res.length; i < n; ++i) { var content = yield send_http_request(
completions.push(res[i].textContent); 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((new prefix_completer($completions = completions)).complete(input, pos));
} }
yield co_return(prefix_completer($completions = completions) };
(input, cursor_position, conservative));
}
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;