2006-09-14 05:59:50 +00:00
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/ * * * * * * B E G I N L I C E N S E B L O C K * * * * *
* Version : NPL 1.1 / GPL 2.0 / LGPL 2.1
2006-09-14 05:48:15 +00:00
*
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
* The contents of this file are subject to the Netscape 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/NPL/
2006-09-14 05:48:15 +00:00
*
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
* 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 .
2006-09-14 05:48:15 +00:00
*
* The Original Code is mozilla . org code .
*
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
* The Initial Developer of the Original Code is Netscape
* Communications Corporation . Portions created by Netscape are
* Copyright ( C ) 1998 Netscape Communications Corporation . All
* Rights Reserved .
2006-09-14 05:48:15 +00:00
*
* Contributor ( s ) : smorrison @ gte . com
2006-09-14 05:52:03 +00:00
* Terry Hayes < thayes @ netscape . com >
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
* Daniel Brooks < db48x @ yahoo . com >
2006-09-14 05:59:50 +00:00
*
* 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 .
*
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
* * * * * * END LICENSE BLOCK * * * * *
* /
2006-09-14 06:05:46 +00:00
//******** define a js object to implement nsITreeView
function pageInfoTreeView ( columnids , copycol )
{
// columnids is an array of strings indicating the names of the columns, in order
this . columnids = columnids ;
this . colcount = columnids . length
// copycol is the index number for the column that we want to add to
// the copy-n-paste buffer when the user hits accel-c
this . copycol = copycol ;
this . rows = 0 ;
this . tree = null ;
this . data = new Array ;
this . selection = null ;
this . sortcol = null ;
this . sortdir = 0 ;
}
pageInfoTreeView . prototype = {
set rowCount ( c ) { throw "rowCount is a readonly property" ; } ,
get rowCount ( ) { return this . rows ; } ,
setTree : function ( tree )
{
this . tree = tree ;
} ,
getCellText : function ( row , column )
{
// row can be null, but js arrays are 0-indexed.
// colidx cannot be null, but can be larger than the number
// of columns in the array (when column is a string not in
// this.columnids.) In this case it's the fault of
// whoever typoed while calling this function.
2006-09-14 06:06:23 +00:00
return this . data [ row ] [ column . index ] || "" ;
} ,
setCellValue : function ( row , column , value )
{
2006-09-14 06:05:46 +00:00
} ,
setCellText : function ( row , column , value )
{
2006-09-14 06:06:23 +00:00
this . data [ row ] [ column . index ] = value ;
2006-09-14 06:05:46 +00:00
} ,
addRow : function ( row )
{
this . rows = this . data . push ( row ) ;
2006-09-14 06:06:06 +00:00
this . rowCountChanged ( this . rows - 1 , 1 ) ;
2006-09-14 06:05:46 +00:00
} ,
addRows : function ( rows )
{
var length = rows . length ;
for ( var i = 0 ; i < length ; i ++ )
this . rows = this . data . push ( rows [ i ] ) ;
2006-09-14 06:06:06 +00:00
this . rowCountChanged ( this . rows - length , length ) ;
2006-09-14 06:05:46 +00:00
} ,
rowCountChanged : function ( index , count )
{
this . tree . rowCountChanged ( index , count ) ;
} ,
invalidate : function ( )
{
this . tree . invalidate ( ) ;
} ,
clear : function ( )
{
this . data = new Array ;
this . rows = 0 ;
} ,
handleCopy : function ( row )
{
2006-09-14 06:06:01 +00:00
return ( row < 0 || this . copycol < 0 ) ? "" : ( this . data [ row ] [ this . copycol ] || "" ) ;
2006-09-14 06:05:46 +00:00
} ,
performActionOnRow : function ( action , row )
{
if ( action == "copy" )
{
var data = this . handleCopy ( row )
this . tree . treeBody . parentNode . setAttribute ( "copybuffer" , data ) ;
}
} ,
2006-09-14 06:06:23 +00:00
getRowProperties : function ( row , prop ) { } ,
getCellProperties : function ( row , column , prop ) { } ,
getColumnProperties : function ( column , prop ) { } ,
2006-09-14 06:05:46 +00:00
isContainer : function ( index ) { return false ; } ,
isContainerOpen : function ( index ) { return false ; } ,
isSeparator : function ( index ) { return false ; } ,
isSorted : function ( ) { } ,
2006-09-14 06:06:23 +00:00
canDrop : function ( index , orientation ) { return false ; } ,
2006-09-14 06:05:46 +00:00
drop : function ( row , orientation ) { return false ; } ,
getParentIndex : function ( index ) { return 0 ; } ,
hasNextSibling : function ( index , after ) { return false ; } ,
getLevel : function ( index ) { return 0 ; } ,
getImageSrc : function ( row , column ) { } ,
getProgressMode : function ( row , column ) { } ,
getCellValue : function ( row , column ) { } ,
toggleOpenState : function ( index ) { } ,
2006-09-14 06:06:23 +00:00
cycleHeader : function ( col ) { } ,
2006-09-14 06:05:46 +00:00
selectionChanged : function ( ) { } ,
cycleCell : function ( row , column ) { } ,
isEditable : function ( row , column ) { return false ; } ,
performAction : function ( action ) { } ,
performActionOnCell : function ( action , row , column ) { }
} ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
// mmm, yummy. global variables.
var theWindow = null ;
var theDocument = null ;
2006-09-14 06:05:46 +00:00
// column number to copy from, second argument to pageInfoTreeView's constructor
2006-09-14 06:05:28 +00:00
const COPYCOL _NONE = - 1 ;
const COPYCOL _META _CONTENT = 1 ;
2006-09-14 06:05:46 +00:00
const COPYCOL _FORM _ACTION = 2 ;
const COPYCOL _LINK _ADDRESS = 1 ;
const COPYCOL _IMAGE _ADDRESS = 0 ;
// one nsITreeView for each tree in the window
var metaView = new pageInfoTreeView ( [ "meta-name" , "meta-content" ] , COPYCOL _META _CONTENT ) ;
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 ) ;
2006-09-14 06:06:10 +00:00
var linkView = new pageInfoTreeView ( [ "link-name" , "link-address" , "link-type" , "link-accesskey" ] , COPYCOL _LINK _ADDRESS ) ;
2006-09-14 06:05:58 +00:00
var imageView = new pageInfoTreeView ( [ "image-address" , "image-type" , "image-alt" , "image-node" , "image-bg" ] , COPYCOL _IMAGE _ADDRESS ) ;
2006-09-14 06:05:46 +00:00
2006-09-14 06:06:06 +00:00
var intervalID = null ;
2006-09-14 06:05:46 +00:00
// 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
var gStrings = { }
var theBundle ;
2006-09-14 06:05:28 +00:00
2006-09-14 06:05:43 +00:00
const DRAGSERVICE _CONTRACTID = "@mozilla.org/widget/dragservice;1" ;
const TRANSFERABLE _CONTRACTID = "@mozilla.org/widget/transferable;1" ;
const ARRAY _CONTRACTID = "@mozilla.org/supports-array;1" ;
2006-09-14 06:05:44 +00:00
const STRING _CONTRACTID = "@mozilla.org/supports-string;1" ;
2006-09-14 06:05:43 +00:00
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
// a number of services I'll need later
// the cache services
const nsICacheService = Components . interfaces . nsICacheService ;
const cacheService = Components . classes [ "@mozilla.org/network/cache-service;1" ] . getService ( nsICacheService ) ;
var httpCacheSession = cacheService . createSession ( "HTTP" , 0 , true ) ;
2006-09-14 06:05:31 +00:00
httpCacheSession . doomEntriesIfExpired = false ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
var ftpCacheSession = cacheService . createSession ( "FTP" , 0 , true ) ;
2006-09-14 06:05:31 +00:00
ftpCacheSession . doomEntriesIfExpired = false ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
// scriptable date formater, for pretty printing dates
2006-09-14 05:59:49 +00:00
const nsIScriptableDateFormat = Components . interfaces . nsIScriptableDateFormat ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
var dateService = Components . classes [ "@mozilla.org/intl/scriptabledateformat;1" ] . getService ( nsIScriptableDateFormat ) ;
2006-09-14 06:05:28 +00:00
// clipboard helper
try
{
const gClipboardHelper = Components . classes [ "@mozilla.org/widget/clipboardhelper;1" ] . getService ( Components . interfaces . nsIClipboardHelper ) ;
}
catch ( e )
{
// do nothing, later code will handle the error
}
2006-09-14 06:06:03 +00:00
// interfaces for the different html elements
const nsIAnchorElement = Components . interfaces . nsIDOMHTMLAnchorElement
const nsIImageElement = Components . interfaces . nsIDOMHTMLImageElement
const nsIAreaElement = Components . interfaces . nsIDOMHTMLAreaElement
const nsILinkElement = Components . interfaces . nsIDOMHTMLLinkElement
const nsIInputElement = Components . interfaces . nsIDOMHTMLInputElement
const nsIFormElement = Components . interfaces . nsIDOMHTMLFormElement
const nsIAppletElement = Components . interfaces . nsIDOMHTMLAppletElement
const nsIObjectElement = Components . interfaces . nsIDOMHTMLObjectElement
const nsIEmbedElement = Components . interfaces . nsIDOMHTMLEmbedElement
const nsIButtonElement = Components . interfaces . nsIDOMHTMLButtonElement
const nsISelectElement = Components . interfaces . nsIDOMHTMLSelectElement
const nsITextareaElement = Components . interfaces . nsIDOMHTMLTextAreaElement
2006-09-14 06:06:11 +00:00
// Interface for image loading content
const nsIImageLoadingContent = Components . interfaces . nsIImageLoadingContent ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
// namespaces, don't need all of these yet...
2006-09-14 06:06:03 +00:00
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" ;
const XHTML2NS = "http://www.w3.org/2002/06/xhtml2"
const XHTMLNSre = "^http\:\/\/www\.w3\.org\/1999\/xhtml$" ;
const XHTML2NSre = "^http\:\/\/www\.w3\.org\/2002\/06\/xhtml2$" ;
const XHTMLre = RegExp ( XHTMLNSre + "|" + XHTML2NSre , "" ) ;
2006-09-14 05:59:49 +00:00
2006-09-14 05:57:12 +00:00
/ * O v e r l a y s r e g i s t e r i n i t f u n c t i o n s h e r e .
* Add functions to call by invoking "onLoadRegistry.append(XXXLoadFunc);"
* The XXXLoadFunc should be unique to the overlay module , and will be
* invoked as "XXXLoadFunc();"
* /
2006-09-14 05:52:03 +00:00
var onLoadRegistry = [ ] ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
2006-09-14 05:57:12 +00:00
/ * C a l l e d w h e n P a g e I n f o w i n d o w i s l o a d e d . A r g u m e n t s a r e :
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
* window . arguments [ 0 ] - document to use for source ( null = Page Info , otherwise Frame Info )
* window . arguments [ 1 ] - tab name to display first ( may be null )
* /
2006-09-14 05:51:57 +00:00
function onLoadPageInfo ( )
{
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
//dump("===============================================================================\n");
2006-09-14 06:05:46 +00:00
theBundle = document . getElementById ( "pageinfobundle" ) ;
gStrings . unknown = theBundle . getString ( "unknown" ) ;
gStrings . notSet = theBundle . getString ( "notset" ) ;
gStrings . emptyString = theBundle . getString ( "emptystring" ) ;
gStrings . linkAnchor = theBundle . getString ( "linkAnchor" ) ;
gStrings . linkArea = theBundle . getString ( "linkArea" ) ;
gStrings . linkSubmit = theBundle . getString ( "linkSubmit" ) ;
gStrings . linkSubmission = theBundle . getString ( "linkSubmission" ) ;
gStrings . linkRel = theBundle . getString ( "linkRel" ) ;
gStrings . linkStylesheet = theBundle . getString ( "linkStylesheet" ) ;
gStrings . linkRev = theBundle . getString ( "linkRev" ) ;
gStrings . linkX = theBundle . getString ( "linkX" ) ;
gStrings . mediaImg = theBundle . getString ( "mediaImg" ) ;
2006-09-14 06:05:58 +00:00
gStrings . mediaBGImg = theBundle . getString ( "mediaBGImg" ) ;
2006-09-14 06:05:46 +00:00
gStrings . mediaApplet = theBundle . getString ( "mediaApplet" ) ;
gStrings . mediaObject = theBundle . getString ( "mediaObject" ) ;
gStrings . mediaEmbed = theBundle . getString ( "mediaEmbed" ) ;
gStrings . mediaLink = theBundle . getString ( "mediaLink" ) ;
gStrings . mediaInput = theBundle . getString ( "mediaInput" ) ;
2006-09-14 06:01:02 +00:00
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
var docTitle = "" ;
2006-09-14 06:06:03 +00:00
if ( "arguments" in window && window . arguments . length >= 1 && window . arguments [ 0 ] )
2006-09-14 06:01:02 +00:00
{
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
theWindow = null ;
theDocument = window . arguments [ 0 ] ;
docTitle = theBundle . getString ( "frameInfo.title" ) ;
}
else
2006-09-14 06:01:02 +00:00
{
2006-09-14 06:04:44 +00:00
if ( "gBrowser" in window . opener )
theWindow = window . opener . gBrowser . contentWindow ;
else
theWindow = window . opener . frames [ 0 ] ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
theDocument = theWindow . document ;
2006-09-14 06:05:28 +00:00
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
docTitle = theBundle . getString ( "pageInfo.title" ) ;
2006-09-14 06:01:02 +00:00
}
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
document . title = docTitle ;
2006-09-14 05:48:15 +00:00
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
// do the easy stuff first
makeGeneralTab ( ) ;
2006-09-14 05:52:02 +00:00
2006-09-14 06:06:06 +00:00
// and then the hard stuff
makeTabs ( theDocument , theWindow ) ;
2006-09-14 05:52:03 +00:00
/* Call registered overlay init functions */
for ( x in onLoadRegistry )
2006-09-14 05:52:02 +00:00
{
2006-09-14 05:52:03 +00:00
onLoadRegistry [ x ] ( ) ;
2006-09-14 05:52:02 +00:00
}
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
/* Select the requested tab, if the name is specified */
if ( "arguments" in window && window . arguments . length > 1 )
{
2006-09-14 05:57:12 +00:00
var tabName = window . arguments [ 1 ] ;
2006-09-14 05:52:03 +00:00
if ( tabName )
{
2006-09-14 06:04:45 +00:00
var tabControl = document . getElementById ( "tabbox" ) ;
2006-09-14 05:52:03 +00:00
var tab = document . getElementById ( tabName ) ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
if ( tabControl && tab )
{
tabControl . selectedTab = tab ;
2006-09-14 05:52:03 +00:00
}
}
}
2006-09-14 05:48:15 +00:00
}
2006-09-14 06:05:35 +00:00
function doHelpButton ( ) {
2006-09-14 06:06:21 +00:00
var helpdoc ;
2006-09-14 06:05:35 +00:00
var tabControl = document . getElementById ( "tabbox" ) ;
switch ( tabControl . selectedTab . id ) {
case "generalTab" :
helpdoc = "pageinfo_general" ;
break ;
case "formsTab" :
helpdoc = "pageinfo_forms" ;
break ;
case "linksTab" :
helpdoc = "pageinfo_links" ;
break ;
case "mediaTab" :
helpdoc = "pageinfo_media" ;
break ;
case "securityTab" :
helpdoc = "pageinfo_security" ;
break ;
case "p3pTab" :
helpdoc = "pageinfo_privacy" ;
break ;
default :
helpdoc = "pageinfo_general" ;
break ;
}
openHelp ( helpdoc ) ;
}
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
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 mode = ( "compatMode" in theDocument && theDocument . compatMode == "BackCompat" ) ? theBundle . getString ( "generalQuirksMode" ) : theBundle . getString ( "generalStrictMode" ) ;
document . getElementById ( "modetext" ) . value = mode ;
2006-09-14 06:06:15 +00:00
var referrer = ( "referrer" in theDocument && theDocument . referrer ) || theBundle . getString ( "generalNoReferrer" ) ;
2006-09-14 06:05:33 +00:00
document . getElementById ( 'refertext' ) . value = referrer ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
// find out the mime type
2006-09-14 06:05:46 +00:00
var mimeType = theDocument . contentType || gStrings . unknown ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
document . getElementById ( "typetext" ) . value = mimeType ;
// get the meta tags
var metaNodes = theDocument . getElementsByTagName ( "meta" ) ;
2006-09-14 06:04:58 +00:00
var metaTree = document . getElementById ( "metatree" ) ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
2006-09-14 06:04:58 +00:00
metaTree . treeBoxObject . view = metaView ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
var length = metaNodes . length ;
for ( var i = 0 ; i < length ; i ++ )
metaView . addRow ( [ metaNodes [ i ] . name || metaNodes [ i ] . httpEquiv , metaNodes [ i ] . content ] ) ;
2006-09-14 06:05:46 +00:00
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
// get the document characterset
var encoding = theDocument . characterSet ;
document . getElementById ( "encodingtext" ) . value = encoding ;
// get the date of last modification
2006-09-14 06:05:46 +00:00
var modifiedText = formatDate ( theDocument . lastModified , gStrings . notSet ) ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
document . getElementById ( "modifiedtext" ) . value = modifiedText ;
// get cache info
var sourceText = theBundle . getString ( "generalNotCached" ) ;
var expirationText = theBundle . getString ( "generalNoExpiration" ) ;
2006-09-14 06:05:46 +00:00
var sizeText = gStrings . unknown ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
var pageSize = 0 ;
var kbSize = 0 ;
var expirationTime = 0 ;
try
{
2006-09-14 06:05:32 +00:00
var cacheEntryDescriptor = httpCacheSession . openCacheEntry ( url , Components . interfaces . nsICache . ACCESS _READ , false ) ;
2006-09-14 06:06:03 +00:00
if ( cacheEntryDescriptor )
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
{
switch ( cacheEntryDescriptor . deviceID )
{
case "disk" :
sourceText = theBundle . getString ( "generalDiskCache" ) ;
break ;
case "memory" :
sourceText = theBundle . getString ( "generalMemoryCache" ) ;
break ;
default :
sourceText = cacheEntryDescriptor . deviceID ;
break ;
}
pageSize = cacheEntryDescriptor . dataSize ;
kbSize = pageSize / 1024 ;
2006-09-14 06:05:30 +00:00
sizeText = theBundle . getFormattedString ( "generalSize" , [ Math . round ( kbSize * 100 ) / 100 , pageSize ] ) ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
2006-09-14 06:05:46 +00:00
expirationText = formatDate ( cacheEntryDescriptor . expirationTime * 1000 , gStrings . notSet ) ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
}
}
catch ( ex )
{
try
{
2006-09-14 06:05:32 +00:00
cacheEntryDescriptor = ftpCacheSession . openCacheEntry ( url , Components . interfaces . nsICache . ACCESS _READ , false ) ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
if ( cacheEntryDescriptor )
{
switch ( cacheEntryDescriptor . deviceID )
{
case "disk" :
sourceText = theBundle . getString ( "generalDiskCache" ) ;
break ;
case "memory" :
sourceText = theBundle . getString ( "generalMemoryCache" ) ;
break ;
default :
sourceText = cacheEntryDescriptor . deviceID ;
break ;
}
pageSize = cacheEntryDescriptor . dataSize ;
kbSize = pageSize / 1024 ;
2006-09-14 06:05:30 +00:00
sizeText = theBundle . getFormattedString ( "generalSize" , [ Math . round ( kbSize * 100 ) / 100 , pageSize ] ) ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
2006-09-14 06:05:46 +00:00
expirationText = formatDate ( cacheEntryDescriptor . expirationTime * 1000 , gStrings . notSet ) ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
}
2006-09-14 05:59:49 +00:00
}
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
catch ( ex2 )
{
sourceText = theBundle . getString ( "generalNotCached" ) ;
2006-09-14 05:59:49 +00:00
}
}
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
document . getElementById ( "sourcetext" ) . value = sourceText ;
document . getElementById ( "expirestext" ) . value = expirationText ;
document . getElementById ( "sizetext" ) . value = sizeText ;
}
2006-09-14 06:05:46 +00:00
//******** Generic Build-a-tab
2006-09-14 06:06:06 +00:00
// Assumes the views are empty. Only called once to build the tabs, and
// does so by farming the task off to another thread via setTimeout().
// The actual work is done with a TreeWalker that calls doGrab() once for
// each element node in the document.
2006-09-14 06:05:46 +00:00
function makeTabs ( aDocument , aWindow )
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
{
2006-09-14 06:05:46 +00:00
if ( aWindow && aWindow . frames . length > 0 )
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
{
2006-09-14 06:05:46 +00:00
var num = aWindow . frames . length ;
for ( var i = 0 ; i < num ; i ++ )
2006-09-14 06:05:47 +00:00
makeTabs ( aWindow . frames [ i ] . document , aWindow . frames [ i ] ) ; // recurse through the frames
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
}
2006-09-14 05:48:15 +00:00
2006-09-14 06:05:46 +00:00
var formTree = document . getElementById ( "formtree" ) ;
var linkTree = document . getElementById ( "linktree" ) ;
var imageTree = document . getElementById ( "imagetree" ) ;
formTree . treeBoxObject . view = formView ;
linkTree . treeBoxObject . view = linkView ;
imageTree . treeBoxObject . view = imageView ;
var iterator = aDocument . createTreeWalker ( aDocument , NodeFilter . SHOW _ELEMENT , grabAll , true ) ;
2006-09-14 06:06:06 +00:00
var meter = document . getElementById ( "piProgress" ) ;
meter . setAttribute ( "value" , 1 ) ;
setTimeout ( doGrab , 1 , iterator , meter , 0 ) ;
}
2006-09-14 06:05:46 +00:00
2006-09-14 06:06:06 +00:00
function doGrab ( iterator , meter , i )
{
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 ) ;
}
}
2006-09-14 06:05:46 +00:00
2006-09-14 06:06:06 +00:00
function ensureSelection ( view )
{
2006-09-14 06:06:14 +00:00
// only select something if nothing is currently selected
// and if there's anything to select
if ( view . selection . count == 0 && view . rowCount )
2006-09-14 06:06:06 +00:00
view . selection . select ( 0 ) ;
2006-09-14 05:48:15 +00:00
}
2006-09-14 06:05:46 +00:00
function grabAll ( elem )
2006-09-14 05:51:57 +00:00
{
2006-09-14 06:05:46 +00:00
var linktext ;
2006-09-14 06:05:58 +00:00
// 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 ] ) ;
2006-09-14 06:06:03 +00:00
// one swi^H^H^Hif-else to rule them all
if ( elem instanceof nsIAnchorElement )
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
{
2006-09-14 06:06:03 +00:00
linktext = getValueText ( elem ) ;
2006-09-14 06:06:10 +00:00
linkView . addRow ( [ linktext , getAbsoluteURL ( elem . href , elem ) , gStrings . linkAnchor , elem . target , elem . accessKey ] ) ;
2006-09-14 06:06:03 +00:00
}
else if ( elem instanceof nsIImageElement )
{
2006-09-14 06:06:04 +00:00
imageView . addRow ( [ getAbsoluteURL ( elem . src , elem ) , gStrings . mediaImg , ( elem . hasAttribute ( "alt" ) ) ? elem . alt : gStrings . notSet , elem , false ] ) ;
2006-09-14 06:06:03 +00:00
}
else if ( elem instanceof nsIAreaElement )
{
linkView . addRow ( [ elem . alt , getAbsoluteURL ( elem . href , elem ) , gStrings . linkArea , elem . target ] ) ;
}
else if ( elem instanceof nsILinkElement )
{
if ( elem . rel )
{
var rel = elem . rel ;
if ( /\bicon\b/i . test ( rel ) )
2006-09-14 06:06:04 +00:00
imageView . addRow ( [ getAbsoluteURL ( elem . href , elem ) , gStrings . mediaLink , "" , elem , false ] ) ;
2006-09-14 06:06:03 +00:00
else if ( /\bstylesheet\b/i . test ( rel ) )
linkView . addRow ( [ elem . rel , getAbsoluteURL ( elem . href , elem ) , gStrings . linkStylesheet , elem . target ] ) ;
2006-09-14 06:05:46 +00:00
else
2006-09-14 06:06:03 +00:00
linkView . addRow ( [ elem . rel , getAbsoluteURL ( elem . href , elem ) , gStrings . linkRel , elem . target ] ) ;
}
else
linkView . addRow ( [ elem . rev , getAbsoluteURL ( elem . href , elem ) , gStrings . linkRev , elem . target ] ) ;
2006-09-14 06:05:46 +00:00
}
2006-09-14 06:06:03 +00:00
else if ( elem instanceof nsIInputElement )
{
if ( /^image$/i . test ( elem . type ) )
2006-09-14 06:06:04 +00:00
imageView . addRow ( [ getAbsoluteURL ( elem . src , elem ) , gStrings . mediaInput , ( elem . hasAttribute ( "alt" ) ) ? elem . alt : gStrings . notSet , elem , false ] ) ;
2006-09-14 06:06:03 +00:00
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
}
else if ( elem instanceof nsIFormElement )
{
formView . addRow ( [ elem . name , elem . method , getAbsoluteURL ( elem . getAttribute ( "action" ) , elem ) , elem ] ) ; // use getAttribute() because of bug 122128
}
else if ( elem instanceof nsIAppletElement )
{
//XXX When Java is enabled, the DOM model for <APPLET> is broken. Bug #59686.
// Also, some reports of a crash with Java in Media tab (bug 136535), and mixed
// 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 ( ) )
2006-09-14 06:06:04 +00:00
imageView . addRow ( [ getAbsoluteURL ( elem . code || elem . object , elem ) , gStrings . mediaApplet , "" , elem , false ] ) ;
2006-09-14 06:06:03 +00:00
}
else if ( elem instanceof nsIObjectElement )
{
2006-09-14 06:06:04 +00:00
imageView . addRow ( [ getAbsoluteURL ( elem . data , elem ) , gStrings . mediaObject , getValueText ( elem ) , elem , false ] ) ;
2006-09-14 06:06:03 +00:00
}
else if ( elem instanceof nsIEmbedElement )
{
2006-09-14 06:06:04 +00:00
imageView . addRow ( [ getAbsoluteURL ( elem . src , elem ) , gStrings . mediaEmbed , "" , elem , false ] ) ;
2006-09-14 06:06:03 +00:00
}
else
if ( elem . hasAttributeNS ( XLinkNS , "href" ) )
{
linktext = getValueText ( elem ) ;
linkView . addRow ( [ linktext , getAbsoluteURL ( elem . href , elem ) , gStrings . linkX , "" ] ) ;
}
2006-09-14 06:06:06 +00:00
return NodeFilter . FILTER _ACCEPT ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
}
2006-09-14 06:05:46 +00:00
//******** Form Stuff
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
function onFormSelect ( )
{
2006-09-14 06:04:58 +00:00
var formTree = document . getElementById ( "formtree" ) ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
if ( ! formView . rowCount ) return ;
2006-09-14 05:56:42 +00:00
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
if ( formView . selection . count == 1 )
2006-09-14 05:51:57 +00:00
{
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
var formPreview = document . getElementById ( "formpreview" ) ;
2006-09-14 06:05:46 +00:00
fieldView . clear ( ) ;
2006-09-14 06:04:58 +00:00
formPreview . treeBoxObject . view = fieldView ;
2006-09-14 05:51:57 +00:00
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
var clickedRow = formView . selection . currentIndex ;
2006-09-14 06:06:23 +00:00
// form-node;
var form = formView . data [ clickedRow ] [ 3 ] ;
2006-09-14 06:05:46 +00:00
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
var ft = null ;
if ( form . name )
ft = theBundle . getFormattedString ( "formTitle" , [ form . name ] ) ;
2006-09-14 05:51:57 +00:00
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
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" ) ;
2006-09-14 05:48:15 +00:00
2006-09-14 06:06:20 +00:00
var formfields = form . elements ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
var length = formfields . length ;
var i = 0 ;
var checked = theBundle . getString ( "formChecked" ) ;
var unchecked = theBundle . getString ( "formUnchecked" ) ;
for ( i = 0 ; i < length ; i ++ )
{
2006-09-14 06:06:03 +00:00
var elem = formfields [ i ] , val ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
2006-09-14 06:06:03 +00:00
if ( elem instanceof nsIButtonElement )
val = getValueText ( elem ) ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
else
2006-09-14 06:06:03 +00:00
val = ( /^password$/i . test ( elem . type ) ) ? theBundle . getString ( "formPassword" ) : elem . value ;
2006-09-14 06:06:20 +00:00
fieldView . addRow ( [ "" , elem . name , elem . type , val ] ) ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
}
2006-09-14 05:56:42 +00:00
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
var labels = form . getElementsByTagName ( "label" ) ;
2006-09-14 06:05:37 +00:00
var llength = labels . length ;
2006-09-14 06:06:07 +00:00
var label ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
for ( i = 0 ; i < llength ; i ++ )
{
2006-09-14 06:06:07 +00:00
label = labels [ i ] ;
var whatfor = label . hasAttribute ( "for" ) ?
theDocument . getElementById ( label . getAttribute ( "for" ) ) :
findFirstControl ( label ) ;
2006-09-14 06:05:37 +00:00
2006-09-14 06:06:07 +00:00
if ( whatfor && ( whatfor . form == form ) )
{
var labeltext = getValueText ( label ) ;
2006-09-14 06:05:37 +00:00
for ( var j = 0 ; j < length ; j ++ )
2006-09-14 06:06:23 +00:00
if ( formfields [ j ] == whatfor ) {
var col = formPreview . columns [ "field-label" ] ;
fieldView . setCellText ( j , col , labeltext ) ;
}
2006-09-14 06:05:37 +00:00
}
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
}
}
}
2006-09-14 06:06:03 +00:00
function FormControlFilter ( node )
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
{
2006-09-14 06:06:03 +00:00
if ( node instanceof nsIInputElement || node instanceof nsISelectElement ||
node instanceof nsIButtonElement || node instanceof nsITextareaElement ||
node instanceof nsIObjectElement )
return NodeFilter . FILTER _ACCEPT ;
return NodeFilter . FILTER _SKIP ;
}
2006-09-14 05:48:15 +00:00
2006-09-14 06:06:03 +00:00
function findFirstControl ( node )
{
2006-09-14 06:05:46 +00:00
var iterator = theDocument . createTreeWalker ( node , NodeFilter . SHOW _ELEMENT , FormControlFilter , true ) ;
2006-09-14 06:05:28 +00:00
2006-09-14 06:05:46 +00:00
return iterator . nextNode ( ) ;
2006-09-14 06:05:28 +00:00
}
2006-09-14 06:05:46 +00:00
//******** Link Stuff
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
function openURL ( target )
{
var url = target . parentNode . childNodes [ 2 ] . value ;
window . open ( url , "_blank" , "chrome" ) ;
}
2006-09-14 06:05:43 +00:00
function onBeginLinkDrag ( event , urlField , descField )
{
if ( event . originalTarget . localName != "treechildren" )
return ;
2006-09-14 06:05:46 +00:00
2006-09-14 06:05:43 +00:00
var tree = event . target ;
if ( ! ( "treeBoxObject" in tree ) )
tree = tree . parentNode ;
2006-09-14 06:05:46 +00:00
2006-09-14 06:06:23 +00:00
var row = tree . treeBoxObject . getRowAt ( event . clientX , event . clientY ) ;
if ( row == - 1 )
2006-09-14 06:05:44 +00:00
return ;
2006-09-14 06:05:43 +00:00
// Getting drag-system needed services
var dragService = Components . classes [ DRAGSERVICE _CONTRACTID ] . getService ( ) . QueryInterface ( Components . interfaces . nsIDragService ) ;
var transArray = Components . classes [ ARRAY _CONTRACTID ] . createInstance ( Components . interfaces . nsISupportsArray ) ;
if ( ! transArray )
return ;
var trans = Components . classes [ TRANSFERABLE _CONTRACTID ] . createInstance ( Components . interfaces . nsITransferable ) ;
if ( ! trans )
return ;
// Adding URL flavor
trans . addDataFlavor ( "text/x-moz-url" ) ;
2006-09-14 06:06:23 +00:00
var col = tree . columns [ urlField ] ;
var url = tree . view . getCellText ( row , col ) ;
col = tree . columns [ descField ] ;
var desc = tree . view . getCellText ( row , col ) ;
2006-09-14 06:05:44 +00:00
var stringURL = Components . classes [ STRING _CONTRACTID ] . createInstance ( Components . interfaces . nsISupportsString ) ;
2006-09-14 06:05:43 +00:00
stringURL . data = url + "\n" + desc ;
trans . setTransferData ( "text/x-moz-url" , stringURL , stringURL . data . length * 2 ) ;
transArray . AppendElement ( trans . QueryInterface ( Components . interfaces . nsISupports ) ) ;
dragService . invokeDragSession ( event . target , transArray , null , dragService . DRAGDROP _ACTION _NONE ) ;
}
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
//******** Image Stuff
2006-09-14 06:05:46 +00:00
function getSource ( item )
2006-09-14 06:04:57 +00:00
{
// Return the correct source without strict warnings
2006-09-14 06:06:13 +00:00
if ( "href" in item && item . href )
2006-09-14 06:04:57 +00:00
return item . href ;
2006-09-14 06:06:13 +00:00
if ( "src" in item && item . src )
2006-09-14 06:04:57 +00:00
return item . src ;
return null ;
}
2006-09-14 06:05:46 +00:00
function getSelectedImage ( tree )
2006-09-14 06:04:57 +00:00
{
2006-09-14 06:05:46 +00:00
if ( ! imageView . rowCount ) return null ;
2006-09-14 06:04:57 +00:00
// Only works if only one item is selected
2006-09-14 06:06:23 +00:00
var clickedRow = tree . currentIndex ;
// image-node
return imageView . data [ clickedRow ] [ 3 ] ;
2006-09-14 06:04:57 +00:00
}
function saveMedia ( )
{
2006-09-14 06:04:58 +00:00
var tree = document . getElementById ( "imagetree" ) ;
2006-09-14 06:06:00 +00:00
var item = getSelectedImage ( tree ) ;
2006-09-14 06:04:57 +00:00
var url = getAbsoluteURL ( getSource ( item ) , item ) ;
2006-09-14 06:05:46 +00:00
if ( url )
2006-09-14 06:04:57 +00:00
saveURL ( url , null , 'SaveImageTitle' , false ) ;
}
2006-09-14 05:51:57 +00:00
function onImageSelect ( )
{
2006-09-14 06:04:58 +00:00
var tree = document . getElementById ( "imagetree" ) ;
2006-09-14 06:04:57 +00:00
var saveAsButton = document . getElementById ( "imagesaveasbutton" ) ;
2006-09-14 05:59:09 +00:00
2006-09-14 06:06:23 +00:00
if ( tree . view . selection . count == 1 )
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
{
2006-09-14 06:06:23 +00:00
makePreview ( tree . view . selection . currentIndex ) ;
2006-09-14 06:04:57 +00:00
saveAsButton . setAttribute ( "disabled" , "false" ) ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
}
2006-09-14 06:05:46 +00:00
else
saveAsButton . setAttribute ( "disabled" , "true" ) ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
}
2006-09-14 05:56:42 +00:00
2006-09-14 06:05:58 +00:00
function makePreview ( row )
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
{
2006-09-14 06:06:23 +00:00
var imageTree = document . getElementById ( "imagetree" ) ;
var item = getSelectedImage ( imageTree ) ;
var col = imageTree . columns [ "image-address" ] ;
var url = imageView . getCellText ( row , col ) ;
// image-bg
var isBG = imageView . data [ row ] [ 4 ] ;
2006-09-14 06:05:58 +00:00
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
document . getElementById ( "imageurltext" ) . value = url ;
2006-09-14 06:05:46 +00:00
document . getElementById ( "imagetitletext" ) . value = item . title || gStrings . notSet ;
2006-09-14 06:05:40 +00:00
var altText = null ;
if ( item . hasAttribute ( "alt" ) && ( "alt" in item ) )
altText = item . alt ;
2006-09-14 06:05:58 +00:00
else if ( ! isBG )
2006-09-14 06:05:40 +00:00
altText = getValueText ( item ) ;
if ( altText == null )
2006-09-14 06:05:46 +00:00
altText = gStrings . notSet ;
2006-09-14 06:05:40 +00:00
var textbox = document . getElementById ( "imagealttext" ) ;
2006-09-14 06:05:46 +00:00
2006-09-14 06:05:40 +00:00
// 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
2006-09-14 06:06:03 +00:00
if ( ! altText ) {
2006-09-14 06:05:46 +00:00
textbox . value = gStrings . emptyString ;
2006-09-14 06:05:40 +00:00
textbox . setAttribute ( "style" , "font-style:italic" ) ;
} else {
textbox . value = altText ;
textbox . setAttribute ( "style" , "font-style:inherit" ) ;
}
2006-09-14 06:05:46 +00:00
document . getElementById ( "imagelongdesctext" ) . value = ( "longDesc" in item && item . longDesc ) || gStrings . notSet ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
// get cache info
var sourceText = theBundle . getString ( "generalNotCached" ) ;
2006-09-14 06:05:46 +00:00
var expirationText = gStrings . unknown ;
var sizeText = gStrings . unknown ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
2006-09-14 06:05:41 +00:00
var pageSize = 0 ;
var kbSize = 0 ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
var expirationTime = 0 ;
var expirationDate = null ;
try
2006-09-14 05:51:57 +00:00
{
2006-09-14 06:05:32 +00:00
var cacheEntryDescriptor = httpCacheSession . openCacheEntry ( url , Components . interfaces . nsICache . ACCESS _READ , false ) ; // open for READ, in non-blocking mode
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
if ( cacheEntryDescriptor )
{
switch ( cacheEntryDescriptor . deviceID )
{
case "disk" :
sourceText = theBundle . getString ( "generalDiskCache" ) ;
break ;
case "memory" :
sourceText = theBundle . getString ( "generalMemoryCache" ) ;
break ;
default :
sourceText = cacheEntryDescriptor . deviceID ;
break ;
}
}
}
catch ( ex )
{
try
{
2006-09-14 06:05:32 +00:00
cacheEntryDescriptor = ftpCacheSession . openCacheEntry ( url , Components . interfaces . nsICache . ACCESS _READ , false ) ; // open for READ, in non-blocking mode
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
if ( cacheEntryDescriptor )
{
switch ( cacheEntryDescriptor . deviceID )
{
case "disk" :
sourceText = theBundle . getString ( "generalDiskCache" ) ;
break ;
case "memory" :
sourceText = theBundle . getString ( "generalMemoryCache" ) ;
break ;
default :
sourceText = cacheEntryDescriptor . deviceID ;
break ;
}
}
}
catch ( ex2 )
{
sourceText = theBundle . getString ( "generalNotCached" ) ;
}
}
2006-09-14 06:06:02 +00:00
2006-09-14 06:06:11 +00:00
// find out the file size and expiration date
2006-09-14 06:06:02 +00:00
if ( cacheEntryDescriptor )
{
pageSize = cacheEntryDescriptor . dataSize ;
kbSize = pageSize / 1024 ;
sizeText = theBundle . getFormattedString ( "generalSize" , [ Math . round ( kbSize * 100 ) / 100 , pageSize ] ) ;
expirationText = formatDate ( cacheEntryDescriptor . expirationTime * 1000 , gStrings . notSet ) ;
}
2006-09-14 06:06:11 +00:00
var mimeType = ( "type" in item && item . type ) ||
( "codeType" in item && item . codeType ) ||
( "contentType" in item && item . contentType ) ||
getContentTypeFromImgRequest ( item ) ||
2006-09-14 06:06:12 +00:00
getContentTypeFromHeaders ( cacheEntryDescriptor ) ||
2006-09-14 06:06:11 +00:00
gStrings . unknown ;
2006-09-14 06:06:02 +00:00
document . getElementById ( "imagetypetext" ) . value = mimeType ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
document . getElementById ( "imagesourcetext" ) . value = sourceText ;
document . getElementById ( "imageexpirestext" ) . value = expirationText ;
document . getElementById ( "imagesizetext" ) . value = sizeText ;
var imageContainer = document . getElementById ( "theimagecontainer" ) ;
var oldImage = document . getElementById ( "thepreviewimage" ) ;
2006-09-14 06:05:36 +00:00
var regex = new RegExp ( "^(https?|ftp|file|gopher)://" ) ;
2006-09-14 06:05:58 +00:00
var absoluteURL = getAbsoluteURL ( url , item ) ;
2006-09-14 06:05:36 +00:00
var isProtocolAllowed = regex . test ( absoluteURL ) ;
var newImage = new Image ( ) ;
newImage . setAttribute ( "id" , "thepreviewimage" ) ;
2006-09-14 06:06:03 +00:00
var physWidth = 0 , physHeight = 0 ;
2006-09-14 06:06:02 +00:00
2006-09-14 06:06:03 +00:00
if ( ( item instanceof nsILinkElement || item instanceof nsIInputElement ||
item instanceof nsIImageElement || isBG ) && isProtocolAllowed )
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
{
2006-09-14 06:05:36 +00:00
newImage . src = absoluteURL ;
2006-09-14 06:06:02 +00:00
physWidth = newImage . width ;
physHeight = newImage . height ;
2006-09-14 06:05:36 +00:00
if ( "width" in item && item . width )
newImage . width = item . width ;
if ( "height" in item && item . height )
newImage . height = item . height ;
}
else
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
{
2006-09-14 06:05:36 +00:00
// fallback image for protocols not allowed (e.g., data: or javascript:)
// or elements not [yet] handled (e.g., object, embed). XXX blank??
2006-09-14 06:06:16 +00:00
newImage . src = "resource://gre/re/loading-image.gif" ;
2006-09-14 06:05:36 +00:00
newImage . width = 40 ;
newImage . height = 40 ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
}
2006-09-14 06:05:58 +00:00
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" ;
2006-09-14 06:06:02 +00:00
document . getElementById ( "imageSize" ) . value = theBundle . getFormattedString ( "mediaSize" , [ width , height ] ) ;
if ( width != physWidth || height != physHeight )
{
2006-09-14 06:06:04 +00:00
document . getElementById ( "physSize" ) . removeAttribute ( "hidden" ) ;
2006-09-14 06:06:02 +00:00
document . getElementById ( "physSize" ) . value = theBundle . getFormattedString ( "mediaPhysSize" , [ physWidth , physHeight ] ) ;
}
else
2006-09-14 06:06:04 +00:00
document . getElementById ( "physSize" ) . setAttribute ( "hidden" , "true" ) ;
2006-09-14 06:06:02 +00:00
2006-09-14 06:05:58 +00:00
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
imageContainer . removeChild ( oldImage ) ;
imageContainer . appendChild ( newImage ) ;
}
2006-09-14 06:06:11 +00:00
function getContentTypeFromHeaders ( cacheEntryDescriptor )
{
2006-09-14 06:06:19 +00:00
if ( ! cacheEntryDescriptor )
return null ;
2006-09-14 06:06:11 +00:00
2006-09-14 06:06:19 +00:00
return ( /^Content-Type:\s*(.*?)\s*(?:\;|$)/mi
. exec ( cacheEntryDescriptor . getMetaDataElement ( "response-head" ) ) ) [ 1 ] ;
2006-09-14 06:06:11 +00:00
}
function getContentTypeFromImgRequest ( item )
{
var httpRequest ;
try
{
var imageItem = item . QueryInterface ( nsIImageLoadingContent ) ;
var imageRequest = imageItem . getRequest ( nsIImageLoadingContent . CURRENT _REQUEST ) ;
if ( imageRequest )
httpRequest = imageRequest . mimeType ;
}
catch ( ex )
{
// This never happened. ;)
}
return httpRequest ;
}
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
//******** Other Misc Stuff
// Modified from the Links Panel v2.3, http://segment7.net/mozilla/links/links.html
// parse a node to extract the contents of the node
2006-09-14 06:06:07 +00:00
function getValueText ( node )
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
{
var valueText = "" ;
2006-09-14 06:06:07 +00:00
// form input elements don't generally contain information that is useful to our callers, so return nothing
if ( node instanceof nsIInputElement || node instanceof nsISelectElement || node instanceof nsITextareaElement )
return valueText ;
// otherwise recurse for each child
var length = node . childNodes . length ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
for ( var i = 0 ; i < length ; i ++ )
{
2006-09-14 06:06:07 +00:00
var childNode = node . childNodes [ i ] ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
var nodeType = childNode . nodeType ;
2006-09-14 06:06:07 +00:00
// text nodes are where the goods are
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
if ( nodeType == Node . TEXT _NODE )
valueText += " " + childNode . nodeValue ;
2006-09-14 06:06:07 +00:00
// and elements can have more text inside them
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
else if ( nodeType == Node . ELEMENT _NODE )
{
2006-09-14 06:06:07 +00:00
// images are special, we want to capture the alt text as if the image weren't there
2006-09-14 06:06:03 +00:00
if ( childNode instanceof nsIImageElement )
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
valueText += " " + getAltText ( childNode ) ;
else
valueText += " " + getValueText ( childNode ) ;
}
2006-09-14 05:51:57 +00:00
}
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
return stripWS ( valueText ) ;
2006-09-14 05:51:57 +00:00
}
2006-09-14 05:48:15 +00:00
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
// Copied from the Links Panel v2.3, http://segment7.net/mozilla/links/links.html
// traverse the tree in search of an img or area element and grab its alt tag
function getAltText ( node )
2006-09-14 05:59:09 +00:00
{
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
var altText = "" ;
if ( node . alt )
return node . alt ;
var length = node . childNodes . length ;
for ( var i = 0 ; i < length ; i ++ )
if ( ( altText = getAltText ( node . childNodes [ i ] ) != undefined ) ) // stupid js warning...
return altText ;
return "" ;
}
2006-09-14 05:59:09 +00:00
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
// Copied from the Links Panel v2.3, http://segment7.net/mozilla/links/links.html
// strip leading and trailing whitespace, and replace multiple consecutive whitespace characters with a single space
function stripWS ( text )
{
var middleRE = /\s+/g ;
var endRE = /(^\s+)|(\s+$)/g ;
text = text . replace ( middleRE , " " ) ;
return text . replace ( endRE , "" ) ;
2006-09-14 05:59:09 +00:00
}
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
function formatDate ( datestr , unknown )
2006-09-14 05:51:57 +00:00
{
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
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 ;
2006-09-14 05:51:57 +00:00
}
2006-09-14 05:52:02 +00:00
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
/ *
* 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
*
2006-09-14 06:06:05 +00:00
* 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
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
* /
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 ) ;
2006-09-14 06:03:01 +00:00
var URL = ioService . newURI ( doc . location . href , null , null ) ;
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
for ( var i = 0 ; i < urlArr . length ; i ++ )
{
2006-09-14 06:06:05 +00:00
try
{
URL = ioService . newURI ( urlArr [ i ] , URL . originCharset , URL ) ;
}
catch ( ex )
{
; // do nothing
}
Landing Daniel Brooks' <db48x@yahoo.com> page info rewrite. Tracking
bug is bug 52730, fixes bugs 53503, 53641, 55713, 60428, 68823, 74530,
74760, 76926, 77408, 81328, 85905, 88537, 91173, 94146, 96994, 97479,
110973, 110981, 112297, 117027. r=fabian,hwaara,bzbarsky,gerv,ksosez.
sr=jag,hewitt.
2006-09-14 06:02:10 +00:00
}
return URL . spec ;
}
2006-09-14 06:05:28 +00:00
function doCopy ( event )
{
if ( ! gClipboardHelper )
return ;
var elem = event . originalTarget ;
if ( elem && "treeBoxObject" in elem )
elem . treeBoxObject . view . performActionOnRow ( "copy" , elem . currentIndex ) ;
var text = elem . getAttribute ( "copybuffer" ) ;
if ( text )
gClipboardHelper . copyString ( text ) ;
}
2006-09-14 06:06:03 +00:00