зеркало из https://github.com/mozilla/pjs.git
Add reload and stop sidebar tab header context menu items.
b=41445; r=morse; sr=alecf
This commit is contained in:
Родитель
d9c596c3ec
Коммит
aa6b02b8b6
|
@ -21,20 +21,22 @@
|
|||
- Samir Gehani <sgehani@netscape.com>
|
||||
-->
|
||||
|
||||
<!ENTITY sidebar.panels.label "Sidebar">
|
||||
<!ENTITY sidebar.reload.label "Reload">
|
||||
<!ENTITY sidebar.picker.label "Tabs">
|
||||
<!ENTITY sidebar.customize.label "Customize Sidebar...">
|
||||
<!ENTITY sidebar.customize.accesskey "u">
|
||||
<!ENTITY sidebar.hide.label "Hide Panel">
|
||||
<!ENTITY sidebar.hide.accesskey "H">
|
||||
<!ENTITY sidebar.switch.label "Switch to Panel">
|
||||
<!ENTITY sidebar.switch.accesskey "S">
|
||||
<!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.panels.label "Sidebar">
|
||||
<!ENTITY sidebar.reload.label "Reload">
|
||||
<!ENTITY sidebar.reload.accesskey "R">
|
||||
<!ENTITY sidebar.picker.label "Tabs">
|
||||
<!ENTITY sidebar.customize.label "Customize Sidebar...">
|
||||
<!ENTITY sidebar.customize.accesskey "u">
|
||||
<!ENTITY sidebar.hide.label "Hide Tab">
|
||||
<!ENTITY sidebar.hide.accesskey "H">
|
||||
<!ENTITY sidebar.switch.label "Switch to Tab">
|
||||
<!ENTITY sidebar.switch.accesskey "T">
|
||||
<!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.loading.stop.accesskey "S">
|
||||
|
||||
<!ENTITY sidebar.no-panels.state "The sidebar is currently empty.">
|
||||
<!ENTITY sidebar.no-panels.add 'You may add tabs by clicking on the "Tabs" button above.'>
|
||||
|
|
|
@ -316,7 +316,9 @@ function (force_reload)
|
|||
} else {
|
||||
var saved_src = iframe.getAttribute('content');
|
||||
var src = iframe.getAttribute('src');
|
||||
if (saved_src != src) {
|
||||
// either we have been requested to force_reload or the
|
||||
// panel src has changed so we must restore the original src
|
||||
if (force_reload || (saved_src != src)) {
|
||||
debug(" set src="+saved_src);
|
||||
iframe.setAttribute('src', saved_src);
|
||||
|
||||
|
@ -325,7 +327,6 @@ function (force_reload)
|
|||
|
||||
gCurFrame = iframe;
|
||||
gTimeoutID = setTimeout (setBlank, 20000);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -904,6 +905,11 @@ function SidebarStopPanelLoad(header) {
|
|||
panel.stop_load();
|
||||
}
|
||||
|
||||
function SidebarReloadPanel(header) {
|
||||
var panel = sidebarObj.panels.get_panel_from_header_node(header);
|
||||
panel.reload();
|
||||
}
|
||||
|
||||
// No one is calling this right now.
|
||||
function SidebarReload() {
|
||||
sidebarObj.panels.refresh();
|
||||
|
@ -1184,6 +1190,33 @@ function SidebarFinishClick() {
|
|||
}
|
||||
}
|
||||
|
||||
function SidebarInitContextMenu(aMenu, aPopupNode)
|
||||
{
|
||||
var panel = sidebarObj.panels.get_panel_from_header_node(aPopupNode);
|
||||
var switchItem = document.getElementById("switch-ctx-item");
|
||||
var reloadItem = document.getElementById("reload-ctx-item");
|
||||
var stopItem = document.getElementById("stop-ctx-item");
|
||||
|
||||
// the current panel can be reloaded, but other panels are not showing
|
||||
// any content, so we only allow you to switch to other panels
|
||||
if (panel.is_selected())
|
||||
{
|
||||
switchItem.setAttribute("collapsed", "true");
|
||||
reloadItem.removeAttribute("disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
switchItem.removeAttribute("collapsed");
|
||||
reloadItem.setAttribute("disabled", "true");
|
||||
}
|
||||
|
||||
// only if a panel is currently loading enable the ``Stop'' item
|
||||
if (panel.get_iframe().getAttribute("loadstate") == "loading")
|
||||
stopItem.removeAttribute("disabled");
|
||||
else
|
||||
stopItem.setAttribute("disabled", "true");
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Handy Debug Tools
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -34,16 +34,24 @@
|
|||
|
||||
<command id="toggleSidebar" oncommand="SidebarShowHide();"/>
|
||||
<key id="showHideSidebar" keycode="VK_F9" command="toggleSidebar"/>
|
||||
<popup id="sidebarPopup" onpopupshowing="if (sidebarObj.panels.get_panel_from_header_node(document.popupNode).is_selected())
|
||||
this.firstChild.setAttribute('collapsed', 'true');
|
||||
else
|
||||
this.firstChild.removeAttribute('collapsed');">
|
||||
<menuitem label="&sidebar.switch.label;" accesskey="&sidebar.switch.accesskey;"
|
||||
default="true" oncommand="SidebarSelectPanel(document.popupNode, false, false);"/>
|
||||
<menuitem label="&sidebar.hide.label;" accesskey="&sidebar.hide.accesskey;"
|
||||
<popup id="sidebarPopup"
|
||||
onpopupshowing="SidebarInitContextMenu(this, document.popupNode);">
|
||||
<menuitem id="switch-ctx-item" label="&sidebar.switch.label;"
|
||||
accesskey="&sidebar.switch.accesskey;" default="true"
|
||||
oncommand="SidebarSelectPanel(document.popupNode,false,false);"/>
|
||||
<menuitem id="reload-ctx-item" label="&sidebar.reload.label;"
|
||||
accesskey="&sidebar.reload.accesskey;" disabled="true"
|
||||
oncommand="SidebarReloadPanel(document.popupNode);"/>
|
||||
<menuitem id="stop-ctx-item" label="&sidebar.loading.stop.label;"
|
||||
accesskey="&sidebar.loading.stop.accesskey;" disabled="true"
|
||||
oncommand="SidebarStopPanelLoad(document.popupNode);"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="hide-ctx-item" label="&sidebar.hide.label;"
|
||||
accesskey="&sidebar.hide.accesskey;"
|
||||
oncommand="SidebarTogglePanel(document.popupNode);"/>
|
||||
<menuseparator/>
|
||||
<menuitem label="&sidebar.customize.label;" accesskey="&sidebar.customize.accesskey;"
|
||||
<menuitem id="customize-ctx-item" label="&sidebar.customize.label;"
|
||||
accesskey="&sidebar.customize.accesskey;"
|
||||
oncommand="SidebarCustomize();"/>
|
||||
</popup>
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче