1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-25 02:43:34 +01:00

make further refinements to the output of :pageinfo

This commit is contained in:
Doug Kearns
2007-10-27 13:37:23 +00:00
parent 94c423dc3f
commit 961a1bdad3

View File

@@ -524,16 +524,14 @@ vimperator.Buffer = function() //{{{
if (!file) if (!file)
file = "[No Name]"; file = "[No Name]";
var title = window.content.document.title; var title = window.content.document.title || "[No Title]";
if (title.length > 60)
title = title.substr(0,57) + "... ";
else if (!title.length)
title = "[No Title]";
if (cacheEntryDescriptor) if (cacheEntryDescriptor)
var pageSize = Math.round(cacheEntryDescriptor.dataSize / 1024 * 100) / 100 + "KB"; var pageSize = Math.round(cacheEntryDescriptor.dataSize / 1024 * 100) / 100 + "KB";
var pageInfoText = "" + file + ": " + title + " (" + pageSize + ", other cool things)"; var lastmod = window.content.document.lastModified.slice(0, -3);
var pageInfoText = '"' + file + '" (' + pageSize + ", " + lastmod + ") " + title;
vimperator.echo(pageInfoText, vimperator.commandline.FORCE_SINGLELINE); vimperator.echo(pageInfoText, vimperator.commandline.FORCE_SINGLELINE);
return; return;
@@ -551,16 +549,20 @@ vimperator.Buffer = function() //{{{
pageGeneral.push(["Encoding", window.content.document.characterSet]); pageGeneral.push(["Encoding", window.content.document.characterSet]);
if (cacheEntryDescriptor) { if (cacheEntryDescriptor) {
var pageSize = cacheEntryDescriptor.dataSize; var pageSize = cacheEntryDescriptor.dataSize;
pageGeneral.push(["File Size", (Math.round(pageSize / 1024 * 100) / 100) + "KB (" + pageSize + " bytes)"]); var bytes = pageSize + '';
for (var u = bytes.length - 3; u > 0; u -= 3) // make a 1400 -> 1'400
bytes = bytes.slice(0, u) + "'" + bytes.slice(u, bytes.length);
pageGeneral.push(["File Size", (Math.round(pageSize / 1024 * 100) / 100) + "KB (" + bytes + " bytes)"]);
} }
pageGeneral.push(["Compatibility", content.document.compatMode == "BackCompat" ? pageGeneral.push(["Compatibility", content.document.compatMode == "BackCompat" ?
"Quirks Mode" : "Full/Almost Standard Mode"]); "Quirks Mode" : "Full/Almost Standard Mode"]);
pageGeneral.push(["Last Modified", window.content.document.lastModified]); pageGeneral.push(["Last Modified", window.content.document.lastModified]);
// get meta tag infos info and sort and put into pageMeta[] // get meta tag data, sort and put into pageMeta[]
var metaNodes = window.content.document.getElementsByTagName("meta"); var metaNodes = window.content.document.getElementsByTagName("meta");
var length = metaNodes.length; var length = metaNodes.length;
if (length) if (length)