Fixes for various sidebar panels for bug # 42718. Also, set page title for FTP/FILE displays. Finally, fix a bug (can't remember the bug # at the moment) with clicking on the scrollbar... basically, make sure the click is on a <treeitem> before processing the click. r=me

This commit is contained in:
rjc%netscape.com 2006-07-27 14:51:25 +00:00
Родитель 2bb66243f8
Коммит 6c617250a6
3 изменённых файлов: 63 добавлений и 14 удалений

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

@ -21,20 +21,29 @@
*/
/*
Script for the directory window
*/
// By the time this runs, The 'HTTPIndex' variable will have been
// magically set on the global object by the native code.
function debug(msg)
{
// Uncomment to print out debug info.
dump(msg);
}
// get handle to the BrowserAppCore in the content area.
var appCore = window._content.appCore;
function Init()
{
debug("directory.js: Init()\n");
@ -68,31 +77,57 @@ function Init()
// Use a default character set.
if (window._content.defaultCharacterset)
httpDS.encoding = window._content.defaultCharacterset;
{
httpDS.encoding = window._content.defaultCharacterset;
}
}
}
// set window title
var theWindow = window._content.parentWindow;
if (theWindow)
{
theWindow.title = baseURI;
}
// root the tree (do this last)
tree.setAttribute("ref", baseURI);
}
function OnClick(event)
function OnClick(event, node)
{
if( event.type == "click" &&
( event.button != 1 || event.detail != 2 ) )
return false;
( event.button != 1 || event.detail != 2 || node.nodeName != "treeitem") )
return(false);
if( event.type == "keypress" && event.which != 13 )
return false;
return(false);
var tree = document.getElementById("tree");
if( tree.selectedItems.length == 1 )
{
var selectedItem = tree.selectedItems[0];
var theID = selectedItem.getAttribute("id");
//if( selectedItem.getAttribute( "type" ) == "FILE" )
window._content.location.href = selectedItem.getAttribute('id');
if(appCore)
{
// support session history (if appCore is available)
appCore.loadUrl(theID);
}
else
{
// fallback case (if appCore isn't available)
window._content.location.href = theID;
}
// set window title
var theWindow = window._content.parentWindow;
if (theWindow)
{
theWindow.title = baseURI;
}
}
}

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

@ -72,7 +72,7 @@
<!-- Create the treechildren here so we can attach event handlers
at this level (rather than at the tree level -->
<treechildren flex="1" onclick="OnClick(event);" onkeypress="OnClick(event);"/>
<treechildren flex="1" onclick="OnClick(event, event.target.parentNode.parentNode);" onkeypress="OnClick(event, event.target.parentNode.parentNode);"/>
</tree>
</window>

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

@ -21,17 +21,22 @@
*/
/*
Code for the Related Links Sidebar Panel
*/
function debug(msg)
{
// uncomment for noise
// dump(msg);
}
// get handle to the BrowserAppCore in the content area.
var appCore = window._content.appCore;
// The content window that we're supposed to be observing.
var ContentWindow = window._content;
@ -270,7 +275,16 @@ function openURL(event, root)
{
}
ContentWindow.location = id;
if(appCore)
{
// support session history (if appCore is available)
appCore.loadUrl(id);
}
else
{
// fallback case (if appCore isn't available)
ContentWindow.location = id;
}
}
addEventListener("load", Init, false);