1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 20:52:26 +01:00

Fix :pageinfo spacing, and stuff.

This commit is contained in:
Kris Maglione
2008-10-03 16:50:21 +00:00
parent 2e16ddc8f1
commit 7521ef4bf1
5 changed files with 43 additions and 45 deletions

View File

@@ -682,7 +682,7 @@ liberator.Buffer = function () //{{{
nFeed++; nFeed++;
var type = feedTypes[feed.type] || feedTypes["application/rss+xml"]; var type = feedTypes[feed.type] || feedTypes["application/rss+xml"];
if (verbose) if (verbose)
yield [" " + feed.title, liberator.util.highlightURL(feed.href, true) + <span style="color: gray;"> ({type})</span>]; yield [feed.title, liberator.util.highlightURL(feed.href, true) + <span style="color: gray;"> ({type})</span>];
} }
} }
} }
@@ -736,22 +736,22 @@ liberator.Buffer = function () //{{{
return; return;
} }
yield [" Title", doc.title]; yield ["Title", doc.title];
yield [" URL", liberator.util.highlightURL(doc.location.toString(), true)]; yield ["URL", liberator.util.highlightURL(doc.location.toString(), true)];
var ref = "referrer" in doc && doc.referrer; var ref = "referrer" in doc && doc.referrer;
if (ref) if (ref)
yield [" Referrer", liberator.util.highlightURL(ref, true)]; yield ["Referrer", liberator.util.highlightURL(ref, true)];
if (pageSize[0]) if (pageSize[0])
yield [" File Size", pageSize[1] ? pageSize[1] + " (" + pageSize[0] + ")" yield ["File Size", pageSize[1] ? pageSize[1] + " (" + pageSize[0] + ")"
: pageSize[0]]; : pageSize[0]];
yield [" Mime-Type", doc.contentType]; yield ["Mime-Type", doc.contentType];
yield [" Encoding", doc.characterSet]; yield ["Encoding", doc.characterSet];
yield [" Compatibility", doc.compatMode == "BackCompat" ? "Quirks Mode" : "Full/Almost Standards Mode"]; yield ["Compatibility", doc.compatMode == "BackCompat" ? "Quirks Mode" : "Full/Almost Standards Mode"];
if (lastModVerbose) if (lastModVerbose)
yield [" Last Modified", lastModVerbose]; yield ["Last Modified", lastModVerbose];
}); });
addPageInfoSection("m", "Meta Tags", function (verbose) addPageInfoSection("m", "Meta Tags", function (verbose)
@@ -761,7 +761,7 @@ liberator.Buffer = function () //{{{
let nodes = Array.map(metaNodes, function (node) [(node.name || node.httpEquiv), node.content]) let nodes = Array.map(metaNodes, function (node) [(node.name || node.httpEquiv), node.content])
.sort(function (a, b) String.localeCompare(a[0].toLowerCase(), b[0].toLowerCase())); .sort(function (a, b) String.localeCompare(a[0].toLowerCase(), b[0].toLowerCase()));
return ([" " + node[0], liberator.util.highlightURL(node[1], false)] return ([node[0], liberator.util.highlightURL(node[1], false)]
for each (node in arrayIter(nodes))); for each (node in arrayIter(nodes)));
}); });
@@ -1840,16 +1840,18 @@ liberator.template = {
</table>); </table>);
}, },
table: function (title, data) table: function (title, data, indent)
{ {
let table = let table =
<table> <table>
<col style={"width: " + (indent || "2ex")}/>
<tr> <tr>
<th class="hl-Title" align="left" colspan="2">{title}</th> <th class="hl-Title" align="left" colspan="3">{title}</th>
</tr> </tr>
{ {
this.map(data, function (datum) this.map(data, function (datum)
<tr> <tr>
<td/>
<td style="font-weight: bold; min-width: 150px">{datum[0]}</td> <td style="font-weight: bold; min-width: 150px">{datum[0]}</td>
<td>{liberator.template.maybeXML(datum[1])}</td> <td>{liberator.template.maybeXML(datum[1])}</td>
</tr>) </tr>)

View File

@@ -475,7 +475,7 @@ liberator.Completion = function () //{{{
historyResult = result; historyResult = result;
historyTimer.tell(); historyTimer.tell();
if (result.searchResult <= result.RESULT_SUCCESS) if (result.searchResult <= result.RESULT_SUCCESS)
historyTimer.force(); historyTimer.flush();
} }
}); });
} }

View File

@@ -323,12 +323,12 @@ liberator.IO = function () //{{{
XML.prettyPrinting = false; XML.prettyPrinting = false;
var list = var list =
<table> <table>
{[ {
liberator.template.map2(scriptNames, function (i, name)
<tr> <tr>
<td style="text-align: right">{i+1}</td> <td style="text-align: right">{i+1}</td>
<td>{name}</td> <td>{name}</td>
</tr> </tr>)
for ([i, name] in Iterator(striptNames))].reduce(liberator.buffer.template.add, <></>)
} }
</table>.toXMLString(); </table>.toXMLString();
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

