remove a few flex value to make labels and textboxes not be vertically stretched
[mandelbrot.git] / xulapp / chrome / mandelbrot / content / mandelbrot.js
index cf4927af4a961069b679135d1e86436104db96ad..bcc2df59110d7ea7adb4751ac8acc225a57c9041 100644 (file)
@@ -52,6 +52,8 @@ function drawImage() {
   let canvas = document.getElementById("mbrotImage");
   let context = canvas.getContext("2d");
 
+  document.getElementById("drawButton").hidden = true;
+
   document.getElementById("statusLabel").value =
       document.getElementById("mbrotBundle").getString("statusDrawing");
 
@@ -458,6 +460,29 @@ function setAlgorithm(algoID) {
   gPref.setCharPref("mandelbrot.use_algorithm", algoID);
 }
 
+function addonsManager(aPane) {
+  var theEM = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+                        .getService(Components.interfaces.nsIWindowMediator)
+                        .getMostRecentWindow("Extension:Manager");
+  if (theEM) {
+    theEM.focus();
+    if (aPane)
+      theEM.showView(aPane);
+    return;
+  }
+
+  const EMURL = "chrome://mozapps/content/extensions/extensions.xul";
+  const EMFEATURES = "all,dialog=no";
+  if (aPane)
+    window.openDialog(EMURL, "", EMFEATURES, aPane);
+  else
+    window.openDialog(EMURL, "", EMFEATURES);
+}
+
+function errorConsole() {
+  toOpenWindowByType("global:console", "chrome://global/content/console.xul");
+}
+
 /***** helper functions from external sources *****/
 
 // function below is based on http://developer.mozilla.org/en/docs/Code_snippets:Canvas
@@ -493,3 +518,40 @@ function quitApp(aForceQuit) {
                                   Components.interfaces.nsIAppStartup.eAttemptQuit;
   appStartup.quit(quitSeverity);
 }
+
+// functions below are from comm-central/suite/common/tasksOverlay.js
+function toOpenWindow(aWindow) {
+  try {
+    // Try to focus the previously focused window e.g. message compose body
+    aWindow.document.commandDispatcher.focusedWindow.focus();
+  } catch (e) {
+    // e.g. full-page plugin or non-XUL document; just raise the top window
+    aWindow.focus();
+  }
+}
+
+function toOpenWindowByType(inType, uri, features) {
+  // don't do several loads in parallel
+  if (uri in window)
+    return;
+
+  var topWindow = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+                            .getService(Components.interfaces.nsIWindowMediator)
+                            .getMostRecentWindow(inType);
+  if ( topWindow )
+    toOpenWindow( topWindow );
+  else {
+    // open the requested window, but block it until it's fully loaded
+    function newWindowLoaded(event) {
+      // make sure that this handler is called only once
+      window.removeEventListener("unload", newWindowLoaded, false);
+      window[uri].removeEventListener("load", newWindowLoaded, false);
+      delete window[uri];
+    }
+    // remember the newly loading window until it's fully loaded
+    // or until the current window passes away
+    window[uri] = window.openDialog(uri, "", features || "all,dialog=no");
+    window[uri].addEventListener("load", newWindowLoaded, false);
+    window.addEventListener("unload", newWindowLoaded, false);
+  }
+}