commit 9b7070ad3866262f0ce6e19a9192676acb067dab
parent 41f3c3a26138dd0e85072790ff6a27ccbfbbe32f
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 27 Jul 2009 11:12:42 +0000
zotero://fullscreen patch from Ben Parr, with a tweak to properly restore unmaximized Zotero pane height when using as home page
Known issue: Window title isn't set correctly
Says Ben:
===========================================
Some uses for this feature include:
- people who don't want to use Firefox as their main browser could set their Firefox homepage to zotero://fullscreen, making Zotero act as a standalone application
- people who do use Firefox could add the link to their Bookmarks Toolbar, and simply Shift-click it to have a Zotero "standalone application"
===========================================
Diffstat:
1 file changed, 48 insertions(+), 0 deletions(-)
diff --git a/components/zotero-protocol-handler.js b/components/zotero-protocol-handler.js
@@ -763,6 +763,51 @@ function ChromeExtensionHandler() {
}
}
};
+
+ /*
+ zotero://fullscreen
+ */
+ var FullscreenExtension = new function() {
+ this.newChannel = newChannel;
+
+ this.__defineGetter__('loadAsChrome', function () { return false; });
+
+ function newChannel(uri) {
+ var Zotero = Components.classes["@zotero.org/Zotero;1"]
+ .getService(Components.interfaces.nsISupports)
+ .wrappedJSObject;
+
+ generateContent: try {
+ var win = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Components.interfaces.nsIWindowMediator)
+ .getMostRecentWindow("navigator:browser");
+ var zp = win.ZoteroPane;
+
+ // When using fullscreen as home page, Zotero pane is reset to
+ // 0 height, so get saved height and set it below
+ var pane = win.document.getElementById('zotero-pane');
+ var height = pane.getAttribute('savedHeight');
+
+ zp.fullScreen(true);
+
+ if(!zp.isShowing()) {
+ zp.toggleDisplay();
+ }
+
+ pane.setAttribute('height', height);
+
+ // FIXME: The above should run in a callback after about:blank
+ // is loaded so that the window title is set correctly, but I
+ // can't get the event handlers to work. - D.S.
+
+ win.loadURI("about:blank");
+ }
+ catch (e) {
+ Zotero.debug(e);
+ throw (e);
+ }
+ }
+ };
var ReportExtensionSpec = ZOTERO_SCHEME + "://report"
@@ -776,6 +821,9 @@ function ChromeExtensionHandler() {
var SelectExtensionSpec = ZOTERO_SCHEME + "://select"
this._extensions[SelectExtensionSpec] = SelectExtension;
+
+ var FullscreenExtensionSpec = ZOTERO_SCHEME + "://fullscreen"
+ this._extensions[FullscreenExtensionSpec] = FullscreenExtension;
}