michael@0: // -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: function macWindowMenuDidShow() michael@0: { michael@0: var windowManagerDS = michael@0: Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'] michael@0: .getService(Components.interfaces.nsIWindowDataSource); michael@0: var sep = document.getElementById("sep-window-list"); michael@0: // Using double parens to avoid warning michael@0: while ((sep = sep.nextSibling)) { michael@0: var url = sep.getAttribute('id'); michael@0: var win = windowManagerDS.getWindowForResource(url); michael@0: if (win.document.documentElement.getAttribute("inwindowmenu") == "false") michael@0: sep.hidden = true; michael@0: else if (win == window) michael@0: sep.setAttribute("checked", "true"); michael@0: } michael@0: } michael@0: michael@0: function toOpenWindow( aWindow ) michael@0: { michael@0: // deminiaturize the window, if it's in the Dock michael@0: if (aWindow.windowState == STATE_MINIMIZED) michael@0: aWindow.restore(); michael@0: aWindow.document.commandDispatcher.focusedWindow.focus(); michael@0: } michael@0: michael@0: function ShowWindowFromResource( node ) michael@0: { michael@0: var windowManagerDS = michael@0: Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'] michael@0: .getService(Components.interfaces.nsIWindowDataSource); michael@0: michael@0: var desiredWindow = null; michael@0: var url = node.getAttribute('id'); michael@0: desiredWindow = windowManagerDS.getWindowForResource( url ); michael@0: if (desiredWindow) michael@0: toOpenWindow(desiredWindow); michael@0: } michael@0: michael@0: function zoomWindow() michael@0: { michael@0: if (window.windowState == STATE_NORMAL) michael@0: window.maximize(); michael@0: else michael@0: window.restore(); michael@0: }