зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
565b6c5854
Коммит
7ace1f96cd
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче