Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | function macWindowMenuDidShow() |
michael@0 | 8 | { |
michael@0 | 9 | var windowManagerDS = |
michael@0 | 10 | Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'] |
michael@0 | 11 | .getService(Components.interfaces.nsIWindowDataSource); |
michael@0 | 12 | var sep = document.getElementById("sep-window-list"); |
michael@0 | 13 | // Using double parens to avoid warning |
michael@0 | 14 | while ((sep = sep.nextSibling)) { |
michael@0 | 15 | var url = sep.getAttribute('id'); |
michael@0 | 16 | var win = windowManagerDS.getWindowForResource(url); |
michael@0 | 17 | if (win.document.documentElement.getAttribute("inwindowmenu") == "false") |
michael@0 | 18 | sep.hidden = true; |
michael@0 | 19 | else if (win == window) |
michael@0 | 20 | sep.setAttribute("checked", "true"); |
michael@0 | 21 | } |
michael@0 | 22 | } |
michael@0 | 23 | |
michael@0 | 24 | function toOpenWindow( aWindow ) |
michael@0 | 25 | { |
michael@0 | 26 | // deminiaturize the window, if it's in the Dock |
michael@0 | 27 | if (aWindow.windowState == STATE_MINIMIZED) |
michael@0 | 28 | aWindow.restore(); |
michael@0 | 29 | aWindow.document.commandDispatcher.focusedWindow.focus(); |
michael@0 | 30 | } |
michael@0 | 31 | |
michael@0 | 32 | function ShowWindowFromResource( node ) |
michael@0 | 33 | { |
michael@0 | 34 | var windowManagerDS = |
michael@0 | 35 | Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'] |
michael@0 | 36 | .getService(Components.interfaces.nsIWindowDataSource); |
michael@0 | 37 | |
michael@0 | 38 | var desiredWindow = null; |
michael@0 | 39 | var url = node.getAttribute('id'); |
michael@0 | 40 | desiredWindow = windowManagerDS.getWindowForResource( url ); |
michael@0 | 41 | if (desiredWindow) |
michael@0 | 42 | toOpenWindow(desiredWindow); |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | function zoomWindow() |
michael@0 | 46 | { |
michael@0 | 47 | if (window.windowState == STATE_NORMAL) |
michael@0 | 48 | window.maximize(); |
michael@0 | 49 | else |
michael@0 | 50 | window.restore(); |
michael@0 | 51 | } |