Add Zotero.openMainWindow()

Opens the main Zotero window if it's not open, which is now possible on
macOS.
This commit is contained in:
Dan Stillman 2017-08-12 02:49:36 +02:00
parent c293226453
commit c59ae5cf40
2 changed files with 12 additions and 0 deletions

View file

@ -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);

View file

@ -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
*/