commit 1475a79cd1450a71de927550faf6e45709677a74
parent 5bdb050b5fe791176eded9e7d8632f78e880d3a1
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 8 Mar 2012 14:32:38 -0500
Open csledit/cslpreview in new tab in existing window in Fx
Fixes #75
Diffstat:
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/chrome/content/zotero/preferences/preferences.js b/chrome/content/zotero/preferences/preferences.js
@@ -1914,7 +1914,7 @@ function handleShowInPreferenceChange() {
/**
* Opens a URI in the basic viewer in Standalone, or a new window in Firefox
*/
-function openInViewer(uri) {
+function openInViewer(uri, newTab) {
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
const features = "menubar=yes,toolbar=no,location=no,scrollbars,centerscreen,resizable";
@@ -1930,7 +1930,11 @@ function openInViewer(uri) {
} else {
var win = wm.getMostRecentWindow("navigator:browser");
if(win) {
- win.open(uri, null, features);
+ if(newTab) {
+ win.gBrowser.selectedTab = win.gBrowser.addTab(uri);
+ } else {
+ win.open(uri, null, features);
+ }
}
else {
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
diff --git a/chrome/content/zotero/preferences/preferences.xul b/chrome/content/zotero/preferences/preferences.xul
@@ -800,9 +800,9 @@ To add a new preference:
<groupbox>
<caption label="&zotero.preferences.miscellaneous;"/>
<hbox align="center">
- <button id="openAboutConfig" label="&zotero.preferences.openAboutConfig;" oncommand="openInViewer('about:config', '')"/>
- <button id="openCSLEdit" label="&zotero.preferences.openCSLEdit;" oncommand="openInViewer('chrome://zotero/content/tools/csledit.xul', '')"/>
- <button id="openCSLPreview" label="&zotero.preferences.openCSLPreview;" oncommand="openInViewer('chrome://zotero/content/tools/cslpreview.xul', '')"/>
+ <button id="openAboutConfig" label="&zotero.preferences.openAboutConfig;" oncommand="openInViewer('about:config')"/>
+ <button id="openCSLEdit" label="&zotero.preferences.openCSLEdit;" oncommand="openInViewer('chrome://zotero/content/tools/csledit.xul', true)"/>
+ <button id="openCSLPreview" label="&zotero.preferences.openCSLPreview;" oncommand="openInViewer('chrome://zotero/content/tools/cslpreview.xul', true)"/>
</hbox>
</groupbox>