From a97d7ff26dfbef85fa96cf067bc0e3328ed070fb Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Thu, 4 Aug 2011 19:32:05 +0000 Subject: [PATCH] Add button to open about:config to advanced preferences pane. We could disable this for Zotero for Firefox, but I think it's probably a better idea to keep it so that docs can be made consistent. --- .../content/zotero/preferences/preferences.js | 55 ++++++++++--------- .../zotero/preferences/preferences.xul | 5 ++ 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/chrome/content/zotero/preferences/preferences.js b/chrome/content/zotero/preferences/preferences.js index 5b276a33a..e3f2d389f 100644 --- a/chrome/content/zotero/preferences/preferences.js +++ b/chrome/content/zotero/preferences/preferences.js @@ -1324,31 +1324,7 @@ Zotero_Preferences.Debug_Output = { view: function () { - const uri = "zotero://debug/"; - const features = "menubar=yes,toolbar=no,location=no,scrollbars,centerscreen,resizable"; - - var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] - .getService(Components.interfaces.nsIWindowMediator); - - if(Zotero.isStandalone) { - var win = wm.getMostRecentWindow("zotero:basicViewer"); - if(win) { - win.loadURI(uri); - } else { - window.openDialog("chrome://zotero/content/standalone/basicViewer.xul", - "basicViewer", "chrome,resizable,centerscreen", uri); - } - } else { - var win = wm.getMostRecentWindow("navigator:browser"); - if(win) { - win.open(uri, null, features); - } - else { - var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"] - .getService(Components.interfaces.nsIWindowWatcher); - var win = ww.openWindow(null, uri, null, features + ",width=775,height=575", null); - } - } + openInViewer("zotero://debug/"); }, @@ -1826,4 +1802,33 @@ function handleShowInPreferenceChange() { Zotero.Prefs.set("statusBarIcon", 2); } } +} + +/** + * Opens a URI in the basic viewer in Standalone, or a new window in Firefox + */ +function openInViewer(uri) { + 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"; + + if(Zotero.isStandalone) { + var win = wm.getMostRecentWindow("zotero:basicViewer"); + if(win) { + win.loadURI(uri); + } else { + window.openDialog("chrome://zotero/content/standalone/basicViewer.xul", + "basicViewer", "chrome,resizable,centerscreen", uri); + } + } else { + var win = wm.getMostRecentWindow("navigator:browser"); + if(win) { + win.open(uri, null, features); + } + else { + var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"] + .getService(Components.interfaces.nsIWindowWatcher); + var win = ww.openWindow(null, uri, null, features + ",width=775,height=575", null); + } + } } \ No newline at end of file diff --git a/chrome/content/zotero/preferences/preferences.xul b/chrome/content/zotero/preferences/preferences.xul index b811793e9..3205375d0 100644 --- a/chrome/content/zotero/preferences/preferences.xul +++ b/chrome/content/zotero/preferences/preferences.xul @@ -800,6 +800,11 @@ To add a new preference: + + +