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 2000-07-27 07:47:36 +00:00
Родитель a3b628478c
Коммит f7b26a1e4e
6 изменённых файлов: 80 добавлений и 21 удалений

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

@ -1608,6 +1608,7 @@ function checkForDirectoryListing() {
!window._content.HTTPIndex.constructor ) {
// Give directory .xul/.js access to browser instance.
window._content.defaultCharacterset = appCore.GetDocumentCharset();
window._content.parentWindow = window;
}
}

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

@ -83,12 +83,14 @@ function OpenBookmarkURL(node, datasources)
else
{
if(appCore)
appCore.loadUrl(url);
else {
// May be it s'd look for a Browser window or create one
// and redirect this to the browser.
dump("BrowserAppCore is not initialised\n");
{
// support session history (if appCore is available)
appCore.loadUrl(url);
}
else
{
// fallback case (if appCore isn't available)
window._content.location = url;
}
}
}

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

@ -610,11 +610,18 @@ function OpenURL(event, node, root)
}
function update_sort_menuitems(column, direction) {
function update_sort_menuitems(column, direction)
{
var unsorted_menuitem = document.getElementById("unsorted_menuitem");
var sort_ascending = document.getElementById('sort_ascending');
var sort_descending = document.getElementById('sort_descending');
// as this function may be called from various places, including the
// bookmarks sidebar panel (which doesn't have any menu items)
// ensure that the document contains the elements
if ((!unsorted_menuitem) || (!sort_ascending) || (!sort_descending))
return;
if (direction == "natural") {
unsorted_menuitem.setAttribute('checked','true');
sort_ascending.setAttribute('disabled','true');

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

@ -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);