mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 15:57:57 +01:00
Death to E4X and stuff.
This commit is contained in:
@@ -37,7 +37,7 @@ var Bookmarks = Module("bookmarks", {
|
||||
anchored: false,
|
||||
title: ["URL", "Info"],
|
||||
keys: { text: "url", description: "title", icon: "icon", extra: "extra", tags: "tags", isURI: function () true },
|
||||
process: [template.icon, template.bookmarkDescription]
|
||||
process: [template_.icon, template_.bookmarkDescription]
|
||||
}),
|
||||
|
||||
// TODO: why is this a filter? --djk
|
||||
|
||||
@@ -316,7 +316,7 @@ var History = Module("history", {
|
||||
.concat(jumps)
|
||||
.concat(sh.slice(sh.index + 1));
|
||||
|
||||
commandline.commandOutput(template.jumps(index, list));
|
||||
commandline.commandOutput(template_.jumps(index, list));
|
||||
},
|
||||
{ argCount: "0" });
|
||||
|
||||
|
||||
@@ -1039,11 +1039,12 @@ var Tabs = Module("tabs", {
|
||||
group[1].push([i, tab.linkedBrowser]);
|
||||
});
|
||||
|
||||
context.pushProcessor(0, function (item, text, next) <>
|
||||
<span highlight="Indicator" style="display: inline-block;">{item.indicator}</span>
|
||||
{ next.call(this, item, text) }
|
||||
</>);
|
||||
context.process[1] = function (item, text) template.bookmarkDescription(item, template.highlightFilter(text, this.filter));
|
||||
context.pushProcessor(0, function (item, text, next) [
|
||||
["span", { highlight: "Indicator", style: "display: inline-block;" },
|
||||
item.indicator],
|
||||
next.call(this, item, text)
|
||||
]);
|
||||
context.process[1] = function (item, text) template_.bookmarkDescription(item, template_.highlightFilter(text, this.filter));
|
||||
|
||||
context.anchored = false;
|
||||
context.keys = {
|
||||
|
||||
@@ -2429,7 +2429,7 @@ Buffer.addPageInfoSection("f", "Feeds", function (verbose) {
|
||||
nFeed++;
|
||||
let type = feedTypes[feed.type] || "RSS";
|
||||
if (verbose)
|
||||
yield [feed.title, [template.highlightURL(feed.href, true),
|
||||
yield [feed.title, [template_.highlightURL(feed.href, true),
|
||||
["span", { class: "extra-info" }, " (" + type + ")"]]];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ defineModule("commands", {
|
||||
|
||||
lazyRequire("help", ["help"]);
|
||||
lazyRequire("options", ["Option"]);
|
||||
lazyRequire("template", ["template"]);
|
||||
lazyRequire("template", ["template", "template_"]);
|
||||
|
||||
/**
|
||||
* A structure representing the options available for a command.
|
||||
@@ -1712,7 +1712,7 @@ var Commands = Module("commands", {
|
||||
this.iterate(args).filter(function (cmd) cmd.hive === commands.builtin || Set.has(tags, cmd.helpTag)),
|
||||
format: {
|
||||
headings: ["Command", "Group", "Description"],
|
||||
description: function (cmd) template.linkifyHelp(cmd.description + (cmd.replacementText ? ": " + cmd.action : "")),
|
||||
description: function (cmd) template_.linkifyHelp(cmd.description + (cmd.replacementText ? ": " + cmd.action : "")),
|
||||
help: function (cmd) ":" + cmd.name
|
||||
}
|
||||
});
|
||||
|
||||
@@ -321,7 +321,7 @@ var CompletionContext = Class("CompletionContext", {
|
||||
util.trapErrors("onUpdate", this);
|
||||
},
|
||||
|
||||
get createRow() this._createRow || template.completionRow, // XXX
|
||||
get createRow() this._createRow || template_.completionRow, // XXX
|
||||
set createRow(createRow) this._createRow = createRow,
|
||||
|
||||
get filterFunc() this._filterFunc || util.identity,
|
||||
@@ -494,7 +494,7 @@ var CompletionContext = Class("CompletionContext", {
|
||||
this.processor = Array.slice(this.process);
|
||||
if (!this.anchored)
|
||||
this.processor[0] = function (item, text) self.process[0].call(self, item,
|
||||
template.highlightFilter(item.text, self.filter, null, item.isURI));
|
||||
template_.highlightFilter(item.text, self.filter, null, item.isURI));
|
||||
|
||||
try {
|
||||
// Item prototypes
|
||||
@@ -823,7 +823,7 @@ var CompletionContext = Class("CompletionContext", {
|
||||
throw Error();
|
||||
|
||||
this.offset = 0;
|
||||
this.process = [template.icon, function (item, k) k];
|
||||
this.process = [template_.icon, function (item, k) k];
|
||||
this.filters = [CompletionContext.Filter.text];
|
||||
this.tabPressed = false;
|
||||
this.title = ["Completions"];
|
||||
@@ -937,7 +937,7 @@ var Completion = Module("completion", {
|
||||
modules.commandline.commandOutput(
|
||||
["div", { highlight: "Completions" },
|
||||
template_.map(contexts, function (context)
|
||||
[template.completionRow(context.title, "CompTitle"),
|
||||
[template_.completionRow(context.title, "CompTitle"),
|
||||
template_.map(context.items, function (item) context.createRow(item), null, 100)])]);
|
||||
},
|
||||
}),
|
||||
@@ -1089,7 +1089,7 @@ var Completion = Module("completion", {
|
||||
contains(item.title, tok)));
|
||||
|
||||
let re = RegExp(tokens.filter(util.identity).map(util.regexp.escape).join("|"), "g");
|
||||
function highlight(item, text, i) process[i].call(this, item, template.highlightRegexp(text, re));
|
||||
function highlight(item, text, i) process[i].call(this, item, template_.highlightRegexp(text, re));
|
||||
let process = context.process;
|
||||
context.process = [
|
||||
function (item, text) highlight.call(this, item, item.text, 0),
|
||||
@@ -1120,9 +1120,9 @@ var Completion = Module("completion", {
|
||||
function (args) {
|
||||
modules.commandline.commandOutput(
|
||||
["div", { highlight: "Completions" },
|
||||
template.completionRow(["Context", "Title"], "CompTitle"),
|
||||
template_.completionRow(["Context", "Title"], "CompTitle"),
|
||||
template_.map(completion.contextList || [],
|
||||
function (item) template.completionRow(item, "CompItem"))]);
|
||||
function (item) template_.completionRow(item, "CompItem"))]);
|
||||
},
|
||||
{
|
||||
argCount: "*",
|
||||
|
||||
@@ -353,7 +353,7 @@ var JavaScript = Module("javascript", {
|
||||
|
||||
if (!compl) {
|
||||
base.process[1] = function highlight(item, v)
|
||||
template.highlight(typeof v == "xml" ? new String(v.toXMLString()) : v, true, 200);
|
||||
template_.highlight(typeof v == "xml" ? new String(v.toXMLString()) : v, true, 200);
|
||||
|
||||
// Sort in a logical fashion for object keys:
|
||||
// Numbers are sorted as numbers, rather than strings, and appear first.
|
||||
|
||||
@@ -572,6 +572,47 @@ var Template_ = Module("Template_", {
|
||||
},
|
||||
|
||||
|
||||
bookmarkDescription: function (item, text) [
|
||||
!(item.extra && item.extra.length) ? [] :
|
||||
["span", { highlight: "URLExtra" },
|
||||
" (",
|
||||
this.map(item.extra, function (e)
|
||||
["", e[0], ": ",
|
||||
["span", { highlight: e[2] }, e[1]]],
|
||||
"\u00a0"),
|
||||
")\u00a0"],
|
||||
["a", { identifier: item.id == null ? "" : item.id,
|
||||
"dactyl:command": item.command || "",
|
||||
href: item.item.url, highlight: "URL" },
|
||||
text || ""]
|
||||
],
|
||||
|
||||
filter: function (str) ["span", { highlight: "Filter" }, str],
|
||||
|
||||
completionRow: function completionRow(item, highlightGroup) {
|
||||
if (typeof icon == "function")
|
||||
icon = icon();
|
||||
|
||||
if (highlightGroup) {
|
||||
var text = item[0] || "";
|
||||
var desc = item[1] || "";
|
||||
}
|
||||
else {
|
||||
var text = this.processor[0].call(this, item, item.result);
|
||||
var desc = this.processor[1].call(this, item, item.description);
|
||||
}
|
||||
|
||||
return ["div", { highlight: highlightGroup || "CompItem", style: "white-space: nowrap" },
|
||||
/* The non-breaking spaces prevent empty elements
|
||||
* from pushing the baseline down and enlarging
|
||||
* the row.
|
||||
*/
|
||||
["li", { highlight: "CompResult " + item.highlight },
|
||||
text, "\u00a0"],
|
||||
["li", { highlight: "CompDesc" },
|
||||
desc, "\u00a0"]];
|
||||
},
|
||||
|
||||
helpLink: function (token, text, type) {
|
||||
if (!help.initialized)
|
||||
util.dactyl.initHelp();
|
||||
|
||||
Reference in New Issue
Block a user