www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit fb7f9698d36043610fde058e5ebbd214ca5421ca
parent a076edc8361ff955311edcb075a15c69b05bca3e
Author: Dan Stillman <dstillman@zotero.org>
Date:   Fri, 30 Dec 2016 00:56:04 -0500

Move ZoteroStandalone.openInViewer() to Zotero.openInViewer()

Diffstat:
Mchrome/content/zotero/standalone/standalone.js | 32--------------------------------
Mchrome/content/zotero/standalone/standalone.xul | 2+-
Mchrome/content/zotero/xpcom/zotero.js | 32++++++++++++++++++++++++++++++++
Mchrome/content/zotero/zoteroPane.js | 2+-
4 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/chrome/content/zotero/standalone/standalone.js b/chrome/content/zotero/standalone/standalone.js @@ -121,38 +121,6 @@ const ZoteroStandalone = new function() { } } - /** - * Opens a URL in the basic viewer, and optionally run a callback on load - * - * @param {String} uri - * @param {Function} [onLoad] - Function to run once URI is loaded; passed the loaded document - */ - this.openInViewer = function(uri, onLoad) { - var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] - .getService(Components.interfaces.nsIWindowMediator); - var win = wm.getMostRecentWindow("zotero:basicViewer"); - if(win) { - win.loadURI(uri); - } else { - win = window.openDialog("chrome://zotero/content/standalone/basicViewer.xul", - "basicViewer", "chrome,resizable,centerscreen,menubar,scrollbars", uri); - } - if (onLoad) { - let browser - let func = function () { - win.removeEventListener("load", func); - browser = win.document.documentElement.getElementsByTagName('browser')[0]; - browser.addEventListener("pageshow", innerFunc); - }; - let innerFunc = function () { - browser.removeEventListener("pageshow", innerFunc); - onLoad(browser.contentDocument); - }; - win.addEventListener("load", func); - - } - } - this.updateAddonsPane = function (doc) { // Hide unsigned add-on verification warnings // diff --git a/chrome/content/zotero/standalone/standalone.xul b/chrome/content/zotero/standalone/standalone.xul @@ -168,7 +168,7 @@ command="cmd_zotero_rtfScan"/> <menuseparator/> <menuitem id="menu_addons" label="&addons.label;" - oncommand="ZoteroStandalone.openInViewer('chrome://mozapps/content/extensions/extensions.xul', ZoteroStandalone.updateAddonsPane)"/> + oncommand="Zotero.openInViewer('chrome://mozapps/content/extensions/extensions.xul', ZoteroStandalone.updateAddonsPane)"/> <!--<menuitem label="Error Console" oncommand="toJavaScriptConsole()"/>--> </menupopup> </menu> diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js @@ -992,6 +992,38 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js"); } + /** + * Opens a URL in the basic viewer, and optionally run a callback on load + * + * @param {String} uri + * @param {Function} [onLoad] - Function to run once URI is loaded; passed the loaded document + */ + this.openInViewer = function (uri, onLoad) { + var wm = Services.wm; + var win = wm.getMostRecentWindow("zotero:basicViewer"); + if (win) { + win.loadURI(uri); + } else { + let window = wm.getMostRecentWindow("navigator:browser"); + win = window.openDialog("chrome://zotero/content/standalone/basicViewer.xul", + "basicViewer", "chrome,resizable,centerscreen,menubar,scrollbars", uri); + } + if (onLoad) { + let browser + let func = function () { + win.removeEventListener("load", func); + browser = win.document.documentElement.getElementsByTagName('browser')[0]; + browser.addEventListener("pageshow", innerFunc); + }; + let innerFunc = function () { + browser.removeEventListener("pageshow", innerFunc); + onLoad(browser.contentDocument); + }; + win.addEventListener("load", func); + } + }; + + /* * Debug logging function * diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js @@ -3195,7 +3195,7 @@ var ZoteroPane = new function() if(uri.match(/^https?/)) { this.launchURL(uri); } else { - ZoteroStandalone.openInViewer(uri); + Zotero.openInViewer(uri); } return; }