1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 21:12:27 +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++;
var type = feedTypes[feed.type] || feedTypes["application/rss+xml"];
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;
}
yield [" Title", doc.title];
yield [" URL", liberator.util.highlightURL(doc.location.toString(), true)];
yield ["Title", doc.title];
yield ["URL", liberator.util.highlightURL(doc.location.toString(), true)];
var ref = "referrer" in doc && doc.referrer;
if (ref)
yield [" Referrer", liberator.util.highlightURL(ref, true)];
yield ["Referrer", liberator.util.highlightURL(ref, true)];
if (pageSize[0])
yield [" File Size", pageSize[1] ? pageSize[1] + " (" + pageSize[0] + ")"
yield ["File Size", pageSize[1] ? pageSize[1] + " (" + pageSize[0] + ")"
: pageSize[0]];
yield [" Mime-Type", doc.contentType];
yield [" Encoding", doc.characterSet];
yield [" Compatibility", doc.compatMode == "BackCompat" ? "Quirks Mode" : "Full/Almost Standards Mode"];
yield ["Mime-Type", doc.contentType];
yield ["Encoding", doc.characterSet];
yield ["Compatibility", doc.compatMode == "BackCompat" ? "Quirks Mode" : "Full/Almost Standards Mode"];
if (lastModVerbose)
yield [" Last Modified", lastModVerbose];
yield ["Last Modified", lastModVerbose];
});
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])
.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)));
});
@@ -1840,16 +1840,18 @@ liberator.template = {
</table>);
},
table: function (title, data)
table: function (title, data, indent)
{
let table =
<table>
<col style={"width: " + (indent || "2ex")}/>
<tr>
<th class="hl-Title" align="left" colspan="2">{title}</th>
<th class="hl-Title" align="left" colspan="3">{title}</th>
</tr>
{
this.map(data, function (datum)
<tr>
<td/>
<td style="font-weight: bold; min-width: 150px">{datum[0]}</td>
<td>{liberator.template.maybeXML(datum[1])}</td>
</tr>)

View File

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

View File

@@ -323,12 +323,12 @@ liberator.IO = function () //{{{
XML.prettyPrinting = false;
var list =
<table>
{[
{
liberator.template.map2(scriptNames, function (i, name)
<tr>
<td style="text-align: right">{i+1}</td>
<td>{name}</td>
</tr>
for ([i, name] in Iterator(striptNames))].reduce(liberator.buffer.template.add, <></>)
</tr>)
}
</table>.toXMLString();
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
var multilineOutputWidget = document.getElementById("liberator-multiline-output");
var stylesheet =
<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 = "";
multilineOutputWidget.setAttribute("src",
liberator.util.blankDocument("liberator-multiline-output-content"));
var outputContainer = multilineOutputWidget.parentNode;
@@ -1203,19 +1188,10 @@ liberator.ItemList = function (id) //{{{
return;
}
var doc = iframe.contentDocument;
var doc;
var container = iframe.parentNode;
var stylesheet = liberator.util.xmlToDom(
<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);
iframe.setAttribute("src", liberator.util.blankDocument(id + "-content"));
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
@@ -1349,6 +1325,7 @@ liberator.ItemList = function (id) //{{{
// if @param selectedItem is given, show the list and select that item
setItems: function (items, selectedItem)
{
doc = iframe.contentDocument;
listOffset = listIndex = -1;
completions = items || [];
if (typeof(selectedItem) == "number")

View File

@@ -77,6 +77,24 @@ liberator.util = { //{{{
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)
{
return str.length <= length ? str : str.substr(0, length - 3) + "...";
@@ -404,7 +422,8 @@ liberator.util = { //{{{
case "text":
return doc.createTextNode(node);
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.@*)
domnode.setAttribute(attr.name(), String(attr));
for each (let child in node.*)