commit c59ae5cf40e497a6c1ba2dcf5ce23716f476dd0f
parent c29322645331858079825555e5b476950c44e01c
Author: Dan Stillman <dstillman@zotero.org>
Date: Sat, 12 Aug 2017 02:49:36 +0200
Add Zotero.openMainWindow()
Opens the main Zotero window if it's not open, which is now possible on
macOS.
Diffstat:
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/chrome/content/zotero/standalone/hiddenWindow.xul b/chrome/content/zotero/standalone/hiddenWindow.xul
@@ -39,6 +39,7 @@
<window id="main-window" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
<script>
+ // Equivalent to Zotero.openMainWindow()
function openMainWindow() {
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js
@@ -1061,6 +1061,17 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
}
+ this.openMainWindow = function () {
+ var prefService = Components.classes["@mozilla.org/preferences-service;1"]
+ .getService(Components.interfaces.nsIPrefBranch);
+ var chromeURI = prefService.getCharPref('toolkit.defaultChromeURI');
+ var flags = prefService.getCharPref("toolkit.defaultChromeFeatures", "chrome,dialog=no,all");
+ var ww = Components.classes['@mozilla.org/embedcomp/window-watcher;1']
+ .getService(Components.interfaces.nsIWindowWatcher);
+ return ww.openWindow(null, chromeURI, '_blank', flags, null);
+ }
+
+
/**
* Launch a file, the best way we can
*/