Resurrect stop button in tabs.

b=77738; r=morse; sr=alecf
This commit is contained in:
sgehani%netscape.com 2006-07-27 14:56:21 +00:00
parent 3cc2bdbfa9
commit c750007682
3 changed files with 57 additions and 3 deletions

View File

@ -330,6 +330,10 @@ function (force_reload)
}
load_state = content.getAttribute('loadstate');
if (load_state == 'stopped') {
load_state = 'never loaded';
toggleLoadarea(content);
}
if (load_state == 'never loaded') {
iframe.removeAttribute('hidden');
iframe.setAttribute('loadstate', 'loading');
@ -491,6 +495,49 @@ function ()
iframe.removeEventListener("load", panel_loader, true);
content.setAttribute("loadstate", "stopped");
iframe.setAttribute('src', 'about:blank');
toggleLoadarea(content);
}
}
function toggleLoadarea(content)
{
// toggle between "loading" and "load stopped" in the UI
var widgetBox = content.firstChild.firstChild;
var widgetBoxKids = widgetBox.childNodes;
var stopButton = widgetBoxKids.item(3);
var reloadButton = widgetBoxKids.item(4);
var loadingImage = widgetBox.firstChild;
var loadingText = loadingImage.nextSibling;
var loadStoppedText = loadingText.nextSibling;
// sanity check
if (stopButton.getAttribute("type") != "stop")
{
debug("Error: Expected button of type=\"stop\" but didn't get one!");
return;
}
if (!stopButton.hidden)
{
// change button from "stop" to "reload"
stopButton.hidden = "true";
reloadButton.removeAttribute("hidden");
// hide the loading image and set text to "load stopped"
loadingImage.hidden = "true";
loadingText.hidden = "true";
loadStoppedText.removeAttribute("hidden");
}
else
{
// change button from "reload" to "stop"
stopButton.removeAttribute("hidden");
reloadButton.hidden = "true";
// show the loading image and set text to "loading"
loadingImage.removeAttribute("hidden");
loadingText.removeAttribute("hidden");
loadStoppedText.hidden = "true";
}
}

View File

@ -97,7 +97,8 @@
<menuseparator />
</menupopup>
</toolbarbutton>
<toolbarbutton id="sidebar-close-button" oncommand="SidebarShowHide();"/>
<toolbarbutton id="sidebar-close-button" oncommand="SidebarShowHide();"
tooltiptext="&sidebar.close.tooltip;"/>
</sidebarheader>
<vbox id="sidebar-panels"
@ -134,8 +135,13 @@
<image class="image-panel-loading"/>
<label class="text-panel-loading"
value="&sidebar.loading.label;"/>
<button label="&sidebar.loading.stop.label;" hidden="true"
<label class="text-panel-loading" hidden="true"
loading="false"
value="&sidebar.loadstopped.label;"/>
<button type="stop" label="&sidebar.loading.stop.label;"
oncommand="SidebarStopPanelLoad(this.parentNode.parentNode.parentNode.previousSibling);"/>
<button label="&sidebar.reload.label;" hidden="true"
oncommand="SidebarReload();"/>
</hbox>
<spacer flex="100%"/>
</vbox>

View File

@ -33,6 +33,7 @@
<!ENTITY sidebarCmd.label "Sidebar">
<!ENTITY sidebarCmd.accesskey "b">
<!ENTITY sidebar.loading.label "Loading...">
<!ENTITY sidebar.loadstopped.label "Load stopped">
<!ENTITY sidebar.loading.stop.label "Stop">
<!ENTITY sidebar.no-panels.state "The sidebar is currently empty.">
@ -41,5 +42,5 @@
<!ENTITY sidebar.sbDirectory.label "Sidebar Directory...">
<!ENTITY sidebar.pagenotfound.label "This tab is not available right now.">
<!ENTITY sidebar.close.tooltip "Close">
<!ENTITY sidebar.close.tooltip "Close Sidebar">