toolkit/content/macWindowMenu.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/content/macWindowMenu.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +// -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 +
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +function macWindowMenuDidShow()
    1.11 +{
    1.12 +  var windowManagerDS =
    1.13 +    Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator']
    1.14 +              .getService(Components.interfaces.nsIWindowDataSource);
    1.15 +  var sep = document.getElementById("sep-window-list");
    1.16 +  // Using double parens to avoid warning
    1.17 +  while ((sep = sep.nextSibling)) {
    1.18 +    var url = sep.getAttribute('id');
    1.19 +    var win = windowManagerDS.getWindowForResource(url);
    1.20 +    if (win.document.documentElement.getAttribute("inwindowmenu") == "false")
    1.21 +      sep.hidden = true;
    1.22 +    else if (win == window)
    1.23 +      sep.setAttribute("checked", "true");
    1.24 +  }
    1.25 +}
    1.26 +
    1.27 +function toOpenWindow( aWindow )
    1.28 +{
    1.29 +  // deminiaturize the window, if it's in the Dock
    1.30 +  if (aWindow.windowState == STATE_MINIMIZED)
    1.31 +    aWindow.restore();
    1.32 +  aWindow.document.commandDispatcher.focusedWindow.focus();
    1.33 +}
    1.34 +
    1.35 +function ShowWindowFromResource( node )
    1.36 +{
    1.37 +  var windowManagerDS =
    1.38 +    Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator']
    1.39 +              .getService(Components.interfaces.nsIWindowDataSource);
    1.40 +
    1.41 +  var desiredWindow = null;
    1.42 +  var url = node.getAttribute('id');
    1.43 +  desiredWindow = windowManagerDS.getWindowForResource( url );
    1.44 +  if (desiredWindow)
    1.45 +    toOpenWindow(desiredWindow);
    1.46 +}
    1.47 +
    1.48 +function zoomWindow()
    1.49 +{
    1.50 +  if (window.windowState == STATE_NORMAL)
    1.51 +    window.maximize();
    1.52 +  else
    1.53 +    window.restore();
    1.54 +}

mercurial