Open csledit/cslpreview in new tab in existing window in Fx

Fixes #75
This commit is contained in:
Dan Stillman 2012-03-08 14:32:38 -05:00
parent 5bdb050b5f
commit 1475a79cd1
2 changed files with 9 additions and 5 deletions

View file

@ -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"]

View file

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