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
// 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);
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 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((new prefix_completer($completions = completions)).complete(input, pos));
}
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);
$completer = new chickadee_completer());
/// /Chickadee
// content_policy_bytype_table.object = oni_block_flash;