Port over more trunk fixes.
git-svn-id: svn://10.0.0.236/trunk@132957 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
# the terms of any one of the NPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
#
|
||||
//******** define a js object to implement nsITreeView
|
||||
function pageInfoTreeView(columnids, copycol)
|
||||
{
|
||||
@@ -176,7 +176,7 @@ var metaView = new pageInfoTreeView(["meta-name","meta-content"], COPYCOL_META_C
|
||||
var formView = new pageInfoTreeView(["form-name","form-method","form-action","form-node"], COPYCOL_FORM_ACTION);
|
||||
var fieldView = new pageInfoTreeView(["field-label","field-field","field-type","field-value"], COPYCOL_NONE);
|
||||
var linkView = new pageInfoTreeView(["link-name","link-address","link-type"], COPYCOL_LINK_ADDRESS);
|
||||
var imageView = new pageInfoTreeView(["image-address","image-type","image-alt","image-node"], COPYCOL_IMAGE_ADDRESS);
|
||||
var imageView = new pageInfoTreeView(["image-address","image-type","image-alt","image-node", "image-bg"], COPYCOL_IMAGE_ADDRESS);
|
||||
|
||||
// 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
|
||||
@@ -245,6 +245,7 @@ function onLoadPageInfo()
|
||||
gStrings.linkRev = theBundle.getString("linkRev");
|
||||
gStrings.linkX = theBundle.getString("linkX");
|
||||
gStrings.mediaImg = theBundle.getString("mediaImg");
|
||||
gStrings.mediaBGImg = theBundle.getString("mediaBGImg");
|
||||
gStrings.mediaApplet = theBundle.getString("mediaApplet");
|
||||
gStrings.mediaObject = theBundle.getString("mediaObject");
|
||||
gStrings.mediaEmbed = theBundle.getString("mediaEmbed");
|
||||
@@ -445,7 +446,7 @@ function makeTabs(aDocument, aWindow)
|
||||
{
|
||||
var num = aWindow.frames.length;
|
||||
for (var i = 0; i < num; i++)
|
||||
makeTab(aWindow.frames[i].document, aWindow.frames[i]); // recurse through the frames
|
||||
makeTabs(aWindow.frames[i].document, aWindow.frames[i]); // recurse through the frames
|
||||
}
|
||||
|
||||
var formTree = document.getElementById("formtree");
|
||||
@@ -477,9 +478,17 @@ function makeTabs(aDocument, aWindow)
|
||||
|
||||
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)
|
||||
{
|
||||
imageView.addRow([url.getStringValue(), gStrings.mediaBGImg, gStrings.notSet, elem, true]);
|
||||
}
|
||||
|
||||
// one switch to rule them all
|
||||
// XXX: these tests should use regexes to be a little more lenient wrt whitespace, see bug 177047
|
||||
var linktext;
|
||||
switch (elem.nodeName.toLowerCase())
|
||||
{
|
||||
// form tab
|
||||
@@ -501,10 +510,10 @@ function grabAll(elem)
|
||||
case "link":
|
||||
if (elem.rel)
|
||||
{
|
||||
var rel = elem.rel.toLowerCase();
|
||||
// should this test use regexes to be a little more lenient wrt whitespace?
|
||||
if (rel == "icon") {
|
||||
imageView.addRow([elem.href, gStrings.mediaLink, "", elem]);
|
||||
var rel = elem.rel.toLowerCase();
|
||||
if (rel == "icon")
|
||||
{
|
||||
imageView.addRow([elem.href, gStrings.mediaLink, "", elem]);
|
||||
break;
|
||||
}
|
||||
if (rel == "stylesheet" || rel == "alternate stylesheet")
|
||||
@@ -720,25 +729,26 @@ function onImageSelect()
|
||||
|
||||
if (tree.treeBoxObject.selection.count == 1)
|
||||
{
|
||||
makePreview(getSelectedImage(tree));
|
||||
makePreview(tree.treeBoxObject.selection.currentIndex);
|
||||
saveAsButton.setAttribute("disabled", "false");
|
||||
}
|
||||
else
|
||||
saveAsButton.setAttribute("disabled", "true");
|
||||
}
|
||||
|
||||
function makePreview(item)
|
||||
function makePreview(row)
|
||||
{
|
||||
var url = ("src" in item && item.src) || ("code" in item && item.code)
|
||||
|| ("data" in item && item.data) || ("href" in item && item.href)
|
||||
|| gStrings.unknown; // it better have at least one of those...
|
||||
var item = getSelectedImage(document.getElementById("imagetree"));
|
||||
var url = imageView.getCellText(row, "image-address");
|
||||
var isBG = imageView.getCellText(row, "image-bg");
|
||||
|
||||
document.getElementById("imageurltext").value = url;
|
||||
document.getElementById("imagetitletext").value = item.title || gStrings.notSet;
|
||||
|
||||
var altText = null;
|
||||
if (item.hasAttribute("alt") && ("alt" in item))
|
||||
altText = item.alt;
|
||||
else if (item.hasChildNodes())
|
||||
else if (!isBG)
|
||||
altText = getValueText(item);
|
||||
if (altText == null)
|
||||
altText = gStrings.notSet;
|
||||
@@ -759,8 +769,10 @@ function makePreview(item)
|
||||
// find out the mime type
|
||||
var mimeType = gStrings.unknown;
|
||||
if (item.nodeName.toLowerCase() != "input")
|
||||
mimeType = ("type" in item && item.type) || ("codeType" in item && item.codeType)
|
||||
|| ("contentType" in item && item.contentType) || gStrings.unknown;
|
||||
mimeType = ("type" in item && item.type) ||
|
||||
("codeType" in item && item.codeType) ||
|
||||
("contentType" in item && item.contentType) ||
|
||||
gStrings.unknown;
|
||||
document.getElementById("imagetypetext").value = mimeType;
|
||||
|
||||
// get cache info
|
||||
@@ -834,21 +846,16 @@ function makePreview(item)
|
||||
document.getElementById("imageexpirestext").value = expirationText;
|
||||
document.getElementById("imagesizetext").value = sizeText;
|
||||
|
||||
var width = ("width" in item && item.width) || "";
|
||||
var height = ("height" in item && item.height) || "";
|
||||
document.getElementById("imagewidth").value = theBundle.getFormattedString("mediaWidth", [width]);
|
||||
document.getElementById("imageheight").value = theBundle.getFormattedString("mediaHeight", [height]);
|
||||
|
||||
var imageContainer = document.getElementById("theimagecontainer");
|
||||
var oldImage = document.getElementById("thepreviewimage");
|
||||
|
||||
var nn = item.nodeName.toLowerCase();
|
||||
var regex = new RegExp("^(https?|ftp|file|gopher)://");
|
||||
var absoluteURL = getAbsoluteURL(getSource(item), item);
|
||||
var absoluteURL = getAbsoluteURL(url, item);
|
||||
var isProtocolAllowed = regex.test(absoluteURL);
|
||||
var newImage = new Image();
|
||||
newImage.setAttribute("id", "thepreviewimage");
|
||||
if ((nn == "link" || nn == "input" || nn == "img") &&
|
||||
if ((nn == "link" || nn == "input" || nn == "img" || isBG) &&
|
||||
isProtocolAllowed)
|
||||
{
|
||||
newImage.src = absoluteURL;
|
||||
@@ -866,6 +873,11 @@ function makePreview(item)
|
||||
newImage.height = 40;
|
||||
}
|
||||
|
||||
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("imagewidth").value = theBundle.getFormattedString("mediaWidth", [width]);
|
||||
document.getElementById("imageheight").value = theBundle.getFormattedString("mediaHeight", [height]);
|
||||
|
||||
imageContainer.removeChild(oldImage);
|
||||
imageContainer.appendChild(newImage);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
# Chris McAfee <mcafee@netscape.com>
|
||||
# Daniel Brooks <db48x@yahoo.com>
|
||||
# Gervase Markham <gerv@gerv.net>
|
||||
|
||||
<?xml-stylesheet href="chrome://navigator/skin/pageInfo.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window [
|
||||
@@ -43,7 +42,7 @@
|
||||
screenX="10" screenY="10"
|
||||
persist="screenX screenY width height sizemode">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://browser/content/contentAreaUtils.js"/>
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/contentAreaUtils.js"/>
|
||||
<script type="application/x-javascript" src="chrome://navigator/content/pageInfo.js"/>
|
||||
<script type="application/x-javascript" src="chrome://help/content/contextHelp.js"/>
|
||||
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
<!-- ***** 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 Communicator client code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is Daniel Brooks.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2001
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
-
|
||||
- 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 LGPL or the GPL. 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 ***** -->
|
||||
# ***** 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 Communicator client code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Daniel Brooks.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# 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 LGPL or the GPL. 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 ***** -->
|
||||
|
||||
<!ENTITY preface "Info for: ">
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ linkRev=Reverse Link
|
||||
linkX=Simple XLink
|
||||
|
||||
mediaImg=Image
|
||||
mediaBGImg=Background
|
||||
mediaApplet=Applet
|
||||
mediaObject=Object
|
||||
mediaEmbed=Embed
|
||||
|
||||
Reference in New Issue
Block a user