1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-24 16:23:31 +01:00

Death to E4X and stuff.

This commit is contained in:
Kris Maglione
2012-11-28 18:59:11 -08:00
parent db38e43e96
commit 23b6c07666

View File

@@ -10,7 +10,7 @@ defineModule("styles", {
}); });
lazyRequire("contexts", ["Contexts"]); lazyRequire("contexts", ["Contexts"]);
lazyRequire("template", ["template"]); lazyRequire("template", ["template", "template_"]);
function cssUri(css) "chrome-data:text/css," + encodeURI(css); function cssUri(css) "chrome-data:text/css," + encodeURI(css);
var namespace = "@namespace html " + XHTML.uri.quote() + ";\n" + var namespace = "@namespace html " + XHTML.uri.quote() + ";\n" +
@@ -316,38 +316,34 @@ var Styles = Module("Styles", {
let uris = util.visibleURIs(content); let uris = util.visibleURIs(content);
let list = <table> let list = ["table", {},
<tr highlight="Title"> ["tr", { highlight: "Title" },
<td/> ["td"],
<td/> ["td"],
<td style="padding-right: 1em;">{_("title.Name")}</td> ["td", { style: "padding-right: 1em;" }, _("title.Name")],
<td style="padding-right: 1em;">{_("title.Filter")}</td> ["td", { style: "padding-right: 1em;" }, _("title.Filter")],
<td style="padding-right: 1em;">{_("title.CSS")}</td> ["td", { style: "padding-right: 1em;" }, _("title.CSS")]],
</tr> ["col", { style: "min-width: 4em; padding-right: 1em;" }],
<col style="min-width: 4em; padding-right: 1em;"/> ["col", { style: "min-width: 1em; text-align: center; color: red; font-weight: bold;" }],
<col style="min-width: 1em; text-align: center; color: red; font-weight: bold;"/> ["col", { style: "padding: 0 1em 0 1ex; vertical-align: top;" }],
<col style="padding: 0 1em 0 1ex; vertical-align: top;"/> ["col", { style: "padding: 0 1em 0 0; vertical-align: top;" }],
<col style="padding: 0 1em 0 0; vertical-align: top;"/> template_.map(hives, function (hive) let (i = 0) [
{ ["tr", { style: "height: .5ex;" }],
template.map(hives, function (hive) let (i = 0) template_.map(sheets(hive), function (sheet)
<tr style="height: .5ex;"/> + ["tr", {},
template.map(sheets(hive), function (sheet) ["td", { highlight: "Title" }, !i++ ? hive.name : ""],
<tr> ["td", {}, sheet.enabled ? "" : UTF8("×")],
<td highlight="Title">{!i++ ? hive.name : ""}</td> ["td", {}, sheet.name || hive.sheets.indexOf(sheet)],
<td>{sheet.enabled ? "" : UTF8("×")}</td> ["td", {}, sheet.formatSites(uris)],
<td>{sheet.name || hive.sheets.indexOf(sheet)}</td> ["td", {}, sheet.css]]),
<td>{sheet.formatSites(uris)}</td> ["tr", { style: "height: .5ex;" }]])];
<td>{sheet.css}</td>
</tr>) +
<tr style="height: .5ex;"/>)
}
</table>;
// TODO: Move this to an ItemList to show this automatically // E4X-FIXME
if (list.*.length() === list.text().length() + 5) // // TODO: Move this to an ItemList to show this automatically
dactyl.echomsg(_("style.none")); // if (list.*.length() === list.text().length() + 5)
else // dactyl.echomsg(_("style.none"));
commandline.commandOutput(list); // else
commandline.commandOutput(list);
}, },
registerSheet: function registerSheet(url, agent, reload) { registerSheet: function registerSheet(url, agent, reload) {
@@ -555,7 +551,7 @@ var Styles = Module("Styles", {
context.compare = modules.CompletionContext.Sort.number; context.compare = modules.CompletionContext.Sort.number;
context.generate = function () args["-group"].sheets; context.generate = function () args["-group"].sheets;
context.keys.active = function (sheet) uris.some(sheet.closure.match); context.keys.active = function (sheet) uris.some(sheet.closure.match);
context.keys.description = function (sheet) <>{sheet.formatSites(uris)}: {sheet.css.replace("\n", "\\n")}</> context.keys.description = function (sheet) [sheet.formatSites(uris), ": ", sheet.css.replace("\n", "\\n")];
if (filter) if (filter)
context.filters.push(function ({ item }) filter(item)); context.filters.push(function ({ item }) filter(item));
Styles.splitContext(context); Styles.splitContext(context);
@@ -718,7 +714,7 @@ var Styles = Module("Styles", {
})); }));
}, },
completion: function initCompletion(dactyl, modules, window) { completion: function initCompletion(dactyl, modules, window) {
const names = Array.slice(DOM(<div/>, window.document).style); const names = Array.slice(DOM(["div"], window.document).style);
modules.completion.css = function (context) { modules.completion.css = function (context) {
context.title = ["CSS Property"]; context.title = ["CSS Property"];
context.keys = { text: function (p) p + ":", description: function () "" }; context.keys = { text: function (p) p + ":", description: function () "" };