Commit fb7e0576 authored by Kathleen Brade's avatar Kathleen Brade
Browse files

Do not show copy log button when help is open.

If a Tor error or warning message arrived while the Bridge Help was
open, the "Copy Tor Log To Clipboard" button was shown immediately
(instead of after the help was closed).
parent 3aa48602
...@@ -439,10 +439,7 @@ function showPanel(aPanelID) ...@@ -439,10 +439,7 @@ function showPanel(aPanelID)
var deckElem = document.getElementById("deck"); var deckElem = document.getElementById("deck");
if (deckElem) if (deckElem)
{
deckElem.selectedPanel = document.getElementById(aPanelID); deckElem.selectedPanel = document.getElementById(aPanelID);
showOrHideButton("extra2", (aPanelID != "bridgeHelp"), false);
}
else if (wizard.currentPage.pageid != aPanelID) else if (wizard.currentPage.pageid != aPanelID)
wizard.goTo(aPanelID); wizard.goTo(aPanelID);
...@@ -527,17 +524,19 @@ function showErrorMessage(aTorExited, aErrorMsg) ...@@ -527,17 +524,19 @@ function showErrorMessage(aTorExited, aErrorMsg)
function showCopyLogButton(aHaveErrorOrWarning) function showCopyLogButton(aHaveErrorOrWarning)
{ {
var copyLogBtn = document.documentElement.getButton("extra2"); let copyLogBtn = document.documentElement.getButton("extra2");
if (copyLogBtn) if (copyLogBtn)
{ {
if (getWizard()) let haveWizard = (getWizard() != null);
if (haveWizard)
copyLogBtn.setAttribute("wizardCanCopyLog", true); copyLogBtn.setAttribute("wizardCanCopyLog", true);
copyLogBtn.removeAttribute("hidden"); if (!gRestoreAfterHelpPanelID)
copyLogBtn.removeAttribute("hidden"); // Show button if help is not open.
if (aHaveErrorOrWarning) if (aHaveErrorOrWarning)
{ {
var clz = copyLogBtn.getAttribute("class"); let clz = copyLogBtn.getAttribute("class");
if (!clz) if (!clz)
copyLogBtn.setAttribute("class", "torWarning"); copyLogBtn.setAttribute("class", "torWarning");
else if (clz.indexOf("torWarning") < 0) else if (clz.indexOf("torWarning") < 0)
...@@ -549,14 +548,12 @@ function showCopyLogButton(aHaveErrorOrWarning) ...@@ -549,14 +548,12 @@ function showCopyLogButton(aHaveErrorOrWarning)
function restoreCopyLogVisibility() function restoreCopyLogVisibility()
{ {
if (!getWizard()) let copyLogBtn = document.documentElement.getButton("extra2");
return;
var copyLogBtn = document.documentElement.getButton("extra2");
if (!copyLogBtn) if (!copyLogBtn)
return; return;
if (copyLogBtn.hasAttribute("wizardCanCopyLog")) // Always show button in non-wizard case; conditionally in wizard.
if (!getWizard() || copyLogBtn.hasAttribute("wizardCanCopyLog"))
copyLogBtn.removeAttribute("hidden"); copyLogBtn.removeAttribute("hidden");
else else
copyLogBtn.setAttribute("hidden", true); copyLogBtn.setAttribute("hidden", true);
...@@ -735,11 +732,12 @@ function onOpenHelp() ...@@ -735,11 +732,12 @@ function onOpenHelp()
showPanel("bridgeHelp"); showPanel("bridgeHelp");
showOrHideButton("extra2", false, false); // Hide "Copy Tor Log To Clipboard"
if (getWizard()) if (getWizard())
{ {
showOrHideButton("cancel", false, false); showOrHideButton("cancel", false, false);
showOrHideButton("back", false, false); showOrHideButton("back", false, false);
showOrHideButton("extra2", false, false);
overrideButtonLabel("next", "done"); overrideButtonLabel("next", "done");
var forAssistance = document.getElementById("forAssistance"); var forAssistance = document.getElementById("forAssistance");
if (forAssistance) if (forAssistance)
...@@ -755,11 +753,12 @@ function closeHelp() ...@@ -755,11 +753,12 @@ function closeHelp()
if (!gRestoreAfterHelpPanelID) // Already closed? if (!gRestoreAfterHelpPanelID) // Already closed?
return; return;
restoreCopyLogVisibility();
if (getWizard()) if (getWizard())
{ {
showOrHideButton("cancel", true, false); showOrHideButton("cancel", true, false);
showOrHideButton("back", true, false); showOrHideButton("back", true, false);
restoreCopyLogVisibility();
restoreButtonLabel("next"); restoreButtonLabel("next");
var forAssistance = document.getElementById("forAssistance"); var forAssistance = document.getElementById("forAssistance");
if (forAssistance) if (forAssistance)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment