Add persistent panel support (iframe's remain loaded even when not visible).

b=106129; r=morse; sr=dveditz
This commit is contained in:
sgehani%netscape.com 2006-07-27 14:56:13 +00:00
Родитель 5225efd797
Коммит c75b456806
2 изменённых файлов: 38 добавлений и 14 удалений

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

@ -283,8 +283,10 @@ function (force_reload)
content.removeAttribute('collapsed');
if (sidebarObj.collapsed && panel.is_sandboxed()) {
debug(" set src=about:blank");
iframe.setAttribute('src', 'about:blank');
if (!panel.is_persistent()) {
debug(" set src=about:blank");
iframe.setAttribute('src', 'about:blank');
}
} else {
var saved_src = iframe.getAttribute('content');
var src = iframe.getAttribute('src');
@ -312,15 +314,18 @@ function (force_reload)
header.removeAttribute('selected');
content.setAttribute('collapsed','true');
iframe.setAttribute('src', 'about:blank');
load_state = content.getAttribute('loadstate');
if (load_state == 'loading') {
iframe.removeEventListener("load", panel_loader, true);
content.setAttribute('hidden','true');
iframe.setAttribute('loadstate', 'never loaded');
if (!panel.is_persistent()) {
iframe.setAttribute('src', 'about:blank');
load_state = content.getAttribute('loadstate');
if (load_state == 'loading') {
iframe.removeEventListener("load", panel_loader, true);
content.setAttribute('hidden','true');
iframe.setAttribute('loadstate', 'never loaded');
}
}
if (panel.is_sandboxed()) {
iframe.setAttribute('src', 'about:blank');
if (!panel.is_persistent())
iframe.setAttribute('src', 'about:blank');
}
}
}
@ -425,6 +430,24 @@ function (panel_id)
return 'true' == this.get_header().getAttribute('selected');
}
sbPanel.prototype.is_persistent =
function ()
{
var rv = false;
var datasource = RDF.GetDataSource(sidebarObj.datasource_uri);
var persistNode = datasource.GetTarget(RDF.GetResource(this.id),
RDF.GetResource(NC + "persist"),
true);
if (persistNode)
{
persistNode =
persistNode.QueryInterface(Components.interfaces.nsIRDFLiteral);
rv = persistNode.Value == 'true';
}
return rv;
}
sbPanel.prototype.select =
function (force_reload)
{
@ -879,9 +902,9 @@ function SidebarShowHide() {
if (sidebar_is_hidden()) {
debug("Showing the sidebar");
sidebar_box.removeAttribute('hidden');
sidebar_box.setAttribute('collapsed', 'false');
title_box.removeAttribute('hidden');
sidebar_panels_splitter_box.removeAttribute('hidden');
sidebar_panels_splitter_box.setAttribute('collapsed', 'false');
sidebar_splitter.removeAttribute('hidden');
if (sidebar_box.firstChild != sidebar_panels_splitter) {
debug("Showing the panels splitter");
@ -894,13 +917,13 @@ function SidebarShowHide() {
var hide_everything = sidebar_panels_splitter.getAttribute('hidden') == 'true';
if (hide_everything) {
debug("Hide everything");
sidebar_box.setAttribute('hidden', 'true');
sidebar_box.setAttribute('collapsed', 'true');
sidebar_splitter.setAttribute('hidden', 'true');
} else {
sidebar_panels_splitter.setAttribute('hidden', 'true');
}
title_box.setAttribute('hidden', 'true');
sidebar_panels_splitter_box.setAttribute('hidden', 'true');
sidebar_panels_splitter_box.setAttribute('collapsed', 'true');
sidebar_menu_item.setAttribute('checked', 'false');
}
// Immediately save persistent values

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

@ -1,8 +1,9 @@
addPanelConfirmTitle=Add Tab to Sidebar
addPanelConfirmMessage=Add the tab '%title%' to the %name%?##Source: %url%
persistentPanelWarning=The sidebar tab you are adding can transfer data across the Internet and run JavaScript even while %name% is closed.
dupePanelAlertTitle=Sidebar
dupePanelAlertMessage=%url% already exists in the %name%.
addEngineConfirmTitle=Add Search Engine
addEngineConfirmMessage=Add the following search engine to the %name% Internet Search tab?##Name: %title%#Search Category: %category%#Source: %url%
addEngineConfirmMessage=Add the following search engine to the %name% Internet Search tab?##Name: %title%#Search Category: %category%#Source: %url%