bug 195492: lots of page info stuff

r=neil, sr=rbs
This commit is contained in:
db48x%yahoo.com 2004-12-13 07:44:52 +00:00
Родитель b80941eab1
Коммит 3d6119d928
13 изменённых файлов: 679 добавлений и 635 удалений

Просмотреть файл

@ -1,4 +1,4 @@
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
# -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
# ***** BEGIN LICENSE BLOCK *****
# Version: NPL 1.1/GPL 2.0/LGPL 2.1
#
@ -16,16 +16,17 @@
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Copyright (C) 1998-2004 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): smorrison@gte.com
# Terry Hayes <thayes@netscape.com>
# Daniel Brooks <db48x@yahoo.com>
# Florian QUEZE <f.qu@laposte.net>
# Erik Fabert <jerfa@yahoo.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
@ -76,6 +77,10 @@ pageInfoTreeView.prototype = {
return this.data[row][column.index] || "";
},
setCellValue: function(row, column, value)
{
},
setCellText: function(row, column, value)
{
this.data[row][column.index] = value;
@ -167,7 +172,7 @@ var fieldView = new pageInfoTreeView(["field-label","field-field","field-type","
var linkView = new pageInfoTreeView(["link-name","link-address","link-type","link-accesskey"], COPYCOL_LINK_ADDRESS);
var imageView = new pageInfoTreeView(["image-address","image-type","image-alt","image-node", "image-bg"], COPYCOL_IMAGE_ADDRESS);
var intervalID = null;
var kmsPerSec = 1000;
// localized strings (will be filled in when the document is loaded)
// this isn't all of them, these are just the ones that would otherwise have been loaded inside a loop
@ -249,6 +254,7 @@ function onLoadPageInfo()
gStrings.unknown = theBundle.getString("unknown");
gStrings.notSet = theBundle.getString("notset");
gStrings.emptyString = theBundle.getString("emptystring");
gStrings.noExpiration = theBundle.getString("generalNoExpiration");
gStrings.linkAnchor = theBundle.getString("linkAnchor");
gStrings.linkArea = theBundle.getString("linkArea");
gStrings.linkSubmit = theBundle.getString("linkSubmit");
@ -316,6 +322,7 @@ function onLoadPageInfo()
}
function doHelpButton() {
var helpdoc;
var tabControl = document.getElementById("tabbox");
switch (tabControl.selectedTab.id) {
case "generalTab":
@ -348,18 +355,18 @@ function makeGeneralTab()
var title = (theDocument.title) ? theBundle.getFormattedString("pageTitle", [theDocument.title]) : theBundle.getString("noPageTitle");
document.getElementById("titletext").value = title;
var url = theDocument.location;
document.getElementById("urltext").value = url;
var url = theDocument.location.toString();
setItemValue("urltext", url, gStrings.unknown);
var mode = ("compatMode" in theDocument && theDocument.compatMode == "BackCompat") ? theBundle.getString("generalQuirksMode") : theBundle.getString("generalStrictMode");
document.getElementById("modetext").value = mode;
var referrer = ("referrer" in theDocument && theDocument.referrer) || theBundle.getString("generalNoReferrer");
document.getElementById('refertext').value = referrer;
var referrer = ("referrer" in theDocument && theDocument.referrer);
setItemValue("refertext", referrer);
// find out the mime type
var mimeType = theDocument.contentType || gStrings.unknown;
document.getElementById("typetext").value = mimeType;
var mimeType = theDocument.contentType;
setItemValue("typetext", mimeType, gStrings.unknown);
// get the meta tags
var metaNodes = theDocument.getElementsByTagName("meta");
@ -371,8 +378,6 @@ function makeGeneralTab()
for (var i = 0; i < length; i++)
metaView.addRow([metaNodes[i].name || metaNodes[i].httpEquiv, metaNodes[i].content]);
metaView.rowCountChanged(0, length);
// get the document characterset
var encoding = theDocument.characterSet;
document.getElementById("encodingtext").value = encoding;
@ -382,17 +387,18 @@ function makeGeneralTab()
document.getElementById("modifiedtext").value = modifiedText;
// get cache info
var sourceText = theBundle.getString("generalNotCached");
var expirationText = theBundle.getString("generalNoExpiration");
var sizeText = gStrings.unknown;
var sourceText;
var expirationText;
var sizeText;
var pageSize = 0;
var kbSize = 0;
var expirationTime = 0;
var cacheKey = url.replace(/#.*$/, "");
try
{
var cacheEntryDescriptor = httpCacheSession.openCacheEntry(url, Components.interfaces.nsICache.ACCESS_READ, false);
var cacheEntryDescriptor = httpCacheSession.openCacheEntry(cacheKey, Components.interfaces.nsICache.ACCESS_READ, false);
if (cacheEntryDescriptor)
{
switch(cacheEntryDescriptor.deviceID)
@ -407,19 +413,13 @@ function makeGeneralTab()
sourceText = cacheEntryDescriptor.deviceID;
break;
}
pageSize = cacheEntryDescriptor.dataSize;
kbSize = pageSize / 1024;
sizeText = theBundle.getFormattedString("generalSize", [Math.round(kbSize*100)/100, pageSize]);
expirationText = formatDate(cacheEntryDescriptor.expirationTime*1000, gStrings.notSet);
}
}
catch(ex)
{
try
{
cacheEntryDescriptor = ftpCacheSession.openCacheEntry(url, Components.interfaces.nsICache.ACCESS_READ, false);
cacheEntryDescriptor = ftpCacheSession.openCacheEntry(cacheKey, Components.interfaces.nsICache.ACCESS_READ, false);
if (cacheEntryDescriptor)
{
switch(cacheEntryDescriptor.deviceID)
@ -434,22 +434,25 @@ function makeGeneralTab()
sourceText = cacheEntryDescriptor.deviceID;
break;
}
pageSize = cacheEntryDescriptor.dataSize;
kbSize = pageSize / 1024;
sizeText = theBundle.getFormattedString("generalSize", [Math.round(kbSize*100)/100, pageSize]);
expirationText = formatDate(cacheEntryDescriptor.expirationTime*1000, gStrings.notSet);
}
}
catch(ex2)
{
sourceText = theBundle.getString("generalNotCached");
}
}
document.getElementById("sourcetext").value = sourceText;
document.getElementById("expirestext").value = expirationText;
document.getElementById("sizetext").value = sizeText;
if (cacheEntryDescriptor)
{
pageSize = cacheEntryDescriptor.dataSize;
kbSize = pageSize / 1024;
sizeText = theBundle.getFormattedString("generalSize", [formatNumber(Math.round(kbSize*100)/100), formatNumber(pageSize)]);
expirationText = formatDate(cacheEntryDescriptor.expirationTime*kmsPerSec, gStrings.notSet);
}
setItemValue("sourcetext", sourceText, theBundle.getString("generalNotCached"));
setItemValue("expirestext", expirationText, gStrings.noExpiration);
setItemValue("sizetext", sizeText, gStrings.unknown);
}
//******** Generic Build-a-tab
@ -476,15 +479,16 @@ function makeTabs(aDocument, aWindow)
imageTree.treeBoxObject.view = imageView;
var iterator = aDocument.createTreeWalker(aDocument, NodeFilter.SHOW_ELEMENT, grabAll, true);
setTimeout(doGrab, 1, iterator);
setTimeout(doGrab, 16, iterator);
}
function doGrab(iterator)
{
if (iterator.nextNode())
{
setTimeout(doGrab, 1, iterator);
}
for (var i = 0; i < 50; ++i)
if (!iterator.nextNode())
return;
setTimeout(doGrab, 16, iterator);
}
function ensureSelection(view)
@ -497,8 +501,6 @@ function ensureSelection(view)
function grabAll(elem)
{
var linktext;
// check for background images, any node may have one
var url = elem.ownerDocument.defaultView.getComputedStyle(elem, "").getPropertyCSSValue("background-image");
if (url && url.primitiveType == CSSPrimitiveValue.CSS_URI)
@ -506,44 +508,49 @@ function grabAll(elem)
// one swi^H^H^Hif-else to rule them all
if (elem instanceof nsIAnchorElement)
{
linktext = getValueText(elem);
linkView.addRow([linktext, getAbsoluteURL(elem.href, elem), gStrings.linkAnchor, elem.target, elem.accessKey]);
}
linkView.addRow([getValueText(elem), elem.href, gStrings.linkAnchor, elem.target, elem.accessKey]);
else if (elem instanceof nsIImageElement)
{
imageView.addRow([getAbsoluteURL(elem.src, elem), gStrings.mediaImg, (elem.hasAttribute("alt")) ? elem.alt : gStrings.notSet, elem, false]);
}
imageView.addRow([elem.src, gStrings.mediaImg, (elem.hasAttribute("alt")) ? elem.alt : gStrings.notSet, elem, false]);
else if (elem instanceof nsIAreaElement)
{
linkView.addRow([elem.alt, getAbsoluteURL(elem.href, elem), gStrings.linkArea, elem.target]);
}
linkView.addRow([elem.alt, elem.href, gStrings.linkArea, elem.target]);
else if (elem instanceof nsILinkElement)
{
if (elem.rel)
{
var rel = elem.rel;
if (/\bicon\b/i.test(rel))
imageView.addRow([getAbsoluteURL(elem.href, elem), gStrings.mediaLink, "", elem, false]);
imageView.addRow([elem.href, gStrings.mediaLink, "", elem, false]);
else if (/\bstylesheet\b/i.test(rel))
linkView.addRow([elem.rel, getAbsoluteURL(elem.href, elem), gStrings.linkStylesheet, elem.target]);
linkView.addRow([elem.rel, elem.href, gStrings.linkStylesheet, elem.target]);
else
linkView.addRow([elem.rel, getAbsoluteURL(elem.href, elem), gStrings.linkRel, elem.target]);
linkView.addRow([elem.rel, elem.href, gStrings.linkRel, elem.target]);
}
else
linkView.addRow([elem.rev, getAbsoluteURL(elem.href, elem), gStrings.linkRev, elem.target]);
linkView.addRow([elem.rev, elem.href, gStrings.linkRev, elem.target]);
}
else if (elem instanceof nsIInputElement)
else if (elem instanceof nsIInputElement || elem instanceof nsIButtonElement)
{
if (/^image$/i.test(elem.type))
imageView.addRow([getAbsoluteURL(elem.src, elem), gStrings.mediaInput, (elem.hasAttribute("alt")) ? elem.alt : gStrings.notSet, elem, false]);
else if (/^submit$/i.test(elem.type))
linkView.addRow([elem.value || gStrings.linkSubmit, getAbsoluteURL(elem.form.getAttribute("action"), elem), gStrings.linkSubmission, elem.form.getAttribute("target")]); // use getAttribute() due to bug 122128
switch (elem.type.toLowerCase())
{
case "image":
imageView.addRow([elem.src, gStrings.mediaInput, (elem.hasAttribute("alt")) ? elem.alt : gStrings.notSet, elem, false]);
// Fall through, <input type="image"> submits, too
case "submit":
// Form element properties can be hidden by child elements with the same name, so
// we need to use a special access method, XPCNativeWrapper, to get their real values
if ("form" in elem && elem.form)
{
var formWrapper = new XPCNativeWrapper(elem.form, "target", "action");
linkView.addRow([elem.value || getValueText(elem) || gStrings.linkSubmit, formWrapper.action, gStrings.linkSubmission, formWrapper.target]);
}
else
linkView.addRow([elem.value || getValueText(elem) || gStrings.linkSubmit, '', gStrings.linkSubmission, '']);
}
}
else if (elem instanceof nsIFormElement)
{
formView.addRow([elem.name, elem.method, getAbsoluteURL(elem.getAttribute("action"), elem), elem]); // use getAttribute() because of bug 122128
formWrapper = new XPCNativeWrapper(elem, "name", "method", "action");
formView.addRow([formWrapper.name, formWrapper.method, formWrapper.action, elem]);
}
else if (elem instanceof nsIAppletElement)
{
@ -552,22 +559,18 @@ function grabAll(elem)
// content from two hosts (bug 136539) so just drop applets from Page Info when
// Java is on. For the 1.0.1 branch; get a real fix on the trunk.
if (!navigator.javaEnabled())
imageView.addRow([getAbsoluteURL(elem.code || elem.object, elem), gStrings.mediaApplet, "", elem, false]);
imageView.addRow([elem.code || elem.object, gStrings.mediaApplet, "", elem, false]);
}
else if (elem instanceof nsIObjectElement)
{
imageView.addRow([getAbsoluteURL(elem.data, elem), gStrings.mediaObject, getValueText(elem), elem, false]);
}
imageView.addRow([elem.data, gStrings.mediaObject, getValueText(elem), elem, false]);
else if (elem instanceof nsIEmbedElement)
{
imageView.addRow([getAbsoluteURL(elem.src, elem), gStrings.mediaEmbed, "", elem, false]);
}
imageView.addRow([elem.src, gStrings.mediaEmbed, "", elem, false]);
else
if (elem.hasAttributeNS(XLinkNS, "href"))
{
linktext = getValueText(elem);
linkView.addRow([linktext, getAbsoluteURL(elem.href, elem), gStrings.linkX, ""]);
}
linkView.addRow([getValueText(elem),
ioService.newURI(elem.getAttributeNS(XLinkNS, "href"), null, elem.baseURI).spec,
gStrings.linkX,
""]);
return NodeFilter.FILTER_ACCEPT;
}
@ -585,26 +588,27 @@ function onFormSelect()
formPreview.treeBoxObject.view = fieldView;
var clickedRow = formView.selection.currentIndex;
// form-node
// form-node;
var form = formView.data[clickedRow][3];
const formWrapper = new XPCNativeWrapper(form,
"name", "elements", "encoding", "target", "getElementsByTagName()");
var ft = null;
if (form.name)
ft = theBundle.getFormattedString("formTitle", [form.name]);
if (formWrapper.name)
ft = theBundle.getFormattedString("formTitle", [formWrapper.name]);
setItemValue("formenctype", formWrapper.encoding, theBundle.getString("default"));
setItemValue("formtarget", formWrapper.target, theBundle.getString("formDefaultTarget"));
document.getElementById("formname").value = ft || theBundle.getString("formUntitled");
document.getElementById("formenctype").value = form.encoding || theBundle.getString("default");
document.getElementById("formtarget").value = form.target || theBundle.getString("formDefaultTarget");
var formfields = form.elements;
var formfields = formWrapper.elements;
var length = formfields.length;
var i = 0;
var checked = theBundle.getString("formChecked");
var unchecked = theBundle.getString("formUnchecked");
for (i = 0; i < length; i++)
for (var i = 0; i < length; i++)
{
var elem = formfields[i], val;
@ -616,7 +620,7 @@ function onFormSelect()
fieldView.addRow(["", elem.name, elem.type, val]);
}
var labels = form.getElementsByTagName("label");
var labels = formWrapper.getElementsByTagName("label");
var llength = labels.length;
var label;
@ -630,16 +634,13 @@ function onFormSelect()
if (whatfor && (whatfor.form == form))
{
var labeltext = getValueText(label);
for (var j = 0; j < length; j++) {
for (var j = 0; j < length; j++)
if (formfields[j] == whatfor) {
var col = formPreview.columns["field-label"];
fieldView.setCellText(j, col, labeltext);
}
}
}
}
fieldView.rowCountChanged(0, length);
}
}
@ -720,7 +721,7 @@ function saveMedia()
var url = imageView.data[tree.currentIndex][0];
if (url)
saveURL(url, null, 'SaveImageTitle', false, false, makeURL(item.baseURI));
saveURL(url, null, 'SaveImageTitle', false, makeURI(item.baseURI));
}
function onImageSelect()
@ -730,7 +731,7 @@ function onImageSelect()
if (tree.view.selection.count == 1)
{
makePreview(tree.currentIndex);
makePreview(tree.view.selection.currentIndex);
saveAsButton.setAttribute("disabled", "false");
}
else
@ -743,45 +744,44 @@ function makePreview(row)
var item = getSelectedImage(imageTree);
var col = imageTree.columns["image-address"];
var url = imageView.getCellText(row, col);
// image-bg
var isBG = imageView.data[row][4];
document.getElementById("imageurltext").value = url;
document.getElementById("imagetitletext").value = item.title || gStrings.notSet;
setItemValue("imageurltext", url);
var altText = null;
if (item.hasAttribute("alt") && ("alt" in item))
altText = item.alt;
else if (!isBG)
altText = getValueText(item);
if (altText == null)
altText = gStrings.notSet;
var textbox=document.getElementById("imagealttext");
// IMO all text that is not really the value text should go in italics
// What if somebody has <img alt="Not specified">? =)
// We can't use textbox.style because of bug 7639
if (!altText) {
textbox.value = gStrings.emptyString;
textbox.setAttribute("style","font-style:italic");
} else {
textbox.value = altText;
textbox.setAttribute("style","font-style:inherit");
}
document.getElementById("imagelongdesctext").value = ("longDesc" in item && item.longDesc) || gStrings.notSet;
if (item.hasAttribute("title"))
setItemValue("imagetitletext", item.title, gStrings.emptyString);
else
setItemValue("imagetitletext", null);
if (item.hasAttribute("longDesc"))
setItemValue("imagelongdesctext", item.longDesc, gStrings.emptyString);
else
setItemValue("imagelongdesctext", null);
if (item.hasAttribute("alt"))
setItemValue("imagealttext", item.alt, gStrings.emptyString);
else if (item instanceof nsIImageElement || isBG)
setItemValue("imagealttext", null);
else
setItemValue("imagealttext", getValueText(item));
// get cache info
var sourceText = theBundle.getString("generalNotCached");
var expirationText = gStrings.unknown;
var sizeText = gStrings.unknown;
var expirationText;
var sizeText;
var pageSize = 0;
var kbSize = 0;
var expirationTime = 0;
var expirationDate = null;
document.getElementById("imagesourcetext").removeAttribute("disabled");
var cacheKey = url.replace(/#.*$/, "");
try
{
var cacheEntryDescriptor = httpCacheSession.openCacheEntry(url, Components.interfaces.nsICache.ACCESS_READ, false); // open for READ, in non-blocking mode
var cacheEntryDescriptor = httpCacheSession.openCacheEntry(cacheKey, Components.interfaces.nsICache.ACCESS_READ, false); // open for READ, in non-blocking mode
if (cacheEntryDescriptor)
{
switch(cacheEntryDescriptor.deviceID)
@ -802,7 +802,7 @@ function makePreview(row)
{
try
{
cacheEntryDescriptor = ftpCacheSession.openCacheEntry(url, Components.interfaces.nsICache.ACCESS_READ, false); // open for READ, in non-blocking mode
cacheEntryDescriptor = ftpCacheSession.openCacheEntry(cacheKey, Components.interfaces.nsICache.ACCESS_READ, false); // open for READ, in non-blocking mode
if (cacheEntryDescriptor)
{
switch(cacheEntryDescriptor.deviceID)
@ -821,7 +821,6 @@ function makePreview(row)
}
catch(ex2)
{
sourceText = theBundle.getString("generalNotCached");
}
}
@ -830,39 +829,43 @@ function makePreview(row)
{
pageSize = cacheEntryDescriptor.dataSize;
kbSize = pageSize / 1024;
sizeText = theBundle.getFormattedString("generalSize", [Math.round(kbSize*100)/100, pageSize]);
sizeText = theBundle.getFormattedString("generalSize", [formatNumber(Math.round(kbSize*100)/100), formatNumber(pageSize)]);
expirationText = formatDate(cacheEntryDescriptor.expirationTime*1000, gStrings.notSet);
expirationText = formatDate(cacheEntryDescriptor.expirationTime*kmsPerSec, null);
}
var mimeType = ("type" in item && item.type) ||
("codeType" in item && item.codeType) ||
("contentType" in item && item.contentType) ||
getContentTypeFromImgRequest(item) ||
getContentTypeFromHeaders(cacheEntryDescriptor) ||
gStrings.unknown;
setItemValue("imageexpirestext", expirationText, gStrings.noExpiration);
setItemValue("imagesizetext", sizeText, gStrings.unknown);
setItemValue("imagesourcetext", sourceText, theBundle.getString("generalNotCached"));
document.getElementById("imagetypetext").value = mimeType;
document.getElementById("imagesourcetext").value = sourceText;
document.getElementById("imageexpirestext").value = expirationText;
document.getElementById("imagesizetext").value = sizeText;
var mimeType;
if (item instanceof nsIObjectElement || item instanceof nsIEmbedElement || item instanceof nsILinkElement)
mimeType = item.type;
if (!mimeType)
mimeType = getContentTypeFromImgRequest(item) ||
getContentTypeFromHeaders(cacheEntryDescriptor);
setItemValue("imagetypetext", mimeType, gStrings.unknown);
var imageContainer = document.getElementById("theimagecontainer");
var oldImage = document.getElementById("thepreviewimage");
var regex = new RegExp("^(https?|ftp|file|gopher)://");
var absoluteURL = getAbsoluteURL(url, item);
var isProtocolAllowed = regex.test(absoluteURL);
const regex = /^(https?|ftp|file|gopher|about|chrome|resource):/;
var isProtocolAllowed = regex.test(url);
if (/^data:/.test(url) && /^image\//.test(mimeType))
isProtocolAllowed = true;
var newImage = new Image();
newImage.setAttribute("id", "thepreviewimage");
var physWidth = 0, physHeight = 0;
var width = 0, height = 0;
if ((item instanceof nsILinkElement || item instanceof nsIInputElement ||
item instanceof nsIImageElement || isBG) && isProtocolAllowed)
if ((item instanceof nsILinkElement || item instanceof nsIInputElement || item instanceof nsIImageElement ||
(item instanceof nsIObjectElement && /^image\//.test(mimeType)) || isBG) && isProtocolAllowed)
{
newImage.src = absoluteURL;
physWidth = newImage.width;
physHeight = newImage.height;
newImage.setAttribute("src", url);
physWidth = newImage.width || 0;
physHeight = newImage.height || 0;
// "width" and "height" attributes must be set to newImage,
// even if there is no "width" or "height attribute in item;
@ -879,29 +882,41 @@ function makePreview(row)
newImage.width = newImage.naturalWidth;
newImage.height = newImage.naturalHeight;
}
width = newImage.width;
height = newImage.height;
document.getElementById("theimagecontainer").collapsed = false
document.getElementById("brokenimagecontainer").collapsed = true;
}
else
{
// fallback image for protocols not allowed (e.g., data: or javascript:)
// or elements not [yet] handled (e.g., object, embed). XXX blank??
newImage.src = "resource://gre/res/loading-image.gif";
newImage.width = 40;
newImage.height = 40;
// or elements not [yet] handled (e.g., object, embed).
document.getElementById("brokenimagecontainer").collapsed = false;
document.getElementById("theimagecontainer").collapsed = true;
}
var width = ("width" in item && item.width) || ("width" in newImage && newImage.width) || "0";
var height = ("height" in item && item.height) || ("height" in newImage && newImage.height) || "0";
document.getElementById("imageSize").value = theBundle.getFormattedString("mediaSize", [width, height]);
if (width != physWidth || height != physHeight)
var imageSize = document.getElementById("imageSize");
if (url)
{
document.getElementById("physSize").removeAttribute("hidden");
document.getElementById("physSize").value = theBundle.getFormattedString("mediaPhysSize", [physWidth, physHeight]);
imageSize.value = theBundle.getFormattedString("mediaSize", [formatNumber(width), formatNumber(height)]);
imageSize.removeAttribute("disabled");
}
else
document.getElementById("physSize").setAttribute("hidden", "true");
{
imageSize.value = gStrings.notSet;
imageSize.setAttribute("disabled", "true");
}
var physRow = document.getElementById("physRow");
if (width != physWidth || height != physHeight)
{
physRow.collapsed = false;
document.getElementById("physSize").value = theBundle.getFormattedString("mediaSize", [formatNumber(physWidth), formatNumber(physHeight)]);
}
else
physRow.collapsed = true;
imageContainer.removeChild(oldImage);
imageContainer.appendChild(newImage);
@ -909,14 +924,11 @@ function makePreview(row)
function getContentTypeFromHeaders(cacheEntryDescriptor)
{
var headers, match;
if (!cacheEntryDescriptor)
return null;
if (cacheEntryDescriptor)
{
headers = cacheEntryDescriptor.getMetaDataElement("response-head");
match = /^Content-Type:\s*(.*?)\s*(?:\;|$)/mi.exec(headers);
return match[1];
}
return (/^Content-Type:\s*(.*?)\s*(?:\;|$)/mi
.exec(cacheEntryDescriptor.getMetaDataElement("response-head")))[1];
}
function getContentTypeFromImgRequest(item)
@ -999,83 +1011,66 @@ function stripWS(text)
return text.replace(endRE, "");
}
function setItemValue(id, value, other)
{
var item = document.getElementById(id);
item.value = value || other || gStrings.notSet;
if (value)
item.removeAttribute("disabled");
else
item.setAttribute("disabled", "true");
}
function formatNumber(number)
{
return (+number).toLocaleString(); // coerce number to a numeric value before calling toLocaleString()
}
function formatDate(datestr, unknown)
{
var date = new Date(datestr);
return (date.valueOf()) ? dateService.FormatDateTime("", dateService.dateFormatLong, dateService.timeFormatSeconds, date.getFullYear(), date.getMonth()+1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()) : unknown;
}
/*
* Takes care of XMLBase and <base>
* url is the possibly relative url.
* node is the node where the url was given (needed for XMLBase)
*
* This function is called in many places as a workaround for bug 72524
* Once bug 72522 is fixed this code should use the Node.baseURI attribute
*
* for node==null or url=="", empty string is returned
*
* This is basically just copied from http://lxr.mozilla.org/seamonkey/source/xpfe/browser/resources/content/metadata.js,
* though I've modified it so that it doesn't assign to .spec
*/
function getAbsoluteURL(url, node)
{
if (!url || !node)
return "";
var urlArr = new Array(url);
var doc = node.ownerDocument;
if (node.nodeType == Node.ATTRIBUTE_NODE)
node = node.ownerElement;
while (node && node.nodeType == Node.ELEMENT_NODE)
{
var att = node.getAttributeNS(XMLNS, "base");
if (att != "")
urlArr.unshift(att);
node = node.parentNode;
}
// Look for a <base>.
var baseTags = doc.getElementsByTagNameNS(XHTMLNS, "base");
if (baseTags && baseTags.length)
{
urlArr.unshift(baseTags[baseTags.length - 1].getAttribute("href"));
}
// resolve everything from bottom up, starting with document location
var ioService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
var URL = ioService.newURI(doc.location.href, null, null);
for (var i=0; i<urlArr.length; i++)
{
try
{
URL = ioService.newURI(urlArr[i], URL.originCharset, URL);
}
catch (ex)
{
; // do nothing
}
}
return URL.spec;
}
function doCopy(event)
function doCopy()
{
if (!gClipboardHelper)
return;
var elem = event.originalTarget;
if (elem && "treeBoxObject" in elem)
elem.treeBoxObject.view.performActionOnRow("copy", elem.currentIndex);
var elem = document.commandDispatcher.focusedElement;
var text = elem.getAttribute("copybuffer");
if (text)
gClipboardHelper.copyString(text);
if (elem && "treeBoxObject" in elem)
{
var view = elem.treeBoxObject.view;
var selection = view.selection;
var text = [], tmp = '';
var min = {}, max = {};
var count = selection.getRangeCount();
for (var i = 0; i < count; i++)
{
selection.getRangeAt(i, min, max);
for (var row = min.value; row <= max.value; row++)
{
view.performActionOnRow("copy", row);
tmp = elem.getAttribute("copybuffer");
if (tmp)
text.push(tmp);
elem.removeAttribute("copybuffer");
}
}
gClipboardHelper.copyString(text.join("\n"));
}
}
function doSelectAll()
{
var elem = document.commandDispatcher.focusedElement;
if (elem && "treeBoxObject" in elem)
elem.treeBoxObject.view.selection.selectAll();
}

Просмотреть файл

@ -22,6 +22,7 @@
# Chris McAfee <mcafee@netscape.com>
# Daniel Brooks <db48x@yahoo.com>
# Gervase Markham <gerv@gerv.net>
# Florian QUEZE <f.qu@laposte.net>
<?xml-stylesheet href="chrome://browser/skin/pageInfo.css" type="text/css"?>
@ -33,34 +34,49 @@
<window id="main-window"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
windowtype="Browser:page-info"
onload="onLoadPageInfo()" onclose="return closeWindow(false);"
align="stretch" class="dialog"
onload="onLoadPageInfo()"
align="stretch"
screenX="10" screenY="10"
width="&pageInfoWindow.width;" height="&pageInfoWindow.height;"
persist="screenX screenY width height sizemode">
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
<script type="application/x-javascript" src="chrome://global/content/XPCNativeWrapper.js"/>
<script type="application/x-javascript" src="chrome://browser/content/contentAreaUtils.js"/>
<script type="application/x-javascript" src="chrome://browser/content/pageInfo.js"/>
<stringbundle id="pageinfobundle" src="chrome://navigator/locale/pageInfo.properties"/>
<commandset>
<command id="cmd_close" oncommand="window.close();"/>
<command id="cmd_help" oncommand="doHelpButton();"/>
<command id="cmd_copy" oncommand="doCopy();"/>
<command id="cmd_selectall" oncommand="doSelectAll();"/>
</commandset>
<keyset>
<key id="closeWindow" key="&closeWindow;" modifiers="accel" oncommand="closeWindow(true);"/>
<key keycode="VK_ESCAPE" oncommand="closeWindow(true);"/>
<key id="copy" key="c" modifiers="accel" oncommand="doCopy(event);"/>
<key key="&closeWindow.key;" modifiers="accel" command="cmd_close"/>
<key keycode="VK_ESCAPE" command="cmd_close"/>
<key keycode="." modifiers="meta" command="cmd_close"/>
<key keycode="VK_F1" command="cmd_help"/>
<key key="&copy.key;" modifiers="accel" command="cmd_copy"/>
<key key="&selectall.key;" modifiers="accel" command="cmd_selectall"/>
<key key="&selectall.key;" modifiers="alt" command="cmd_selectall"/>
</keyset>
<!-- keys are appended from the overlay -->
<keyset id="dialogKeys"/>
<stringbundle id="pageinfobundle" src="chrome://browser/locale/pageInfo.properties"/>
<menupopup id="picontext">
<menuitem label="&selectall.label;" command="cmd_selectall" accesskey="&selectall.key;"/>
<menuitem label="&copy.label;" command="cmd_copy" accesskey="&copy.key;"/>
</menupopup>
<tabbox id="tabbox" flex="1">
<tabbox id="tabbox" flex="1" class="spaced">
<tabs id="tabs">
<tab id="generalTab" label="&generalTab;"/>
<tab id="formsTab" label="&formsTab;"
<tab id="generalTab" label="&generalTab;" accesskey="&generalAccesskey;"/>
<tab id="formsTab" label="&formsTab;" accesskey="&formsAccesskey;"
oncommand="ensureSelection(formView)"/>
<tab id="linksTab" label="&linksTab;"
<tab id="linksTab" label="&linksTab;" accesskey="&linksAccesskey;"
oncommand="ensureSelection(linkView)"/>
<tab id="mediaTab" label="&mediaTab;"
<tab id="mediaTab" label="&mediaTab;" accesskey="&mediaAccesskey;"
oncommand="ensureSelection(imageView)"/>
<!-- Others added by overlay -->
</tabs>
@ -79,7 +95,7 @@
<row>
<label value="&generalURL;"/>
<separator/>
<textbox readonly="true" crop="right" id="urltext"/>
<textbox readonly="true" crop="right" id="urltext" class="text-link"/>
</row>
<row>
<separator class="thin"/>
@ -131,7 +147,7 @@
</grid>
<separator class="thin"/>
<text id="metahead" class="header" value="&generalMeta;"/>
<tree id="metatree" flex="1">
<tree id="metatree" flex="1" contextmenu="picontext">
<treecols>
<treecol persist="hidden width" flex="1" id="meta-name" label="&generalMetaName;"/>
<splitter class="tree-splitter"/>
@ -143,7 +159,7 @@
<!-- Form information -->
<vbox>
<tree id="formtree" class="fixedsize" persist="height" onselect="onFormSelect();">
<tree id="formtree" class="fixedsize" onselect="onFormSelect();" contextmenu="picontext">
<treecols>
<splitter class="tree-splitter"/>
<treecol sortSeparators="true" persist="hidden width" flex="1"
@ -180,7 +196,7 @@
</rows>
</grid>
<text class="header" value="&formFields;"/>
<tree id="formpreview" flex="1">
<tree id="formpreview" flex="1" contextmenu="picontext">
<treecols>
<treecol sortSeparators="true" persist="hidden width" flex="3"
width="3" id="field-label" label="&formLabel;"/>
@ -201,7 +217,7 @@
<!-- Link info -->
<vbox>
<tree id="linktree" flex="1" ondraggesture="onBeginLinkDrag(event,'link-address','link-name')">
<tree id="linktree" flex="1" ondraggesture="onBeginLinkDrag(event,'link-address','link-name')" contextmenu="picontext">
<treecols>
<treecol sortSeparators="true" persist="hidden width" flex="5"
width="5" id="link-name" label="&linkName;"/>
@ -224,7 +240,7 @@
<!-- Media information -->
<vbox>
<tree id="imagetree" class="fixedsize" persist="height" onselect="onImageSelect();" ondraggesture="onBeginLinkDrag(event,'image-address','image-alt')">
<tree id="imagetree" class="fixedsize" onselect="onImageSelect();" ondraggesture="onBeginLinkDrag(event,'image-address','image-alt')" contextmenu="picontext">
<treecols>
<treecol sortSeparators="true" persist="hidden width" flex="10"
width="10" id="image-address" label="&mediaAddress;"/>
@ -289,20 +305,29 @@
<row>
<label value="&mediaDimensions;"/>
<separator/>
<vbox>
<textbox readonly="true" crop="right" id="imageSize"/>
<textbox readonly="true" crop="right" id="physSize"/>
</vbox>
<textbox readonly="true" crop="right" id="imageSize"/>
</row>
<row id="physRow" collapsed="true">
<label value="&mediaPhysDimensions;"/>
<separator/>
<textbox readonly="true" crop="right" id="physSize"/>
</row>
</rows>
</grid>
<hbox>
<button label="&mediaSaveAs;" accesskey="&mediaSaveAsAccesskey;" id="imagesaveasbutton" disabled="true" oncommand="saveMedia();"/>
<hbox align="end">
<label value="&mediaPreview;" class="header"/>
<spacer flex="1"/>
<button label="&mediaSaveAs;" accesskey="&mediaSaveAs.accesskey;"
id="imagesaveasbutton" disabled="true"
oncommand="saveMedia();"/>
</hbox>
<vbox class="inset iframe" flex="1" pack="center">
<hbox id="theimagecontainer" pack="center">
<image id="thepreviewimage"/>
</hbox>
<hbox id="brokenimagecontainer" pack="center" collapsed="true">
<image id="brokenimage" src="resource:///res/broken-image.gif"/>
</hbox>
</vbox>
</vbox>
</vbox>

Просмотреть файл

@ -18,7 +18,7 @@
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Contributor(s): Daniel Brooks <db48x@yahoo.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -39,21 +39,24 @@
<!ENTITY title "Page Info">
<!ENTITY description "Information about the current page">
<!ENTITY helpButton "Help">
<!ENTITY pageInfoWindow.width "425">
<!ENTITY pageInfoWindow.height "470">
<!ENTITY unknown "Unknown">
<!ENTITY closeWindow "w">
<!ENTITY copy.key "C">
<!ENTITY copy.label "Copy">
<!ENTITY selectall.key "A">
<!ENTITY selectall.label "Select All">
<!ENTITY closeWindow.key "w">
<!ENTITY generalTab "General">
<!ENTITY generalAccesskey "G">
<!ENTITY generalTitle "Title:">
<!ENTITY generalURL "URL:">
<!ENTITY generalURL "Address:">
<!ENTITY generalMode "Render Mode:">
<!ENTITY generalType "Type:">
<!ENTITY generalSize "Size:">
<!ENTITY generalReferrer "Referring URL:">
<!ENTITY generalSource "Source:">
<!ENTITY generalSource "Cache Source:">
<!ENTITY generalSent "Sent:">
<!ENTITY generalModified "Modified:">
<!ENTITY generalExpires "Expires:">
@ -63,6 +66,7 @@
<!ENTITY generalMetaContent "Content">
<!ENTITY formsTab "Forms">
<!ENTITY formsAccesskey "F">
<!ENTITY formAction "Form Action">
<!ENTITY formMethod "Method">
<!ENTITY formName "Name">
@ -76,6 +80,7 @@
<!ENTITY formCValue "Current Value">
<!ENTITY linksTab "Links">
<!ENTITY linksAccesskey "L">
<!ENTITY linkNo "No.">
<!ENTITY linkName "Name">
<!ENTITY linkAddress "Address">
@ -84,9 +89,10 @@
<!ENTITY linkAccessKey "Access Key">
<!ENTITY mediaTab "Media">
<!ENTITY mediaAccesskey "M">
<!ENTITY mediaHeader "Images on this page">
<!ENTITY mediaURL "URL:">
<!ENTITY mediaBase "Base URL:">
<!ENTITY mediaURL "Address:">
<!ENTITY mediaBase "Base Address:">
<!ENTITY mediaAlt "Alternate Text:">
<!ENTITY mediaAltHeader "Alternate Text">
<!ENTITY mediaNo "No.">
@ -95,14 +101,17 @@
<!ENTITY mediaType "Type">
<!ENTITY mediaPlugin "Plugin:">
<!ENTITY mediaCharset "Encoding:">
<!ENTITY mediaDimensions "Dimensions:">
<!ENTITY mediaDimensions "Specified Dimensions:">
<!ENTITY mediaPhysDimensions "Actual Dimensions:">
<!ENTITY mediaEncryption "Encryption:">
<!ENTITY mediaTitle "Title Attribute:">
<!ENTITY mediaTitle "Title:">
<!ENTITY mediaLongdesc "Long Description:">
<!ENTITY mediaSaveAs "Save As...">
<!ENTITY mediaSaveAsAccesskey "S">
<!ENTITY mediaSaveAs.accesskey "S">
<!ENTITY mediaPreview "Media Preview:">
<!ENTITY framesTab "Frames">
<!ENTITY framesTab.accesskey "r">
<!ENTITY frameName "Name">
<!ENTITY frameAddress "Address">
<!ENTITY frameType "Type">

Просмотреть файл

@ -1,18 +1,41 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and imitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is International
# Business Machines Corporation. Portions created by IBM
# Corporation are Copyright (C) 2000 International Business
# Machines Corporation. All Rights Reserved.
#
# Contributor(s):
# Daniel Brooks <db48x@yahoo.com>
# Mike Kowalski <mikejk@ameritech.net>
pageInfo.title=Page Info
frameInfo.title=Frame Info
noPageTitle=Untitled Page
noPageTitle=Untitled Page:
pageTitle=%S:
unknown=Unknown
default=Default
notset=Not Specified
notset=Not specified
emptystring=Empty String
generalNotCached=(not cached)
generalNoExpiration=(no expiration set)
generalNotCached=Not cached
generalNoExpiration=No expiration set
generalQuirksMode=Quirks mode
generalStrictMode=Standards compliance mode
generalNoReferrer=(no referrer)
generalNoReferrer=no referrer
formTitle=Form %S:
formUntitled=Unnamed Form:
@ -25,7 +48,7 @@ linkAnchor=Anchor
linkArea=Area
linkSubmission=Form Submission
linkSubmit=Submit Query
linkRel=Related Link
linkRel=Related Item
linkStylesheet=Stylesheet
linkRev=Reverse Link
linkX=Simple XLink
@ -37,11 +60,10 @@ mediaObject=Object
mediaEmbed=Embed
mediaLink=Icon
mediaInput=Input
mediaSize=Width: %Spx, Height: %Spx
mediaPhysSize=Physical Width: %Spx, Physical Height: %Spx
mediaSize=%Spx \u00D7 %Spx
generalDiskCache=Disk Cache
generalMemoryCache=Memory Cache
generalHTTPCache=HTTP Cache
generalFTPCache=FTP Cache
generalDiskCache=Disk cache
generalMemoryCache=Memory cache
generalHTTPCache=HTTP cache
generalFTPCache=FTP cache
generalSize=%S KB (%S bytes)

Просмотреть файл

@ -15,11 +15,12 @@
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-1999
* Portions created by the Initial Developer are Copyright (C) 1998-2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Kevin Gerich (webmail@kmgerich.com)
* Daniel Brooks <db48x@yahoo.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -34,18 +35,40 @@
* the terms of any one of the NPL, the GPL or the LGPL.
* ***** END LICENSE BLOCK ***** */
@import "chrome://global/skin/"; tree { margin: .5em; } textbox, textbox > .textbox-internal-box, textbox > .textarea-internal-box {
background: transparent !important; border: none; padding: 0px; -moz-appearance: none;
}
@import "chrome://global/skin/";
tree {
margin: .5em;
}
textbox,
textbox > .textbox-internal-box,
textbox > .textarea-internal-box {
background: transparent !important;
border: none;
padding: 0px;
-moz-appearance: none;
}
textbox.header {
margin-left: 0; }
.iframe { margin: .5em;
background: white;
overflow: auto;
}
#thepreviewimage { margin: 1em;
margin-left: 0;
}
.fixedsize { height: 8.5em; }
.iframe {
margin: .5em;
background: white;
overflow: auto;
}
#thepreviewimage {
margin: 1em;
}
.fixedsize {
height: 8.5em;
}
textbox[disabled] {
text-syle: italic;
}

Просмотреть файл

@ -1,3 +1,40 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Kevin Gerich (webmail@kmgerich.com)
* Daniel Brooks <db48x@yahoo.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
* ***** END LICENSE BLOCK ***** */
@import "chrome://global/skin/";
tree {
@ -30,3 +67,7 @@ textbox.header {
.fixedsize {
height: 8.5em;
}
textbox[disabled] {
text-style: italic;
}

Просмотреть файл

@ -49,7 +49,7 @@
<!ENTITY pageInfo.type.objects "Generic Objects">
<!ENTITY pageInfo.type.scripts "Scripts">
<!ENTITY pageInfo.humanReadable.label "Policy">
<!ENTITY pageInfo.humanReadable.accesskey "l">
<!ENTITY pageInfo.humanReadable.accesskey "c">
<!ENTITY pageInfo.machineReadable.label "Summary">
<!ENTITY pageInfo.machineReadable.accesskey "S">
<!ENTITY pageInfo.optinoptout.label "Options">

Просмотреть файл

@ -14,7 +14,7 @@
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Daniel Brooks.
* Portions created by the Initial Developer are Copyright (C) 2001
* Portions created by the Initial Developer are Copyright (C) 2001-2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
@ -66,3 +66,7 @@ textbox.header {
.fixedsize {
height: 8.5em;
}
textbox[disabled] {
font-style: italic;
}

Просмотреть файл

@ -14,7 +14,7 @@
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Daniel Brooks.
* Portions created by the Initial Developer are Copyright (C) 2001
* Portions created by the Initial Developer are Copyright (C) 2001-2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
@ -65,3 +65,8 @@ textbox.header {
.fixedsize {
height: 8.5em;
}
textbox[disabled]
{
font-style: italic;
}

Просмотреть файл

@ -1,4 +1,4 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -16,7 +16,7 @@
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* Portions created by the Initial Developer are Copyright (C) 1998-2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
@ -24,6 +24,7 @@
* Terry Hayes <thayes@netscape.com>
* Daniel Brooks <db48x@yahoo.com>
* Florian QUEZE <f.qu@laposte.net>
* Erik Fabert <jerfa@yahoo.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -171,7 +172,7 @@ var fieldView = new pageInfoTreeView(["field-label","field-field","field-type","
var linkView = new pageInfoTreeView(["link-name","link-address","link-type","link-accesskey"], COPYCOL_LINK_ADDRESS);
var imageView = new pageInfoTreeView(["image-address","image-type","image-alt","image-node", "image-bg"], COPYCOL_IMAGE_ADDRESS);
var intervalID = null;
var kmsPerSec = 1000;
// localized strings (will be filled in when the document is loaded)
// this isn't all of them, these are just the ones that would otherwise have been loaded inside a loop
@ -253,6 +254,7 @@ function onLoadPageInfo()
gStrings.unknown = theBundle.getString("unknown");
gStrings.notSet = theBundle.getString("notset");
gStrings.emptyString = theBundle.getString("emptystring");
gStrings.noExpiration = theBundle.getString("generalNoExpiration");
gStrings.linkAnchor = theBundle.getString("linkAnchor");
gStrings.linkArea = theBundle.getString("linkArea");
gStrings.linkSubmit = theBundle.getString("linkSubmit");
@ -353,18 +355,18 @@ function makeGeneralTab()
var title = (theDocument.title) ? theBundle.getFormattedString("pageTitle", [theDocument.title]) : theBundle.getString("noPageTitle");
document.getElementById("titletext").value = title;
var url = theDocument.location;
document.getElementById("urltext").value = url;
var url = theDocument.location.toString();
setItemValue("urltext", url, gStrings.unknown);
var mode = ("compatMode" in theDocument && theDocument.compatMode == "BackCompat") ? theBundle.getString("generalQuirksMode") : theBundle.getString("generalStrictMode");
document.getElementById("modetext").value = mode;
var referrer = ("referrer" in theDocument && theDocument.referrer) || theBundle.getString("generalNoReferrer");
document.getElementById('refertext').value = referrer;
var referrer = ("referrer" in theDocument && theDocument.referrer);
setItemValue("refertext", referrer);
// find out the mime type
var mimeType = theDocument.contentType || gStrings.unknown;
document.getElementById("typetext").value = mimeType;
var mimeType = theDocument.contentType;
setItemValue("typetext", mimeType, gStrings.unknown);
// get the meta tags
var metaNodes = theDocument.getElementsByTagName("meta");
@ -385,17 +387,18 @@ function makeGeneralTab()
document.getElementById("modifiedtext").value = modifiedText;
// get cache info
var sourceText = theBundle.getString("generalNotCached");
var expirationText = theBundle.getString("generalNoExpiration");
var sizeText = gStrings.unknown;
var sourceText;
var expirationText;
var sizeText;
var pageSize = 0;
var kbSize = 0;
var expirationTime = 0;
var cacheKey = url.replace(/#.*$/, "");
try
{
var cacheEntryDescriptor = httpCacheSession.openCacheEntry(url, Components.interfaces.nsICache.ACCESS_READ, false);
var cacheEntryDescriptor = httpCacheSession.openCacheEntry(cacheKey, Components.interfaces.nsICache.ACCESS_READ, false);
if (cacheEntryDescriptor)
{
switch(cacheEntryDescriptor.deviceID)
@ -410,19 +413,13 @@ function makeGeneralTab()
sourceText = cacheEntryDescriptor.deviceID;
break;
}
pageSize = cacheEntryDescriptor.dataSize;
kbSize = pageSize / 1024;
sizeText = theBundle.getFormattedString("generalSize", [Math.round(kbSize*100)/100, pageSize]);
expirationText = formatDate(cacheEntryDescriptor.expirationTime*1000, gStrings.notSet);
}
}
catch(ex)
{
try
{
cacheEntryDescriptor = ftpCacheSession.openCacheEntry(url, Components.interfaces.nsICache.ACCESS_READ, false);
cacheEntryDescriptor = ftpCacheSession.openCacheEntry(cacheKey, Components.interfaces.nsICache.ACCESS_READ, false);
if (cacheEntryDescriptor)
{
switch(cacheEntryDescriptor.deviceID)
@ -437,22 +434,25 @@ function makeGeneralTab()
sourceText = cacheEntryDescriptor.deviceID;
break;
}
pageSize = cacheEntryDescriptor.dataSize;
kbSize = pageSize / 1024;
sizeText = theBundle.getFormattedString("generalSize", [Math.round(kbSize*100)/100, pageSize]);
expirationText = formatDate(cacheEntryDescriptor.expirationTime*1000, gStrings.notSet);
}
}
catch(ex2)
{
sourceText = theBundle.getString("generalNotCached");
}
}
document.getElementById("sourcetext").value = sourceText;
document.getElementById("expirestext").value = expirationText;
document.getElementById("sizetext").value = sizeText;
if (cacheEntryDescriptor)
{
pageSize = cacheEntryDescriptor.dataSize;
kbSize = pageSize / 1024;
sizeText = theBundle.getFormattedString("generalSize", [formatNumber(Math.round(kbSize*100)/100), formatNumber(pageSize)]);
expirationText = formatDate(cacheEntryDescriptor.expirationTime*kmsPerSec, gStrings.notSet);
}
setItemValue("sourcetext", sourceText, theBundle.getString("generalNotCached"));
setItemValue("expirestext", expirationText, gStrings.noExpiration);
setItemValue("sizetext", sizeText, gStrings.unknown);
}
//******** Generic Build-a-tab
@ -479,27 +479,16 @@ function makeTabs(aDocument, aWindow)
imageTree.treeBoxObject.view = imageView;
var iterator = aDocument.createTreeWalker(aDocument, NodeFilter.SHOW_ELEMENT, grabAll, true);
var meter = document.getElementById("piProgress");
meter.setAttribute("value", 1);
setTimeout(doGrab, 1, iterator, meter, 0);
setTimeout(doGrab, 16, iterator);
}
function doGrab(iterator, meter, i)
function doGrab(iterator)
{
if (iterator.nextNode())
{
setTimeout(doGrab, 1, iterator, meter, i);
}
else
{
meter.setAttribute("value", 0);
meter.setAttribute("mode", "determined");
meter.setAttribute("hidden", "true");
document.getElementById("piSpacer").setAttribute("flex", 1);
}
for (var i = 0; i < 50; ++i)
if (!iterator.nextNode())
return;
setTimeout(doGrab, 16, iterator);
}
function ensureSelection(view)
@ -512,8 +501,6 @@ function ensureSelection(view)
function grabAll(elem)
{
var linktext;
// check for background images, any node may have one
var url = elem.ownerDocument.defaultView.getComputedStyle(elem, "").getPropertyCSSValue("background-image");
if (url && url.primitiveType == CSSPrimitiveValue.CSS_URI)
@ -521,44 +508,49 @@ function grabAll(elem)
// one swi^H^H^Hif-else to rule them all
if (elem instanceof nsIAnchorElement)
{
linktext = getValueText(elem);
linkView.addRow([linktext, getAbsoluteURL(elem.href, elem), gStrings.linkAnchor, elem.target, elem.accessKey]);
}
linkView.addRow([getValueText(elem), elem.href, gStrings.linkAnchor, elem.target, elem.accessKey]);
else if (elem instanceof nsIImageElement)
{
imageView.addRow([getAbsoluteURL(elem.src, elem), gStrings.mediaImg, (elem.hasAttribute("alt")) ? elem.alt : gStrings.notSet, elem, false]);
}
imageView.addRow([elem.src, gStrings.mediaImg, (elem.hasAttribute("alt")) ? elem.alt : gStrings.notSet, elem, false]);
else if (elem instanceof nsIAreaElement)
{
linkView.addRow([elem.alt, getAbsoluteURL(elem.href, elem), gStrings.linkArea, elem.target]);
}
linkView.addRow([elem.alt, elem.href, gStrings.linkArea, elem.target]);
else if (elem instanceof nsILinkElement)
{
if (elem.rel)
{
var rel = elem.rel;
if (/\bicon\b/i.test(rel))
imageView.addRow([getAbsoluteURL(elem.href, elem), gStrings.mediaLink, "", elem, false]);
imageView.addRow([elem.href, gStrings.mediaLink, "", elem, false]);
else if (/\bstylesheet\b/i.test(rel))
linkView.addRow([elem.rel, getAbsoluteURL(elem.href, elem), gStrings.linkStylesheet, elem.target]);
linkView.addRow([elem.rel, elem.href, gStrings.linkStylesheet, elem.target]);
else
linkView.addRow([elem.rel, getAbsoluteURL(elem.href, elem), gStrings.linkRel, elem.target]);
linkView.addRow([elem.rel, elem.href, gStrings.linkRel, elem.target]);
}
else
linkView.addRow([elem.rev, getAbsoluteURL(elem.href, elem), gStrings.linkRev, elem.target]);
linkView.addRow([elem.rev, elem.href, gStrings.linkRev, elem.target]);
}
else if (elem instanceof nsIInputElement)
else if (elem instanceof nsIInputElement || elem instanceof nsIButtonElement)
{
if (/^image$/i.test(elem.type))
imageView.addRow([getAbsoluteURL(elem.src, elem), gStrings.mediaInput, (elem.hasAttribute("alt")) ? elem.alt : gStrings.notSet, elem, false]);
else if (/^submit$/i.test(elem.type))
linkView.addRow([elem.value || gStrings.linkSubmit, getAbsoluteURL(elem.form.getAttribute("action"), elem), gStrings.linkSubmission, elem.form.getAttribute("target")]); // use getAttribute() due to bug 122128
switch (elem.type.toLowerCase())
{
case "image":
imageView.addRow([elem.src, gStrings.mediaInput, (elem.hasAttribute("alt")) ? elem.alt : gStrings.notSet, elem, false]);
// Fall through, <input type="image"> submits, too
case "submit":
// Form element properties can be hidden by child elements with the same name, so
// we need to use a special access method, XPCNativeWrapper, to get their real values
if ("form" in elem && elem.form)
{
var formWrapper = new XPCNativeWrapper(elem.form, "target", "action");
linkView.addRow([elem.value || getValueText(elem) || gStrings.linkSubmit, formWrapper.action, gStrings.linkSubmission, formWrapper.target]);
}
else
linkView.addRow([elem.value || getValueText(elem) || gStrings.linkSubmit, '', gStrings.linkSubmission, '']);
}
}
else if (elem instanceof nsIFormElement)
{
formView.addRow([elem.name, elem.method, getAbsoluteURL(elem.getAttribute("action"), elem), elem]); // use getAttribute() because of bug 122128
formWrapper = new XPCNativeWrapper(elem, "name", "method", "action");
formView.addRow([formWrapper.name, formWrapper.method, formWrapper.action, elem]);
}
else if (elem instanceof nsIAppletElement)
{
@ -567,22 +559,18 @@ function grabAll(elem)
// content from two hosts (bug 136539) so just drop applets from Page Info when
// Java is on. For the 1.0.1 branch; get a real fix on the trunk.
if (!navigator.javaEnabled())
imageView.addRow([getAbsoluteURL(elem.code || elem.object, elem), gStrings.mediaApplet, "", elem, false]);
imageView.addRow([elem.code || elem.object, gStrings.mediaApplet, "", elem, false]);
}
else if (elem instanceof nsIObjectElement)
{
imageView.addRow([getAbsoluteURL(elem.data, elem), gStrings.mediaObject, getValueText(elem), elem, false]);
}
imageView.addRow([elem.data, gStrings.mediaObject, getValueText(elem), elem, false]);
else if (elem instanceof nsIEmbedElement)
{
imageView.addRow([getAbsoluteURL(elem.src, elem), gStrings.mediaEmbed, "", elem, false]);
}
imageView.addRow([elem.src, gStrings.mediaEmbed, "", elem, false]);
else
if (elem.hasAttributeNS(XLinkNS, "href"))
{
linktext = getValueText(elem);
linkView.addRow([linktext, getAbsoluteURL(elem.href, elem), gStrings.linkX, ""]);
}
linkView.addRow([getValueText(elem),
ioService.newURI(elem.getAttributeNS(XLinkNS, "href"), null, elem.baseURI).spec,
gStrings.linkX,
""]);
return NodeFilter.FILTER_ACCEPT;
}
@ -602,24 +590,25 @@ function onFormSelect()
var clickedRow = formView.selection.currentIndex;
// form-node;
var form = formView.data[clickedRow][3];
const formWrapper = new XPCNativeWrapper(form,
"name", "elements", "encoding", "target", "getElementsByTagName()");
var ft = null;
if (form.name)
ft = theBundle.getFormattedString("formTitle", [form.name]);
if (formWrapper.name)
ft = theBundle.getFormattedString("formTitle", [formWrapper.name]);
setItemValue("formenctype", formWrapper.encoding, theBundle.getString("default"));
setItemValue("formtarget", formWrapper.target, theBundle.getString("formDefaultTarget"));
document.getElementById("formname").value = ft || theBundle.getString("formUntitled");
document.getElementById("formenctype").value = form.encoding || theBundle.getString("default");
document.getElementById("formtarget").value = form.target || theBundle.getString("formDefaultTarget");
var formfields = form.elements;
var formfields = formWrapper.elements;
var length = formfields.length;
var i = 0;
var checked = theBundle.getString("formChecked");
var unchecked = theBundle.getString("formUnchecked");
for (i = 0; i < length; i++)
for (var i = 0; i < length; i++)
{
var elem = formfields[i], val;
@ -631,7 +620,7 @@ function onFormSelect()
fieldView.addRow(["", elem.name, elem.type, val]);
}
var labels = form.getElementsByTagName("label");
var labels = formWrapper.getElementsByTagName("label");
var llength = labels.length;
var label;
@ -758,43 +747,41 @@ function makePreview(row)
// image-bg
var isBG = imageView.data[row][4];
document.getElementById("imageurltext").value = url;
document.getElementById("imagetitletext").value = item.title || gStrings.notSet;
setItemValue("imageurltext", url);
var altText = null;
if (item.hasAttribute("alt") && ("alt" in item))
altText = item.alt;
else if (!isBG)
altText = getValueText(item);
if (altText == null)
altText = gStrings.notSet;
var textbox=document.getElementById("imagealttext");
// IMO all text that is not really the value text should go in italics
// What if somebody has <img alt="Not specified">? =)
// We can't use textbox.style because of bug 7639
if (!altText) {
textbox.value = gStrings.emptyString;
textbox.setAttribute("style","font-style:italic");
} else {
textbox.value = altText;
textbox.setAttribute("style","font-style:inherit");
}
document.getElementById("imagelongdesctext").value = ("longDesc" in item && item.longDesc) || gStrings.notSet;
if (item.hasAttribute("title"))
setItemValue("imagetitletext", item.title, gStrings.emptyString);
else
setItemValue("imagetitletext", null);
if (item.hasAttribute("longDesc"))
setItemValue("imagelongdesctext", item.longDesc, gStrings.emptyString);
else
setItemValue("imagelongdesctext", null);
if (item.hasAttribute("alt"))
setItemValue("imagealttext", item.alt, gStrings.emptyString);
else if (item instanceof nsIImageElement || isBG)
setItemValue("imagealttext", null);
else
setItemValue("imagealttext", getValueText(item));
// get cache info
var sourceText = theBundle.getString("generalNotCached");
var expirationText = gStrings.unknown;
var sizeText = gStrings.unknown;
var expirationText;
var sizeText;
var pageSize = 0;
var kbSize = 0;
var expirationTime = 0;
var expirationDate = null;
document.getElementById("imagesourcetext").removeAttribute("disabled");
var cacheKey = url.replace(/#.*$/, "");
try
{
var cacheEntryDescriptor = httpCacheSession.openCacheEntry(url, Components.interfaces.nsICache.ACCESS_READ, false); // open for READ, in non-blocking mode
var cacheEntryDescriptor = httpCacheSession.openCacheEntry(cacheKey, Components.interfaces.nsICache.ACCESS_READ, false); // open for READ, in non-blocking mode
if (cacheEntryDescriptor)
{
switch(cacheEntryDescriptor.deviceID)
@ -815,7 +802,7 @@ function makePreview(row)
{
try
{
cacheEntryDescriptor = ftpCacheSession.openCacheEntry(url, Components.interfaces.nsICache.ACCESS_READ, false); // open for READ, in non-blocking mode
cacheEntryDescriptor = ftpCacheSession.openCacheEntry(cacheKey, Components.interfaces.nsICache.ACCESS_READ, false); // open for READ, in non-blocking mode
if (cacheEntryDescriptor)
{
switch(cacheEntryDescriptor.deviceID)
@ -834,7 +821,6 @@ function makePreview(row)
}
catch(ex2)
{
sourceText = theBundle.getString("generalNotCached");
}
}
@ -843,39 +829,43 @@ function makePreview(row)
{
pageSize = cacheEntryDescriptor.dataSize;
kbSize = pageSize / 1024;
sizeText = theBundle.getFormattedString("generalSize", [Math.round(kbSize*100)/100, pageSize]);
sizeText = theBundle.getFormattedString("generalSize", [formatNumber(Math.round(kbSize*100)/100), formatNumber(pageSize)]);
expirationText = formatDate(cacheEntryDescriptor.expirationTime*1000, gStrings.notSet);
expirationText = formatDate(cacheEntryDescriptor.expirationTime*kmsPerSec, null);
}
var mimeType = ("type" in item && item.type) ||
("codeType" in item && item.codeType) ||
("contentType" in item && item.contentType) ||
getContentTypeFromImgRequest(item) ||
getContentTypeFromHeaders(cacheEntryDescriptor) ||
gStrings.unknown;
setItemValue("imageexpirestext", expirationText, gStrings.noExpiration);
setItemValue("imagesizetext", sizeText, gStrings.unknown);
setItemValue("imagesourcetext", sourceText, theBundle.getString("generalNotCached"));
document.getElementById("imagetypetext").value = mimeType;
document.getElementById("imagesourcetext").value = sourceText;
document.getElementById("imageexpirestext").value = expirationText;
document.getElementById("imagesizetext").value = sizeText;
var mimeType;
if (item instanceof nsIObjectElement || item instanceof nsIEmbedElement || item instanceof nsILinkElement)
mimeType = item.type;
if (!mimeType)
mimeType = getContentTypeFromImgRequest(item) ||
getContentTypeFromHeaders(cacheEntryDescriptor);
setItemValue("imagetypetext", mimeType, gStrings.unknown);
var imageContainer = document.getElementById("theimagecontainer");
var oldImage = document.getElementById("thepreviewimage");
var regex = new RegExp("^(https?|ftp|file|gopher)://");
var absoluteURL = getAbsoluteURL(url, item);
var isProtocolAllowed = regex.test(absoluteURL);
const regex = /^(https?|ftp|file|gopher|about|chrome|resource):/;
var isProtocolAllowed = regex.test(url);
if (/^data:/.test(url) && /^image\//.test(mimeType))
isProtocolAllowed = true;
var newImage = new Image();
newImage.setAttribute("id", "thepreviewimage");
var physWidth = 0, physHeight = 0;
var width = 0, height = 0;
if ((item instanceof nsILinkElement || item instanceof nsIInputElement ||
item instanceof nsIImageElement || isBG) && isProtocolAllowed)
if ((item instanceof nsILinkElement || item instanceof nsIInputElement || item instanceof nsIImageElement ||
(item instanceof nsIObjectElement && /^image\//.test(mimeType)) || isBG) && isProtocolAllowed)
{
newImage.src = absoluteURL;
physWidth = newImage.width;
physHeight = newImage.height;
newImage.setAttribute("src", url);
physWidth = newImage.width || 0;
physHeight = newImage.height || 0;
// "width" and "height" attributes must be set to newImage,
// even if there is no "width" or "height attribute in item;
@ -892,29 +882,41 @@ function makePreview(row)
newImage.width = newImage.naturalWidth;
newImage.height = newImage.naturalHeight;
}
width = newImage.width;
height = newImage.height;
document.getElementById("theimagecontainer").collapsed = false
document.getElementById("brokenimagecontainer").collapsed = true;
}
else
{
// fallback image for protocols not allowed (e.g., data: or javascript:)
// or elements not [yet] handled (e.g., object, embed). XXX blank??
newImage.src = "resource://gre/res/loading-image.gif";
newImage.width = 40;
newImage.height = 40;
// or elements not [yet] handled (e.g., object, embed).
document.getElementById("brokenimagecontainer").collapsed = false;
document.getElementById("theimagecontainer").collapsed = true;
}
var width = ("width" in item && item.width) || ("width" in newImage && newImage.width) || "0";
var height = ("height" in item && item.height) || ("height" in newImage && newImage.height) || "0";
document.getElementById("imageSize").value = theBundle.getFormattedString("mediaSize", [width, height]);
if (width != physWidth || height != physHeight)
var imageSize = document.getElementById("imageSize");
if (url)
{
document.getElementById("physSize").removeAttribute("hidden");
document.getElementById("physSize").value = theBundle.getFormattedString("mediaPhysSize", [physWidth, physHeight]);
imageSize.value = theBundle.getFormattedString("mediaSize", [formatNumber(width), formatNumber(height)]);
imageSize.removeAttribute("disabled");
}
else
document.getElementById("physSize").setAttribute("hidden", "true");
{
imageSize.value = gStrings.notSet;
imageSize.setAttribute("disabled", "true");
}
var physRow = document.getElementById("physRow");
if (width != physWidth || height != physHeight)
{
physRow.collapsed = false;
document.getElementById("physSize").value = theBundle.getFormattedString("mediaSize", [formatNumber(physWidth), formatNumber(physHeight)]);
}
else
physRow.collapsed = true;
imageContainer.removeChild(oldImage);
imageContainer.appendChild(newImage);
@ -1009,83 +1011,66 @@ function stripWS(text)
return text.replace(endRE, "");
}
function setItemValue(id, value, other)
{
var item = document.getElementById(id);
item.value = value || other || gStrings.notSet;
if (value)
item.removeAttribute("disabled");
else
item.setAttribute("disabled", "true");
}
function formatNumber(number)
{
return (+number).toLocaleString(); // coerce number to a numeric value before calling toLocaleString()
}
function formatDate(datestr, unknown)
{
var date = new Date(datestr);
return (date.valueOf()) ? dateService.FormatDateTime("", dateService.dateFormatLong, dateService.timeFormatSeconds, date.getFullYear(), date.getMonth()+1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()) : unknown;
}
/*
* Takes care of XMLBase and <base>
* url is the possibly relative url.
* node is the node where the url was given (needed for XMLBase)
*
* This function is called in many places as a workaround for bug 72524
* Once bug 72522 is fixed this code should use the Node.baseURI attribute
*
* for node==null or url=="", empty string is returned
*
* This is basically just copied from http://lxr.mozilla.org/seamonkey/source/xpfe/browser/resources/content/metadata.js,
* though I've modified it so that it doesn't assign to .spec
*/
function getAbsoluteURL(url, node)
{
if (!url || !node)
return "";
var urlArr = new Array(url);
var doc = node.ownerDocument;
if (node.nodeType == Node.ATTRIBUTE_NODE)
node = node.ownerElement;
while (node && node.nodeType == Node.ELEMENT_NODE)
{
var att = node.getAttributeNS(XMLNS, "base");
if (att != "")
urlArr.unshift(att);
node = node.parentNode;
}
// Look for a <base>.
var baseTags = doc.getElementsByTagNameNS(XHTMLNS, "base");
if (baseTags && baseTags.length)
{
urlArr.unshift(baseTags[baseTags.length - 1].getAttribute("href"));
}
// resolve everything from bottom up, starting with document location
var ioService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
var URL = ioService.newURI(doc.location.href, null, null);
for (var i=0; i<urlArr.length; i++)
{
try
{
URL = ioService.newURI(urlArr[i], URL.originCharset, URL);
}
catch (ex)
{
; // do nothing
}
}
return URL.spec;
}
function doCopy(event)
function doCopy()
{
if (!gClipboardHelper)
return;
var elem = event.originalTarget;
if (elem && "treeBoxObject" in elem)
elem.treeBoxObject.view.performActionOnRow("copy", elem.currentIndex);
var elem = document.commandDispatcher.focusedElement;
var text = elem.getAttribute("copybuffer");
if (text)
gClipboardHelper.copyString(text);
if (elem && "treeBoxObject" in elem)
{
var view = elem.treeBoxObject.view;
var selection = view.selection;
var text = [], tmp = '';
var min = {}, max = {};
var count = selection.getRangeCount();
for (var i = 0; i < count; i++)
{
selection.getRangeAt(i, min, max);
for (var row = min.value; row <= max.value; row++)
{
view.performActionOnRow("copy", row);
tmp = elem.getAttribute("copybuffer");
if (tmp)
text.push(tmp);
elem.removeAttribute("copybuffer");
}
}
gClipboardHelper.copyString(text.join("\n"));
}
}
function doSelectAll()
{
var elem = document.commandDispatcher.focusedElement;
if (elem && "treeBoxObject" in elem)
elem.treeBoxObject.view.selection.selectAll();
}

Просмотреть файл

@ -18,7 +18,7 @@
The Initial Developer of the Original Code is
Netscape Communications Corporation.
Portions created by the Initial Developer are Copyright (C) 1998-1999
Portions created by the Initial Developer are Copyright (C) 1998-2004
the Initial Developer. All Rights Reserved.
Contributor(s):
@ -26,6 +26,7 @@
Chris McAfee <mcafee@netscape.com>
Daniel Brooks <db48x@yahoo.com>
Gervase Markham <gerv@gerv.net>
Florian QUEZE <f.qu@laposte.net>
Alternatively, the contents of this file may be used under the terms of
either of the GNU General Public License Version 2 or later (the "GPL"),
@ -43,25 +44,19 @@
<?xml-stylesheet href="chrome://navigator/skin/pageInfo.css" type="text/css"?>
<!DOCTYPE dialog [
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
%brandDTD;
<!ENTITY % navigatorDTD SYSTEM "chrome://navigator/locale/navigator.dtd">
%navigatorDTD;
<!DOCTYPE window [
<!ENTITY % pageInfoDTD SYSTEM "chrome://navigator/locale/pageInfo.dtd">
%pageInfoDTD;
]>
<dialog id="main-window"
<window id="main-window"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
windowtype="Browser:page-info"
onload="onLoadPageInfo()"
align="stretch"
screenX="10" screenY="10"
width="&pageInfoWindow.width;" height="&pageInfoWindow.height;"
persist="screenX screenY width height sizemode"
buttons="help"
ondialoghelp="doHelpButton();">
persist="screenX screenY width height sizemode">
<script type="application/x-javascript" src="chrome://communicator/content/contentAreaUtils.js"/>
<script type="application/x-javascript" src="chrome://communicator/content/utilityOverlay.js"/>
@ -69,23 +64,38 @@
<script type="application/x-javascript" src="chrome://global/content/XPCNativeWrapper.js"/>
<script type="application/x-javascript" src="chrome://help/content/contextHelp.js"/>
<keyset>
<key id="closeWindow" key="&closeWindow.key;" modifiers="accel"
oncommand="window.close();"/>
<key id="copy" key="&copy.key;" modifiers="accel"
oncommand="doCopy(event);"/>
</keyset>
<stringbundle id="pageinfobundle" src="chrome://navigator/locale/pageInfo.properties"/>
<tabbox id="tabbox" flex="1">
<commandset>
<command id="cmd_close" oncommand="window.close();"/>
<command id="cmd_help" oncommand="doHelpButton();"/>
<command id="cmd_copy" oncommand="doCopy();"/>
<command id="cmd_selectall" oncommand="doSelectAll();"/>
</commandset>
<keyset>
<key key="&closeWindow.key;" modifiers="accel" command="cmd_close"/>
<key keycode="VK_ESCAPE" command="cmd_close"/>
<key keycode="." modifiers="meta" command="cmd_close"/>
<key keycode="VK_F1" command="cmd_help"/>
<key key="&copy.key;" modifiers="accel" command="cmd_copy"/>
<key key="&selectall.key;" modifiers="accel" command="cmd_selectall"/>
<key key="&selectall.key;" modifiers="alt" command="cmd_selectall"/>
</keyset>
<menupopup id="picontext">
<menuitem label="&selectall.label;" command="cmd_selectall" accesskey="&selectall.key;"/>
<menuitem label="&copy.label;" command="cmd_copy" accesskey="&copy.key;"/>
</menupopup>
<tabbox id="tabbox" flex="1" class="spaced">
<tabs id="tabs">
<tab id="generalTab" label="&generalTab;"/>
<tab id="formsTab" label="&formsTab;"
<tab id="generalTab" label="&generalTab;" accesskey="&generalAccesskey;"/>
<tab id="formsTab" label="&formsTab;" accesskey="&formsAccesskey;"
oncommand="ensureSelection(formView)"/>
<tab id="linksTab" label="&linksTab;"
<tab id="linksTab" label="&linksTab;" accesskey="&linksAccesskey;"
oncommand="ensureSelection(linkView)"/>
<tab id="mediaTab" label="&mediaTab;"
<tab id="mediaTab" label="&mediaTab;" accesskey="&mediaAccesskey;"
oncommand="ensureSelection(imageView)"/>
<!-- Others added by overlay -->
</tabs>
@ -156,7 +166,7 @@
</grid>
<separator class="thin"/>
<text id="metahead" class="header" value="&generalMeta;"/>
<tree id="metatree" flex="1">
<tree id="metatree" flex="1" contextmenu="picontext">
<treecols>
<treecol persist="hidden width" flex="1" id="meta-name" label="&generalMetaName;"/>
<splitter class="tree-splitter"/>
@ -168,7 +178,7 @@
<!-- Form information -->
<vbox>
<tree id="formtree" class="fixedsize" onselect="onFormSelect();">
<tree id="formtree" class="fixedsize" onselect="onFormSelect();" contextmenu="picontext">
<treecols>
<splitter class="tree-splitter"/>
<treecol sortSeparators="true" persist="hidden width" flex="1"
@ -205,7 +215,7 @@
</rows>
</grid>
<text class="header" value="&formFields;"/>
<tree id="formpreview" flex="1">
<tree id="formpreview" flex="1" contextmenu="picontext">
<treecols>
<treecol sortSeparators="true" persist="hidden width" flex="3"
width="3" id="field-label" label="&formLabel;"/>
@ -226,7 +236,7 @@
<!-- Link info -->
<vbox>
<tree id="linktree" flex="1" ondraggesture="onBeginLinkDrag(event,'link-address','link-name')">
<tree id="linktree" flex="1" ondraggesture="onBeginLinkDrag(event,'link-address','link-name')" contextmenu="picontext">
<treecols>
<treecol sortSeparators="true" persist="hidden width" flex="5"
width="5" id="link-name" label="&linkName;"/>
@ -249,7 +259,7 @@
<!-- Media information -->
<vbox>
<tree id="imagetree" class="fixedsize" onselect="onImageSelect();" ondraggesture="onBeginLinkDrag(event,'image-address','image-alt')">
<tree id="imagetree" class="fixedsize" onselect="onImageSelect();" ondraggesture="onBeginLinkDrag(event,'image-address','image-alt')" contextmenu="picontext">
<treecols>
<treecol sortSeparators="true" persist="hidden width" flex="10"
width="10" id="image-address" label="&mediaAddress;"/>
@ -314,14 +324,18 @@
<row>
<label value="&mediaDimensions;"/>
<separator/>
<vbox>
<textbox readonly="true" crop="right" id="imageSize"/>
<textbox readonly="true" crop="right" id="physSize"/>
</vbox>
<textbox readonly="true" crop="right" id="imageSize"/>
</row>
<row id="physRow" collapsed="true">
<label value="&mediaPhysDimensions;"/>
<separator/>
<textbox readonly="true" crop="right" id="physSize"/>
</row>
</rows>
</grid>
<hbox>
<hbox align="end">
<label value="&mediaPreview;" class="header"/>
<spacer flex="1"/>
<button label="&mediaSaveAs;" accesskey="&mediaSaveAs.accesskey;"
id="imagesaveasbutton" disabled="true"
oncommand="saveMedia();"/>
@ -330,6 +344,9 @@
<hbox id="theimagecontainer" pack="center">
<image id="thepreviewimage"/>
</hbox>
<hbox id="brokenimagecontainer" pack="center" collapsed="true">
<image id="brokenimage" src="resource:///res/broken-image.gif"/>
</hbox>
</vbox>
</vbox>
</vbox>
@ -337,9 +354,4 @@
<!-- Others added by overlay -->
</tabpanels>
</tabbox>
<box>
<progressmeter mode="undetermined" id="piProgress" flex="1"/>
<spacer id="piSpacer" flex="0"/>
<button dlgtype="help" class="dialog-button"/>
</box>
</dialog>
</window>

Просмотреть файл

@ -14,7 +14,7 @@
- The Original Code is Mozilla Communicator client code.
-
- The Initial Developer of the Original Code is Daniel Brooks.
- Portions created by the Initial Developer are Copyright (C) 2001
- Portions created by the Initial Developer are Copyright (C) 2001-2004
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
@ -40,17 +40,21 @@
<!ENTITY pageInfoWindow.width "425">
<!ENTITY pageInfoWindow.height "470">
<!ENTITY copy.key "c">
<!ENTITY copy.key "C">
<!ENTITY copy.label "Copy">
<!ENTITY selectall.key "A">
<!ENTITY selectall.label "Select All">
<!ENTITY closeWindow.key "w">
<!ENTITY generalTab "General">
<!ENTITY generalAccesskey "G">
<!ENTITY generalTitle "Title:">
<!ENTITY generalURL "URL:">
<!ENTITY generalURL "Address:">
<!ENTITY generalMode "Render Mode:">
<!ENTITY generalType "Type:">
<!ENTITY generalSize "Size:">
<!ENTITY generalReferrer "Referring URL:">
<!ENTITY generalSource "Source:">
<!ENTITY generalSource "Cache Source:">
<!ENTITY generalSent "Sent:">
<!ENTITY generalModified "Modified:">
<!ENTITY generalExpires "Expires:">
@ -60,6 +64,7 @@
<!ENTITY generalMetaContent "Content">
<!ENTITY formsTab "Forms">
<!ENTITY formsAccesskey "F">
<!ENTITY formAction "Form Action">
<!ENTITY formMethod "Method">
<!ENTITY formName "Name">
@ -73,6 +78,7 @@
<!ENTITY formCValue "Current Value">
<!ENTITY linksTab "Links">
<!ENTITY linksAccesskey "L">
<!ENTITY linkNo "No.">
<!ENTITY linkName "Name">
<!ENTITY linkAddress "Address">
@ -81,9 +87,10 @@
<!ENTITY linkAccessKey "Access Key">
<!ENTITY mediaTab "Media">
<!ENTITY mediaAccesskey "M">
<!ENTITY mediaHeader "Images on this page">
<!ENTITY mediaURL "URL:">
<!ENTITY mediaBase "Base URL:">
<!ENTITY mediaURL "Address:">
<!ENTITY mediaBase "Base Address:">
<!ENTITY mediaAlt "Alternate Text:">
<!ENTITY mediaAltHeader "Alternate Text">
<!ENTITY mediaNo "No.">
@ -92,14 +99,17 @@
<!ENTITY mediaType "Type">
<!ENTITY mediaPlugin "Plugin:">
<!ENTITY mediaCharset "Encoding:">
<!ENTITY mediaDimensions "Dimensions:">
<!ENTITY mediaDimensions "Specified Dimensions:">
<!ENTITY mediaPhysDimensions "Actual Dimensions:">
<!ENTITY mediaEncryption "Encryption:">
<!ENTITY mediaTitle "Title Attribute:">
<!ENTITY mediaTitle "Title:">
<!ENTITY mediaLongdesc "Long Description:">
<!ENTITY mediaSaveAs "Save As...">
<!ENTITY mediaSaveAs.accesskey "S">
<!ENTITY mediaPreview "Media Preview:">
<!ENTITY framesTab "Frames">
<!ENTITY framesTab.accesskey "r">
<!ENTITY frameName "Name">
<!ENTITY frameAddress "Address">
<!ENTITY frameType "Type">

Просмотреть файл

@ -1,87 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# International Business Machines Corporation.
# Portions created by the Initial Developer are Copyright (C) 2000
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Daniel Brooks <db48x@yahoo.com>
# Mike Kowalski <mikejk@ameritech.net>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
pageInfo.title=Page Info
frameInfo.title=Frame Info
noPageTitle=Untitled Page
pageTitle=%S:
unknown=Unknown
default=Default
notset=Not Specified
emptystring=Empty String
generalNotCached=(not cached)
generalNoExpiration=(no expiration set)
generalQuirksMode=Quirks mode
generalStrictMode=Standards compliance mode
generalNoReferrer=(no referrer)
formTitle=Form %S:
formUntitled=Unnamed Form:
formDefaultTarget=None (opens in same window)
formChecked=Checked
formUnchecked=Unchecked
formPassword=********
linkAnchor=Anchor
linkArea=Area
linkSubmission=Form Submission
linkSubmit=Submit Query
linkRel=Related Link
linkStylesheet=Stylesheet
linkRev=Reverse Link
linkX=Simple XLink
mediaImg=Image
mediaBGImg=Background
mediaApplet=Applet
mediaObject=Object
mediaEmbed=Embed
mediaLink=Icon
mediaInput=Input
mediaSize=Width: %Spx, Height: %Spx
mediaPhysSize=Physical Width: %Spx, Physical Height: %Spx
generalDiskCache=Disk Cache
generalMemoryCache=Memory Cache
generalHTTPCache=HTTP Cache
generalFTPCache=FTP Cache
generalSize=%S KB (%S bytes)