@@ -121,23 +121,8 @@ liberator.CommandLine = function () //{{{
// the widget used for multiline output // the widget used for multiline output
var multilineOutputWidget = document.getElementById("liberator-multiline-output"); var multilineOutputWidget = document.getElementById("liberator-multiline-output");
multilineOutputWidget.setAttribute("src",
var stylesheet = liberator.util.blankDocument("liberator-multiline-output-content"));
<link rel="stylesheet" type="text/css"
href={"chrome://" + liberator.config.name.toLowerCase() + "/skin/vimperator.css"}/>;
stylesheet = liberator.util.xmlToDom(stylesheet, multilineOutputWidget.contentDocument);
multilineOutputWidget.contentDocument.getElementsByTagName("head")[0]
.appendChild(stylesheet);
multilineOutputWidget.contentDocument.body.id = "liberator-multiline-output-content";
// TODO: is there a better way to determine and set the UI font, 'guifont' perhaps?
var mainWindowID = liberator.config.mainWindowID || "main-window";
var fontSize = document.defaultView.getComputedStyle(document.getElementById(mainWindowID), null).getPropertyValue("font-size");
multilineOutputWidget.contentDocument.body.setAttribute("style", "font-size: " + fontSize);
multilineOutputWidget.contentDocument.body.innerHTML = "";
var outputContainer = multilineOutputWidget.parentNode; var outputContainer = multilineOutputWidget.parentNode;
@@ -1203,19 +1188,10 @@ liberator.ItemList = function (id) //{{{
return; return;
} }
var doc = iframe.contentDocument; var doc;
var container = iframe.parentNode; var container = iframe.parentNode;
var stylesheet = liberator.util.xmlToDom( iframe.setAttribute("src", liberator.util.blankDocument(id + "-content"));
<link rel="stylesheet" type="text/css"
href={"chrome://" + liberator.config.name.toLowerCase() + "/skin/vimperator.css"}/>, doc);
doc.getElementsByTagName("head")[0].appendChild(stylesheet);
doc.body.id = id + "-content";
var mainWindowID = liberator.config.mainWindowID || "main-window";
var fontSize = document.defaultView.getComputedStyle(document.getElementById(mainWindowID), null).getPropertyValue("font-size");
doc.body.setAttribute("style", "font-size: " + fontSize);
var completions = []; // a reference to the Array of completions var completions = []; // a reference to the Array of completions
var listOffset = -1; // how many items is the displayed list shifted from the internal tab index var listOffset = -1; // how many items is the displayed list shifted from the internal tab index
@@ -1349,6 +1325,7 @@ liberator.ItemList = function (id) //{{{
// if @param selectedItem is given, show the list and select that item // if @param selectedItem is given, show the list and select that item
setItems: function (items, selectedItem) setItems: function (items, selectedItem)
{ {
doc = iframe.contentDocument;
listOffset = listIndex = -1; listOffset = listIndex = -1;
completions = items || []; completions = items || [];
if (typeof(selectedItem) == "number") if (typeof(selectedItem) == "number")

View File

@@ -77,6 +77,24 @@ liberator.util = { //{{{
yield ary[i]; yield ary[i];
}, },
blankDocument: function (bodyId)
{
let mainWindowID = liberator.config.mainWindowID || "main-window";
let fontSize = document.defaultView.getComputedStyle(document.getElementById(mainWindowID), null)
.getPropertyValue("font-size");
return 'data:application/xhtml+xml,' + encodeURI('<?xml version="1.0" encoding="UTF-8"?>' +
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">' +
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title/>
<link rel="stylesheet" type="text/css"
href={"chrome://" + liberator.config.name.toLowerCase() + "/skin/vimperator.css"}/>
</head>
<body id={bodyId} style={"font-size: " + fontSize}/>
</html>)
},
clip: function (str, length) clip: function (str, length)
{ {
return str.length <= length ? str : str.substr(0, length - 3) + "..."; return str.length <= length ? str : str.substr(0, length - 3) + "...";
@@ -404,7 +422,8 @@ liberator.util = { //{{{
case "text": case "text":
return doc.createTextNode(node); return doc.createTextNode(node);
case "element": case "element":
let domnode = doc.createElement(node.name()); // Should use the node's namespace, in the future.
let domnode = doc.createElementNS("http://www.w3.org/1999/xhtml", node.localName());
for each (let attr in node.@*) for each (let attr in node.@*)
domnode.setAttribute(attr.name(), String(attr)); domnode.setAttribute(attr.name(), String(attr));
for each (let child in node.*) for each (let child in node.*)