1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 13:42:27 +01:00

More, more, more of the same.

This commit is contained in:
Kris Maglione
2008-10-01 04:21:01 +00:00
parent bda94a3421
commit cc27911a60
4 changed files with 41 additions and 40 deletions

View File

@@ -289,16 +289,13 @@ liberator.Options = function () //{{{
{ {
if (!args) if (!args)
{ {
XML.prettyPrinting = false;
var str = <></>; var str = <></>;
for (let [i, value] in Iterator(liberator.globalVariables)) for (let [i, value] in Iterator(liberator.globalVariables))
{ {
if (typeof value == "number") let prefix = typeof value == "number" ? "#" :
var prefix = "#"; typeof value == "function" ? "*" :
else if (typeof value == "function") " ";
var prefix = "*";
else
var prefix = "";
str += <tr><td style="width: 200px;">{i}</td><td>{prefix}{value}</td></tr>; str += <tr><td style="width: 200px;">{i}</td><td>{prefix}{value}</td></tr>;
} }
if (str.length()) if (str.length())
@@ -362,12 +359,9 @@ liberator.Options = function () //{{{
} }
var value = reference[0][reference[1]]; var value = reference[0][reference[1]];
if (typeof value == "number") let prefix = typeof value == "number" ? "#" :
var prefix = "#"; typeof value == "function" ? "*" :
else if (typeof value == "function") " ";
var prefix = "*";
else
var prefix = "";
liberator.echo(reference[1] + "\t\t" + prefix + value); liberator.echo(reference[1] + "\t\t" + prefix + value);
} }
}); });

View File

@@ -710,11 +710,10 @@ liberator.Tabs = function () //{{{
list: function () list: function ()
{ {
// TODO: move this to liberator.tabs.get() // TODO: move this to liberator.tabs.get()
var items = liberator.completion.buffer("")[1];
var number, indicator, title, url;
var list = ":" + (liberator.util.escapeHTML(liberator.commandline.getCommand()) || "buffers") + "<br/>" + "<table>"; XML.prettyPrinting = false;
for (let i = 0; i < items.length; i++) let items = <></>;
for (let [i, item] in Iterator(liberator.completion.buffer("")[1]))
{ {
if (i == liberator.tabs.index()) if (i == liberator.tabs.index())
indicator = " <span style=\"color: blue\">%</span> "; indicator = " <span style=\"color: blue\">%</span> ";
@@ -723,17 +722,17 @@ liberator.Tabs = function () //{{{
else else
indicator = " "; indicator = " ";
[number, title] = items[i][0].split(/:\s+/, 2); let [number, title] = items[i][0].split(/:\s+/, 2);
url = items[i][1]; items +=
url = liberator.util.escapeHTML(url); <tr>
title = liberator.util.escapeHTML(title); <td align="right"> {number}</td>
<td><span style="color: blue"> {indicator} </span></td>
list += "<tr><td align=\"right\"> " + number + "</td><td>" + indicator + <td style="width:250px; max-width: 500px; overflow: hidden">{title}</td>
"</td><td style=\"width: 250px; max-width: 500px; overflow: hidden;\">" + title + <td><a href="#" class="hl-URL buffer-list">{item[1]}</a></td>
"</td><td><a href=\"#\" class=\"hl-URL buffer-list\">" + url + "</a></td></tr>"; </tr>;
} }
list += "</table>";
let list = liberator.buffer.template.generic(<table>{items}</table>);
liberator.commandline.echo(list, liberator.commandline.HL_NORMAL, liberator.commandline.FORCE_MULTILINE); liberator.commandline.echo(list, liberator.commandline.HL_NORMAL, liberator.commandline.FORCE_MULTILINE);
}, },

View File

@@ -1256,7 +1256,11 @@ liberator.ItemList = function (id) //{{{
var row = doc.createElement("tr"); var row = doc.createElement("tr");
row.setAttribute("class", "liberator-compitem"); row.setAttribute("class", "liberator-compitem");
var icon = doc.createElement("td"); var icon = doc.createElement("td");
icon.innerHTML = '<td style="vertical-align: middle"><img src="' + a + '" width="16px" height="16px"/></td><td style="vertical-align:middle">' + b + ' <br/><span style="color: green">' + c + '</span></td>'; XML.prettyPrinting = false;
icon.innerHTML = <>
<td style="vertical-align: middle"><img src={a} width="16px" height="16px"/></td>
<td style="vertical-align:middle">{b}<br/><span style="color: green">{c}</span></td>;
</>;
row.appendChild(icon); row.appendChild(icon);
return row; return row;

View File

@@ -67,13 +67,13 @@ liberator.util = { //{{{
// for java packages value.toString() would crash so badly // for java packages value.toString() would crash so badly
// that we cannot even try/catch it // that we cannot even try/catch it
if (/^\[JavaPackage.*\]$/.test(arg)) if (/^\[JavaPackage.*\]$/.test(arg))
return "[JavaPackage]"; return <>[JavaPackage]</>;
var str = arg.toString(); var str = arg.toString();
if (typeof str == "string") // can be "undefined" if (typeof str == "string") // can be "undefined"
return <>{str}</>; return <>{str}</>;
else else
return "undefined"; return <>undefined</>;
} }
} }
catch (e) catch (e)
@@ -201,6 +201,13 @@ liberator.util = { //{{{
// if color = true it uses HTML markup to color certain items // if color = true it uses HTML markup to color certain items
objectToString: function (object, color) objectToString: function (object, color)
{ {
/* Use E4X literals so html is automatically quoted
* only when it's asked for. Noone wants to see &lt;
* on their console or :map :foo in their buffer
* when they expect :map <C-f> :foo.
*/
XML.prettyPrinting = false;
if (object === null) if (object === null)
return "null"; return "null";
@@ -215,12 +222,11 @@ liberator.util = { //{{{
} }
catch (e) catch (e)
{ {
obj = "&lt;Object&gt;"; obj = "<Object>";
} }
if (color) if (color)
string += "<span class=\"hl-Title\">" + obj + "</span>::\n"; obj = <span class="hl-Title">{obj}</span>.toXMLString();
else
string += obj + "::\n"; string += obj + "::\n";
try // window.content often does not want to be queried with "var i in object" try // window.content often does not want to be queried with "var i in object"
@@ -234,15 +240,13 @@ liberator.util = { //{{{
} }
catch (e) catch (e)
{ {
value = "&lt;no value&gt;"; value = "<no value>";
} }
if (color) if (color) {
{ value = this.colorize(value, true).toXMLString();
value = this.colorize(value, true); i = <span style="font-weight: bold;">{i}</span>.toXMLString();
string += "<span style=\"font-weight: bold;\">" + i + "</span>: " + value + "\n";
} }
else
string += i + ": " + value + "\n"; string += i + ": " + value + "\n";
} }
} }