Bug 221597: remove comm.jar dependencies in browser.js by forking metadata.xul (now: metaData.xul)
move pageInfo.css into skin. git-svn-id: svn://10.0.0.236/trunk@148069 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
4bbbf7ee2c
commit
4f59b6c5fa
@ -3215,7 +3215,6 @@ nsContextMenu.prototype = {
|
||||
( 'dateTime' in elem && elem.dateTime ) ) ) ||
|
||||
( 'title' in elem && elem.title ) ||
|
||||
( 'lang' in elem && elem.lang ) ) {
|
||||
dump("On metadata item.\n");
|
||||
this.onMetaDataItem = true;
|
||||
}
|
||||
}
|
||||
@ -3429,7 +3428,7 @@ nsContextMenu.prototype = {
|
||||
},
|
||||
// Open Metadata window for node
|
||||
showMetadata : function () {
|
||||
window.openDialog( "chrome://navigator/content/metadata.xul",
|
||||
window.openDialog( "chrome://browser/content/metaData.xul",
|
||||
"_blank",
|
||||
"scrollbars,resizable,chrome,dialog=no",
|
||||
this.target);
|
||||
|
||||
622
mozilla/browser/base/content/metaData.js
Normal file
622
mozilla/browser/base/content/metaData.js
Normal file
@ -0,0 +1,622 @@
|
||||
# -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
#
|
||||
# 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 this file as it was released on
|
||||
# January 3, 2001.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Jonas Sicking.
|
||||
# Portions created by Jonas Sicking are Copyright (C) 2000
|
||||
# Jonas Sicking. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Jonas Sicking <sicking@bigfoot.com> (Original Author)
|
||||
# Gervase Markham <gerv@gerv.net>
|
||||
# Heikki Toivonen <heikki@netscape.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the
|
||||
# terms of the GNU General Public License Version 2 or later (the
|
||||
# "GPL"), in which case the provisions of the GPL are applicable
|
||||
# instead of those above. If you wish to allow use of your
|
||||
# version of this file only under the terms of the GPL and not to
|
||||
# allow others to use your version of this file under the MPL,
|
||||
# indicate your decision by deleting the provisions above and
|
||||
# replace them with the notice and other provisions required by
|
||||
# the GPL. If you do not delete the provisions above, a recipient
|
||||
# may use your version of this file under either the MPL or the
|
||||
# GPL.
|
||||
#
|
||||
|
||||
const XLinkNS = "http://www.w3.org/1999/xlink";
|
||||
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
const XMLNS = "http://www.w3.org/XML/1998/namespace";
|
||||
const XHTMLNS = "http://www.w3.org/1999/xhtml";
|
||||
var gMetadataBundle;
|
||||
var gLangBundle;
|
||||
var gRegionBundle;
|
||||
var nodeView;
|
||||
var htmlMode = false;
|
||||
|
||||
var onLink = false;
|
||||
var onImage = false;
|
||||
var onInsDel = false;
|
||||
var onQuote = false;
|
||||
var onMisc = false;
|
||||
var onTable = false;
|
||||
var onTitle = false;
|
||||
var onLang = false;
|
||||
|
||||
const nsICacheService = Components.interfaces.nsICacheService;
|
||||
const cacheService = Components.classes["@mozilla.org/network/cache-service;1"]
|
||||
.getService(nsICacheService);
|
||||
var httpCacheSession = cacheService.createSession("HTTP", 0, true);
|
||||
httpCacheSession.doomEntriesIfExpired = false;
|
||||
var ftpCacheSession = cacheService.createSession("FTP", 0, true);
|
||||
ftpCacheSession.doomEntriesIfExpired = false;
|
||||
|
||||
|
||||
function onLoad()
|
||||
{
|
||||
gMetadataBundle = document.getElementById("bundle_metadata");
|
||||
gLangBundle = document.getElementById("bundle_languages");
|
||||
gRegionBundle = document.getElementById("bundle_regions");
|
||||
|
||||
showMetadataFor(window.arguments[0]);
|
||||
nodeView = window.arguments[0].ownerDocument.defaultView;
|
||||
}
|
||||
|
||||
function showMetadataFor(elem)
|
||||
{
|
||||
// skip past non-element nodes
|
||||
while (elem && elem.nodeType != Node.ELEMENT_NODE)
|
||||
elem = elem.parentNode;
|
||||
|
||||
if (!elem) {
|
||||
alert(gMetadataBundle.getString("unableToShowProps"));
|
||||
window.close();
|
||||
}
|
||||
|
||||
if (elem.ownerDocument.getElementsByName && !elem.ownerDocument.namespaceURI)
|
||||
htmlMode = true;
|
||||
|
||||
// htmllocalname is "" if it's not an html tag, or the name of the tag if it is.
|
||||
var htmllocalname = "";
|
||||
if (isHTMLElement(elem,"")) {
|
||||
htmllocalname = elem.localName.toLowerCase();
|
||||
}
|
||||
|
||||
// We only look for images once
|
||||
checkForImage(elem, htmllocalname);
|
||||
|
||||
// Walk up the tree, looking for elements of interest.
|
||||
// Each of them could be at a different level in the tree, so they each
|
||||
// need their own boolean to tell us to stop looking.
|
||||
while (elem && elem.nodeType == Node.ELEMENT_NODE) {
|
||||
if (!onLink) checkForLink(elem, htmllocalname);
|
||||
if (!onInsDel) checkForInsDel(elem, htmllocalname);
|
||||
if (!onQuote) checkForQuote(elem, htmllocalname);
|
||||
if (!onTable) checkForTable(elem, htmllocalname);
|
||||
if (!onTitle) checkForTitle(elem, htmllocalname);
|
||||
if (!onLang) checkForLang(elem, htmllocalname);
|
||||
|
||||
elem = elem.parentNode;
|
||||
|
||||
htmllocalname = "";
|
||||
if (isHTMLElement(elem,"")) {
|
||||
htmllocalname = elem.localName.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
// Decide which sections to show
|
||||
var onMisc = onTable || onTitle || onLang;
|
||||
if (!onMisc) hideNode("misc-sec");
|
||||
if (!onLink) hideNode("link-sec");
|
||||
if (!onImage) hideNode("image-sec");
|
||||
if (!onInsDel) hideNode("insdel-sec");
|
||||
if (!onQuote) hideNode("quote-sec");
|
||||
|
||||
// Fix the Misc section visibilities
|
||||
if (onMisc) {
|
||||
if (!onTable) hideNode("misc-tblsummary");
|
||||
if (!onLang) hideNode("misc-lang");
|
||||
if (!onTitle) hideNode("misc-title");
|
||||
}
|
||||
|
||||
// Get rid of the "No properties" message. This is a backstop -
|
||||
// it should really never show, as long as nsContextMenu.js's
|
||||
// checking doesn't get broken.
|
||||
if (onLink || onImage || onInsDel || onQuote || onMisc)
|
||||
hideNode("no-properties")
|
||||
}
|
||||
|
||||
|
||||
function checkForImage(elem, htmllocalname)
|
||||
{
|
||||
var img;
|
||||
var imgType; // "img" = <img>
|
||||
// "object" = <object>
|
||||
// "input" = <input type=image>
|
||||
// "background" = css background (to be added later)
|
||||
var ismap = false;
|
||||
|
||||
if (htmllocalname === "img") {
|
||||
img = elem;
|
||||
imgType = "img";
|
||||
|
||||
} else if (htmllocalname === "object" &&
|
||||
elem.type.substring(0,6) == "image/" &&
|
||||
elem.data) {
|
||||
img = elem;
|
||||
imgType = "object";
|
||||
|
||||
} else if (htmllocalname === "input" &&
|
||||
elem.type.toUpperCase() == "IMAGE") {
|
||||
img = elem;
|
||||
imgType = "input";
|
||||
|
||||
} else if (htmllocalname === "area" || htmllocalname === "a") {
|
||||
|
||||
// Clicked in image map?
|
||||
var map = elem;
|
||||
ismap = true;
|
||||
setAlt(map);
|
||||
|
||||
while (map && map.nodeType == Node.ELEMENT_NODE && !isHTMLElement(map,"map") )
|
||||
map = map.parentNode;
|
||||
|
||||
if (map && map.nodeType == Node.ELEMENT_NODE) {
|
||||
img = getImageForMap(map);
|
||||
var imgLocalName = img && img.localName.toLowerCase();
|
||||
if (imgLocalName == "img" || imgLocalName == "object")
|
||||
imgType = imgLocalName;
|
||||
}
|
||||
}
|
||||
|
||||
if (img) {
|
||||
|
||||
var imgURL = imgType == "object" ? img.data : img.src;
|
||||
setInfo("image-url", imgURL);
|
||||
var size = getSize(imgURL);
|
||||
|
||||
if (size != -1) {
|
||||
var kbSize = size / 1024;
|
||||
kbSize = Math.round(kbSize*100)/100;
|
||||
setInfo("image-filesize", gMetadataBundle.getFormattedString("imageSize", [kbSize, size]));
|
||||
} else {
|
||||
setInfo("image-filesize", gMetadataBundle.getString("imageSizeUnknown"));
|
||||
}
|
||||
if ("width" in img && img.width != "") {
|
||||
setInfo("image-width", gMetadataBundle.getFormattedString("imageWidth", [ img.width ]));
|
||||
setInfo("image-height", gMetadataBundle.getFormattedString("imageHeight", [ img.height ]));
|
||||
}
|
||||
else {
|
||||
setInfo("image-width", "");
|
||||
setInfo("image-height", "");
|
||||
}
|
||||
|
||||
if (imgType == "img") {
|
||||
setInfo("image-desc", getAbsoluteURL(img.longDesc, img));
|
||||
} else {
|
||||
setInfo("image-desc", "");
|
||||
}
|
||||
|
||||
onImage = true;
|
||||
}
|
||||
|
||||
if (!ismap) {
|
||||
if (imgType == "img" || imgType == "input") {
|
||||
setAlt(img);
|
||||
} else {
|
||||
hideNode("image-alt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkForLink(elem, htmllocalname)
|
||||
{
|
||||
if ((htmllocalname === "a" && elem.href != "") ||
|
||||
htmllocalname === "area") {
|
||||
|
||||
setInfo("link-lang", convertLanguageCode(elem.getAttribute("hreflang")));
|
||||
setInfo("link-url", elem.href);
|
||||
setInfo("link-type", elem.getAttribute("type"));
|
||||
setInfo("link-rel", elem.getAttribute("rel"));
|
||||
setInfo("link-rev", elem.getAttribute("rev"));
|
||||
|
||||
var target = elem.target;
|
||||
|
||||
switch (target) {
|
||||
case "_top":
|
||||
setInfo("link-target", gMetadataBundle.getString("sameWindowText"));
|
||||
break;
|
||||
case "_parent":
|
||||
setInfo("link-target", gMetadataBundle.getString("parentFrameText"));
|
||||
break;
|
||||
case "_blank":
|
||||
setInfo("link-target", gMetadataBundle.getString("newWindowText"));
|
||||
break;
|
||||
case "":
|
||||
case "_self":
|
||||
if (elem.ownerDocument != elem.ownerDocument.defaultView._content.document)
|
||||
setInfo("link-target", gMetadataBundle.getString("sameFrameText"));
|
||||
else
|
||||
setInfo("link-target", gMetadataBundle.getString("sameWindowText"));
|
||||
break;
|
||||
default:
|
||||
setInfo("link-target", "\"" + target + "\"");
|
||||
}
|
||||
|
||||
onLink = true;
|
||||
}
|
||||
|
||||
else if (elem.getAttributeNS(XLinkNS,"href") != "") {
|
||||
setInfo("link-url", getAbsoluteURL(elem.getAttributeNS(XLinkNS,"href"),elem));
|
||||
setInfo("link-lang", "");
|
||||
setInfo("link-type", "");
|
||||
setInfo("link-rel", "");
|
||||
setInfo("link-rev", "");
|
||||
|
||||
switch (elem.getAttributeNS(XLinkNS,"show")) {
|
||||
case "embed":
|
||||
setInfo("link-target", gMetadataBundle.getString("embeddedText"));
|
||||
break;
|
||||
case "new":
|
||||
setInfo("link-target", gMetadataBundle.getString("newWindowText"));
|
||||
break;
|
||||
case "":
|
||||
case "replace":
|
||||
if (elem.ownerDocument != elem.ownerDocument.defaultView._content.document)
|
||||
setInfo("link-target", gMetadataBundle.getString("sameFrameText"));
|
||||
else
|
||||
setInfo("link-target", gMetadataBundle.getString("sameWindowText"));
|
||||
break;
|
||||
default:
|
||||
setInfo("link-target", "");
|
||||
break;
|
||||
}
|
||||
|
||||
onLink = true;
|
||||
}
|
||||
}
|
||||
|
||||
function checkForInsDel(elem, htmllocalname)
|
||||
{
|
||||
if ((htmllocalname === "ins" || htmllocalname === "del") &&
|
||||
(elem.cite || elem.dateTime)) {
|
||||
setInfo("insdel-cite", getAbsoluteURL(elem.cite, elem));
|
||||
setInfo("insdel-date", elem.dateTime);
|
||||
onInsDel = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function checkForQuote(elem, htmllocalname)
|
||||
{
|
||||
if ((htmllocalname === "q" || htmllocalname === "blockquote") && elem.cite) {
|
||||
setInfo("quote-cite", getAbsoluteURL(elem.cite, elem));
|
||||
onQuote = true;
|
||||
}
|
||||
}
|
||||
|
||||
function checkForTable(elem, htmllocalname)
|
||||
{
|
||||
if (htmllocalname === "table" && elem.summary) {
|
||||
setInfo("misc-tblsummary", elem.summary);
|
||||
onTable = true;
|
||||
}
|
||||
}
|
||||
|
||||
function checkForLang(elem, htmllocalname)
|
||||
{
|
||||
if ((htmllocalname && elem.lang) || elem.getAttributeNS(XMLNS, "lang")) {
|
||||
var abbr;
|
||||
if (htmllocalname && elem.lang)
|
||||
abbr = elem.lang;
|
||||
else
|
||||
abbr = elem.getAttributeNS(XMLNS, "lang");
|
||||
|
||||
setInfo("misc-lang", convertLanguageCode(abbr));
|
||||
onLang = true;
|
||||
}
|
||||
}
|
||||
|
||||
function checkForTitle(elem, htmllocalname)
|
||||
{
|
||||
if (htmllocalname && elem.title) {
|
||||
setInfo("misc-title", elem.title);
|
||||
onTitle = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set text of node id to value
|
||||
* if value="" the node with specified id is hidden.
|
||||
* Node should be have one of these forms
|
||||
* <xul:label id="id-text" value=""/>
|
||||
* <xul:description id="id-text"/>
|
||||
*/
|
||||
function setInfo(id, value)
|
||||
{
|
||||
if (!value) {
|
||||
hideNode(id);
|
||||
return;
|
||||
}
|
||||
|
||||
var node = document.getElementById(id+"-text");
|
||||
|
||||
if (node.namespaceURI == XULNS && node.localName == "label" ||
|
||||
(node.namespaceURI == XULNS && node.localName == "textbox")) {
|
||||
node.setAttribute("value",value);
|
||||
|
||||
} else if (node.namespaceURI == XULNS && node.localName == "description") {
|
||||
while (node.hasChildNodes())
|
||||
node.removeChild(node.firstChild);
|
||||
node.appendChild(node.ownerDocument.createTextNode(value));
|
||||
}
|
||||
}
|
||||
|
||||
// Hide node with specified id
|
||||
function hideNode(id)
|
||||
{
|
||||
var style = document.getElementById(id).getAttribute("style");
|
||||
document.getElementById(id).setAttribute("style", "display:none;" + style);
|
||||
}
|
||||
|
||||
const nsIScriptSecurityManager = Components.interfaces.nsIScriptSecurityManager;
|
||||
|
||||
// opens the link contained in the node's "value" attribute.
|
||||
function openLink(node)
|
||||
{
|
||||
var url = node.getAttribute("value");
|
||||
// Security-Critical: Only links to 'safe' protocols should be functional.
|
||||
// Specifically, javascript: and data: URLs must be made non-functional
|
||||
// here, because they will run with full privilege.
|
||||
var safeurls = /^https?:|^file:|^chrome:|^resource:|^mailbox:|^imap:|^s?news:|^nntp:|^about:|^mailto:|^ftp:|^gopher:/i;
|
||||
if (safeurls.test(url)) {
|
||||
var secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"].getService()
|
||||
.QueryInterface(nsIScriptSecurityManager);
|
||||
try {
|
||||
secMan.checkLoadURIStr(nodeView._content.document.location,
|
||||
url, nsIScriptSecurityManager.STANDARD);
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
nodeView._content.document.location = url;
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Find <img> or <object> which uses an imagemap.
|
||||
* If more then one object is found we can't determine which one
|
||||
* was clicked.
|
||||
*
|
||||
* This code has to be changed once bug 1882 is fixed.
|
||||
* Once bug 72527 is fixed this code should use the .images collection.
|
||||
*/
|
||||
function getImageForMap(map)
|
||||
{
|
||||
var mapuri = "#" + map.getAttribute("name");
|
||||
var multipleFound = false;
|
||||
var img;
|
||||
|
||||
var list = getHTMLElements(map.ownerDocument, "img");
|
||||
for (var i=0; i < list.length; i++) {
|
||||
if (list.item(i).getAttribute("usemap") == mapuri) {
|
||||
if (img) {
|
||||
multipleFound = true;
|
||||
break;
|
||||
} else {
|
||||
img = list.item(i);
|
||||
imgType = "img";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
list = getHTMLElements(map.ownerDocument, "object");
|
||||
for (i = 0; i < list.length; i++) {
|
||||
if (list.item(i).getAttribute("usemap") == mapuri) {
|
||||
if (img) {
|
||||
multipleFound = true;
|
||||
break;
|
||||
} else {
|
||||
img = list.item(i);
|
||||
imgType = "object";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (multipleFound)
|
||||
img = null;
|
||||
|
||||
return img;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
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) {
|
||||
if (node.getAttributeNS(XMLNS, "base") != "")
|
||||
urlArr.unshift(node.getAttributeNS(XMLNS, "base"));
|
||||
|
||||
node = node.parentNode;
|
||||
}
|
||||
|
||||
// Look for a <base>.
|
||||
var baseTags = getHTMLElements(doc,"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++) {
|
||||
URL.spec = URL.resolve(urlArr[i]);
|
||||
}
|
||||
|
||||
return URL.spec;
|
||||
}
|
||||
|
||||
function getHTMLElements(node, name)
|
||||
{
|
||||
if (htmlMode)
|
||||
return node.getElementsByTagName(name);
|
||||
return node.getElementsByTagNameNS(XHTMLNS, name);
|
||||
}
|
||||
|
||||
// name should be in lower case
|
||||
function isHTMLElement(node, name)
|
||||
{
|
||||
if (node.nodeType != Node.ELEMENT_NODE)
|
||||
return false;
|
||||
|
||||
if (htmlMode)
|
||||
return !name || node.localName.toLowerCase() == name;
|
||||
|
||||
return (!name || node.localName == name) && node.namespaceURI == XHTMLNS;
|
||||
}
|
||||
|
||||
// This function coded according to the spec at:
|
||||
// http://www.bath.ac.uk/~py8ieh/internet/discussion/metadata.txt
|
||||
function convertLanguageCode(abbr)
|
||||
{
|
||||
if (!abbr) return "";
|
||||
var result;
|
||||
var language = "";
|
||||
var region;
|
||||
var is_region_set = false;
|
||||
var tokens = abbr.split("-");
|
||||
|
||||
if (tokens[0] === "x" || tokens[0] === "i")
|
||||
{
|
||||
// x and i prefixes mean unofficial ones. So we upper-case the first
|
||||
// word and leave the rest.
|
||||
tokens.shift();
|
||||
|
||||
if (tokens[0])
|
||||
{
|
||||
// Upper-case first letter
|
||||
language = tokens[0].substr(0, 1).toUpperCase() + tokens[0].substr(1);
|
||||
tokens.shift();
|
||||
|
||||
if (tokens[0])
|
||||
{
|
||||
// Add on the rest as space-separated strings inside the brackets
|
||||
region = tokens.join(" ");
|
||||
is_region_set = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise we treat the first as a lang, the second as a region
|
||||
// and the rest as strings.
|
||||
try
|
||||
{
|
||||
language = gLangBundle.getString(tokens[0]);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
// Language not present in lang bundle
|
||||
language = tokens[0];
|
||||
}
|
||||
|
||||
tokens.shift();
|
||||
|
||||
if (tokens[0])
|
||||
{
|
||||
try
|
||||
{
|
||||
// We don't add it on to the result immediately
|
||||
// because we want to get the spacing right.
|
||||
region = gRegionBundle.getString(tokens[0].toLowerCase());
|
||||
|
||||
tokens.shift();
|
||||
|
||||
if (tokens[0])
|
||||
{
|
||||
// Add on the rest as space-separated strings inside the brackets
|
||||
region += " " + tokens.join(" ");
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
// Region not present in region bundle
|
||||
region = tokens.join(" ");
|
||||
}
|
||||
|
||||
is_region_set = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_region_set) {
|
||||
result = gMetadataBundle.getFormattedString("languageRegionFormat",
|
||||
[language, region]);
|
||||
} else
|
||||
result = language;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Returns the size of the URL in bytes; must be cached and therefore an HTTP or FTP URL
|
||||
function getSize(url) {
|
||||
try
|
||||
{
|
||||
var cacheEntryDescriptor = httpCacheSession.openCacheEntry(url, Components.interfaces.nsICache.ACCESS_READ, false);
|
||||
if(cacheEntryDescriptor)
|
||||
return cacheEntryDescriptor.dataSize;
|
||||
}
|
||||
catch(ex) {}
|
||||
try
|
||||
{
|
||||
cacheEntryDescriptor = ftpCacheSession.openCacheEntry(url, Components.interfaces.nsICache.ACCESS_READ, false);
|
||||
if (cacheEntryDescriptor)
|
||||
return cacheEntryDescriptor.dataSize;
|
||||
}
|
||||
catch(ex) {}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function setAlt(elem) {
|
||||
var altText = document.getElementById("image-alt-text");
|
||||
if (elem.hasAttribute("alt")) {
|
||||
if (elem.alt != "") {
|
||||
altText.value = elem.alt;
|
||||
altText.setAttribute("style","font-style:inherit");
|
||||
} else {
|
||||
altText.value = gMetadataBundle.getString("altTextBlank");
|
||||
altText.setAttribute("style","font-style:italic");
|
||||
}
|
||||
} else {
|
||||
altText.value = gMetadataBundle.getString("altTextMissing");
|
||||
altText.setAttribute("style","font-style:italic");
|
||||
}
|
||||
}
|
||||
221
mozilla/browser/base/content/metaData.xul
Normal file
221
mozilla/browser/base/content/metaData.xul
Normal file
@ -0,0 +1,221 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
# 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 this file as it was released on
|
||||
# January 3, 2001.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Jonas Sicking.
|
||||
# Portions created by Jonas Sicking are Copyright (C) 2000
|
||||
# Jonas Sicking. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Jonas Sicking <sicking@bigfoot.com> (Original Author)
|
||||
# Gervase Markham <gerv@gerv.net>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the
|
||||
# terms of the GNU General Public License Version 2 or later (the
|
||||
# "GPL"), in which case the provisions of the GPL are applicable
|
||||
# instead of those above. If you wish to allow use of your
|
||||
# version of this file only under the terms of the GPL and not to
|
||||
# allow others to use your version of this file under the MPL,
|
||||
# indicate your decision by deleting the provisions above and
|
||||
# replace them with the notice and other provisions required by
|
||||
# the GPL. If you do not delete the provisions above, a recipient
|
||||
# may use your version of this file under either the MPL or the
|
||||
# GPL.
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/pageInfo.css" type="text/css"?>
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://browser/locale/metaData.dtd" >
|
||||
|
||||
<window id="metadata"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&caption.label;"
|
||||
onload="onLoad()"
|
||||
class="dialog"
|
||||
minwidth="350"
|
||||
persist="screenX screenY"
|
||||
screenX="24" screenY="24">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://browser/content/metaData.js"/>
|
||||
|
||||
<keyset id="dialogKeys"/>
|
||||
|
||||
<stringbundle src="chrome://browser/locale/metaData.properties" id="bundle_metadata"/>
|
||||
<stringbundle src="chrome://global/locale/languageNames.properties" id="bundle_languages"/>
|
||||
<stringbundle src="chrome://global/locale/regionNames.properties" id="bundle_regions"/>
|
||||
|
||||
<label id="no-properties" value="&no-properties.label;"/>
|
||||
|
||||
<vbox id="link-sec">
|
||||
<label value="&link-sec.label;"/>
|
||||
<separator class="groove"/>
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
<column flex="1"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row id="link-url">
|
||||
<separator orient="vertical"/>
|
||||
<label value="&link-url.label; "/>
|
||||
<textbox readonly="true" id="link-url-text"/>
|
||||
</row>
|
||||
<row id="link-target">
|
||||
<separator orient="vertical"/>
|
||||
<label value="&link-target.label; "/>
|
||||
<textbox readonly="true" id="link-target-text"/>
|
||||
</row>
|
||||
<row id="link-type">
|
||||
<separator orient="vertical"/>
|
||||
<label value="&link-type.label; "/>
|
||||
<textbox readonly="true" id="link-type-text"/>
|
||||
</row>
|
||||
<row id="link-lang">
|
||||
<separator orient="vertical"/>
|
||||
<label value="&link-lang.label; "/>
|
||||
<textbox readonly="true" id="link-lang-text"/>
|
||||
</row>
|
||||
<row id="link-rel">
|
||||
<separator orient="vertical"/>
|
||||
<label value="&link-rel.label; "/>
|
||||
<textbox readonly="true" id="link-rel-text"/>
|
||||
</row>
|
||||
<row id="link-rev">
|
||||
<separator orient="vertical"/>
|
||||
<label value="&link-rev.label; "/>
|
||||
<textbox readonly="true" id="link-rev-text"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<separator/>
|
||||
</vbox>
|
||||
<vbox id="image-sec">
|
||||
<label value="&image-sec.label;"/>
|
||||
<separator class="groove"/>
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
<column flex="1"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row id="image-url">
|
||||
<separator orient="vertical"/>
|
||||
<label value="&image-url.label; "/>
|
||||
<textbox readonly="true" id="image-url-text"/>
|
||||
</row>
|
||||
<row id="image-width">
|
||||
<separator orient="vertical"/>
|
||||
<label value="&image-width.label; "/>
|
||||
<textbox readonly="true" id="image-width-text"/>
|
||||
</row>
|
||||
<row id="image-height">
|
||||
<separator orient="vertical"/>
|
||||
<label value="&image-height.label; "/>
|
||||
<textbox readonly="true" id="image-height-text"/>
|
||||
</row>
|
||||
<row id="image-filesize">
|
||||
<separator orient="vertical"/>
|
||||
<label value="&image-filesize.label; "/>
|
||||
<textbox readonly="true" id="image-filesize-text"/>
|
||||
</row>
|
||||
<row id="image-alt">
|
||||
<separator orient="vertical"/>
|
||||
<label value="&image-alt.label; "/>
|
||||
<textbox readonly="true" id="image-alt-text"/>
|
||||
</row>
|
||||
<row id="image-desc">
|
||||
<separator orient="vertical"/>
|
||||
<label value="&image-desc.label; "/>
|
||||
<textbox readonly="true" id="image-desc-text"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<separator/>
|
||||
</vbox>
|
||||
<vbox id="insdel-sec">
|
||||
<label value="&insdel-sec.label;"/>
|
||||
<separator class="groove"/>
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
<column flex="1"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row id="insdel-cite">
|
||||
<separator orient="vertical"/>
|
||||
<label value="&insdel-cite.label; "/>
|
||||
<textbox readonly="true" id="insdel-cite-text"/>
|
||||
</row>
|
||||
<row id="insdel-date">
|
||||
<separator orient="vertical"/>
|
||||
<label value="&insdel-date.label; "/>
|
||||
<textbox readonly="true" id="insdel-date-text"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<separator/>
|
||||
</vbox>
|
||||
<vbox id="quote-sec">
|
||||
<label value=""e-sec.label;"/>
|
||||
<separator class="groove"/>
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
<column flex="1"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row id="quote-cite">
|
||||
<separator orient="vertical"/>
|
||||
<label value=""e-cite.label; "/>
|
||||
<textbox readonly="true" id="quote-cite-text"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<separator/>
|
||||
</vbox>
|
||||
<vbox id="misc-sec">
|
||||
<label value="&misc-sec.label;"/>
|
||||
<separator class="groove"/>
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
<column flex="1"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row id="misc-lang">
|
||||
<separator orient="vertical"/>
|
||||
<label value="&misc-lang.label; "/>
|
||||
<textbox readonly="true" id="misc-lang-text"/>
|
||||
</row>
|
||||
<row id="misc-title">
|
||||
<separator orient="vertical"/>
|
||||
<label value="&misc-title.label; "/>
|
||||
<textbox readonly="true" id="misc-title-text"/>
|
||||
</row>
|
||||
<row id="misc-tblsummary">
|
||||
<separator orient="vertical"/>
|
||||
<label value="&misc-tblsummary.label; "/>
|
||||
<textbox readonly="true" id="misc-tblsummary-text"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<separator/>
|
||||
</vbox>
|
||||
</window>
|
||||
@ -22,7 +22,8 @@
|
||||
# Chris McAfee <mcafee@netscape.com>
|
||||
# Daniel Brooks <db48x@yahoo.com>
|
||||
# Gervase Markham <gerv@gerv.net>
|
||||
<?xml-stylesheet href="chrome://browser/content/pageInfo.css" type="text/css"?>
|
||||
|
||||
<?xml-stylesheet href="chrome://browser/skin/pageInfo.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % pageInfoDTD SYSTEM "chrome://browser/locale/pageInfo.dtd">
|
||||
|
||||
@ -1,36 +1,41 @@
|
||||
browser.jar:
|
||||
content/browser/contents.rdf (content/contents.rdf)
|
||||
* content/browser/hiddenWindow.xul (content/hiddenWindow.xul)
|
||||
* content/browser/macBrowserOverlay.xul (content/macBrowserOverlay.xul)
|
||||
* content/browser/browser.xul (content/browser.xul)
|
||||
* content/browser/browser.js (content/browser.js)
|
||||
content/browser/browser.css (content/browser.css)
|
||||
* content/browser/utilityOverlay.js (content/utilityOverlay.js)
|
||||
content/browser/about.png (content/about.png)
|
||||
* content/browser/aboutDialog.xul (content/aboutDialog.xul)
|
||||
* content/browser/openLocation.xul (content/openLocation.xul)
|
||||
* content/browser/openLocation.js (content/openLocation.js)
|
||||
* content/browser/pageReport.xul (content/pageReport.xul)
|
||||
* content/browser/pageReport.js (content/pageReport.js)
|
||||
* content/browser/pageReportFirstTime.xul (content/pageReportFirstTime.xul)
|
||||
content/browser/search.xml (content/search.xml)
|
||||
content/browser/printPreviewBindings.xml (content/printPreviewBindings.xml)
|
||||
content/browser/browser.css (content/browser.css)
|
||||
* content/browser/browser.js (content/browser.js)
|
||||
* content/browser/browser.xul (content/browser.xul)
|
||||
* content/browser/contentAreaUtils.js (content/contentAreaUtils.js)
|
||||
* content/browser/pageInfo.xul (content/pageInfo.xul)
|
||||
* content/browser/hiddenWindow.xul (content/hiddenWindow.xul)
|
||||
* content/browser/macBrowserOverlay.xul (content/macBrowserOverlay.xul)
|
||||
* content/browser/metaData.js (content/metaData.js)
|
||||
* content/browser/metaData.xul (content/metaData.xul)
|
||||
* content/browser/openLocation.js (content/openLocation.js)
|
||||
* content/browser/openLocation.xul (content/openLocation.xul)
|
||||
* content/browser/pageInfo.js (content/pageInfo.js)
|
||||
content/browser/pageInfo.css (content/pageInfo.css)
|
||||
* content/browser/pageInfo.xul (content/pageInfo.xul)
|
||||
* content/browser/pageReport.js (content/pageReport.js)
|
||||
* content/browser/pageReport.xul (content/pageReport.xul)
|
||||
* content/browser/pageReportFirstTime.xul (content/pageReportFirstTime.xul)
|
||||
content/browser/printPreviewBindings.xml (content/printPreviewBindings.xml)
|
||||
content/browser/search.xml (content/search.xml)
|
||||
* content/browser/utilityOverlay.js (content/utilityOverlay.js)
|
||||
content/browser/web-panels.js (content/web-panels.js)
|
||||
content/browser/web-panels.xul (content/web-panels.xul)
|
||||
|
||||
classic.jar:
|
||||
skin/classic/browser/aboutDialog.css (skin/aboutDialog.css)
|
||||
skin/classic/browser/Bookmarks-folder.png (skin/Bookmarks-folder.png)
|
||||
skin/classic/browser/browser.css (skin/browser.css)
|
||||
skin/classic/browser/browser.xml (skin/browser.xml)
|
||||
skin/classic/browser/contents.rdf (skin/contents.rdf)
|
||||
skin/classic/browser/Bookmarks-folder.png (skin/Bookmarks-folder.png)
|
||||
skin/classic/browser/Close-tab.png (skin/Close-tab.png)
|
||||
skin/classic/browser/Go.png (skin/Go.png)
|
||||
skin/classic/browser/Info.png (skin/Info.png)
|
||||
skin/classic/browser/lock-insecure.gif (skin/lock-insecure.gif)
|
||||
skin/classic/browser/lock-mixed.gif (skin/lock-mixed.gif)
|
||||
skin/classic/browser/pageInfo.css (skin/pageInfo.css)
|
||||
skin/classic/browser/page-themes.png (skin/page-themes.png)
|
||||
skin/classic/browser/Search-bar.png (skin/Search-bar.png)
|
||||
skin/classic/browser/Secure.png (skin/Secure.png)
|
||||
skin/classic/browser/Security-broken.png (skin/Security-broken.png)
|
||||
@ -40,23 +45,22 @@ classic.jar:
|
||||
skin/classic/browser/Throbber-small.gif (skin/Throbber-small.gif)
|
||||
skin/classic/browser/Toolbar-small.png (skin/Toolbar-small.png)
|
||||
skin/classic/browser/Toolbar.png (skin/Toolbar.png)
|
||||
skin/classic/browser/lock-insecure.gif (skin/lock-insecure.gif)
|
||||
skin/classic/browser/lock-mixed.gif (skin/lock-mixed.gif)
|
||||
skin/classic/browser/page-themes.png (skin/page-themes.png)
|
||||
|
||||
en-US.jar:
|
||||
locale/en-US/browser/contents.rdf (locale/contents.rdf)
|
||||
locale/en-US/browser/aboutDialog.dtd (locale/aboutDialog.dtd)
|
||||
* locale/en-US/browser/browser.dtd (locale/browser.dtd)
|
||||
locale/en-US/browser/browser.properties (locale/browser.properties)
|
||||
locale/en-US/browser/aboutDialog.dtd (locale/aboutDialog.dtd)
|
||||
locale/en-US/browser/metaData.dtd (locale/metaData.dtd)
|
||||
locale/en-US/browser/metaData.properties (locale/metaData.properties)
|
||||
locale/en-US/browser/openLocation.dtd (locale/openLocation.dtd)
|
||||
locale/en-US/browser/openLocation.properties (locale/openLocation.properties)
|
||||
locale/en-US/browser/pageReport.dtd (locale/pageReport.dtd)
|
||||
locale/en-US/browser/pageReportFirstTime.dtd (locale/pageReportFirstTime.dtd)
|
||||
locale/en-US/browser/page-drawer.dtd (locale/page-drawer.dtd)
|
||||
* locale/en-US/browser/pageInfo.dtd (locale/pageInfo.dtd)
|
||||
locale/en-US/browser/pageInfo.properties (locale/pageInfo.properties)
|
||||
locale/en-US/browser/page-drawer.dtd (locale/page-drawer.dtd)
|
||||
locale/en-US/browser/pageReport.dtd (locale/pageReport.dtd)
|
||||
locale/en-US/browser/pageReportFirstTime.dtd (locale/pageReportFirstTime.dtd)
|
||||
|
||||
US.jar:
|
||||
locale/US/browser-region/region.properties (locale/region.properties)
|
||||
locale/US/browser-region/contents.rdf (locale/contents-region.rdf)
|
||||
locale/US/browser-region/contents.rdf (locale/contents-region.rdf)
|
||||
26
mozilla/browser/base/locale/metaData.dtd
Normal file
26
mozilla/browser/base/locale/metaData.dtd
Normal file
@ -0,0 +1,26 @@
|
||||
<!ENTITY no-properties.label "No properties set.">
|
||||
|
||||
<!ENTITY caption.label "Element Properties">
|
||||
<!ENTITY image-sec.label "Image Properties">
|
||||
<!ENTITY image-url.label "Location:">
|
||||
<!ENTITY image-desc.label "Description:">
|
||||
<!ENTITY image-alt.label "Alternate text:">
|
||||
<!ENTITY image-width.label "Width:">
|
||||
<!ENTITY image-height.label "Height:">
|
||||
<!ENTITY image-filesize.label "Size of File:">
|
||||
<!ENTITY insdel-sec.label "Insert/Delete Properties">
|
||||
<!ENTITY insdel-cite.label "Info:">
|
||||
<!ENTITY insdel-date.label "Date:">
|
||||
<!ENTITY link-sec.label "Link Properties">
|
||||
<!ENTITY link-url.label "Address:">
|
||||
<!ENTITY link-target.label "Will open in:">
|
||||
<!ENTITY link-type.label "Target type:">
|
||||
<!ENTITY link-lang.label "Target language:">
|
||||
<!ENTITY link-rel.label "Relation:">
|
||||
<!ENTITY link-rev.label "Reversed relation:">
|
||||
<!ENTITY misc-sec.label "Miscellaneous Properties">
|
||||
<!ENTITY misc-lang.label "Text language:">
|
||||
<!ENTITY misc-title.label "Title:">
|
||||
<!ENTITY misc-tblsummary.label "Table summary:">
|
||||
<!ENTITY quote-sec.label "Quote Properties">
|
||||
<!ENTITY quote-cite.label "Info:">
|
||||
15
mozilla/browser/base/locale/metaData.properties
Normal file
15
mozilla/browser/base/locale/metaData.properties
Normal file
@ -0,0 +1,15 @@
|
||||
sameWindowText=Same window
|
||||
newWindowText=New window
|
||||
parentFrameText=Parent frame
|
||||
sameFrameText=Same frame
|
||||
embeddedText=Embedded
|
||||
unableToShowProps=No properties available.
|
||||
altTextMissing=Missing
|
||||
altTextBlank=Blank
|
||||
imageSize=%S KB (%S bytes)
|
||||
imageSizeUnknown=Unknown (not cached)
|
||||
imageWidth=%Spx
|
||||
imageHeight=%Spx
|
||||
# LOCALIZATION NOTE: Next two strings are for language name representations
|
||||
# %1$S = language name, %2$S = region name
|
||||
languageRegionFormat=%1$S (%2$S)
|
||||
Loading…
x
Reference in New Issue
Block a user