Fixes #1757, VIew Debug output doesn't work in standalone

This commit is contained in:
Simon Kornblith 2011-07-02 05:51:29 +00:00
parent 7b41d76b75
commit 50cc1fcb71
3 changed files with 217 additions and 11 deletions

View file

@ -1319,19 +1319,30 @@ Zotero_Preferences.Debug_Output = {
view: function () {
var uri = "zotero://debug/";
var features = "menubar=yes,toolbar=no,location=no,scrollbars,centerscreen,resizable";
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);
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);
.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);
}
}
},

View file

@ -0,0 +1,43 @@
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2011 Center for History and New Media
George Mason University, Fairfax, Virginia, USA
http://zotero.org
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
var browser;
function loadURI() {
browser.loadURI.apply(browser, arguments);
}
window.addEventListener("load", function() {
browser = document.getElementById('my-browser');
// align page title with title of shown document
browser.addEventListener("pageshow", function() {
document.title = (browser.contentDocument.title
? browser.contentDocument.title
: browser.contentDocument.location.href);
}, false);
// show document
browser.loadURI.apply(browser, window.arguments);
}, false);

View file

@ -0,0 +1,152 @@
<?xml version="1.0"?>
<!--
***** BEGIN LICENSE BLOCK *****
Copyright © 2011 Center for History and New Media
George Mason University, Fairfax, Virginia, USA
http://zotero.org
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
-->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?>
<?xml-stylesheet href="chrome://zotero/skin/standalone.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
<?xul-overlay href="chrome://zotero-platform/content/standalone/menuOverlay.xul"?>
<!DOCTYPE window [
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd"> %globalDTD;
<!ENTITY % charsetDTD SYSTEM "chrome://global/locale/charsetOverlay.dtd" > %charsetDTD;
<!ENTITY % textcontextDTD SYSTEM "chrome://global/locale/textcontext.dtd" > %textcontextDTD;
<!ENTITY % standaloneDTD SYSTEM "chrome://zotero/locale/standalone/standalone.dtd" > %standaloneDTD;
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" > %brandDTD;
<!ENTITY % zoteroDTD SYSTEM "chrome://zotero/locale/zotero.dtd"> %zoteroDTD;
]>
<window id="main-window"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="window.sizeToContent()"
windowtype="zotero:basicViewer"
title="&brandShortName;"
width="900" height="500"
persist="screenX screenY width height sizemode">
<script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
<script type="application/javascript" src="chrome://global/content/contentAreaUtils.js"/>
<script type="application/javascript" src="chrome://global/content/inlineSpellCheckUI.js"/>
<script type="application/javascript" src="chrome://zotero/content/include.js"/>
<script type="application/javascript" src="basicViewer.js"/>
<commandset id="mainCommandSet">
<!--FILE-->
<command id="cmd_quitApplication" oncommand="goQuitApplication();"/>
<command id="cmd_close" oncommand="window.close();"/>
<!--EDIT-->
<commandset id="editMenuCommands"/>
<command id="cmd_find"
oncommand="document.getElementById('zotero-tb-search').focus();"/>
</commandset>
<keyset id="mainKeyset">
<key id="key_close" key="&closeCmd.key;" command="cmd_close" modifiers="accel"/>
</keyset>
<keyset id="editMenuKeys"/>
<popup id="contentAreaContextMenu">
<menuitem id="context-undo"
label="&undoCmd.label;"
accesskey="&undoCmd.accesskey;"
command="cmd_undo"/>
<menuseparator id="context-sep-undo"/>
<menuitem id="context-cut"
label="&cutCmd.label;"
accesskey="&cutCmd.accesskey;"
command="cmd_cut"/>
<menuitem id="context-copy"
label="&copyCmd.label;"
accesskey="&copyCmd.accesskey;"
command="cmd_copy"/>
<menuitem id="context-paste"
label="&pasteCmd.label;"
accesskey="&pasteCmd.accesskey;"
command="cmd_paste"/>
<menuitem id="context-delete"
label="&deleteCmd.label;"
accesskey="&deleteCmd.accesskey;"
command="cmd_delete"/>
<menuseparator id="context-sep-paste"/>
<menuitem id="context-selectall"
label="&selectAllCmd.label;"
accesskey="&selectAllCmd.accesskey;"
command="cmd_selectAll"/>
</popup>
<toolbox id="navigator-toolbox" class="toolbox-top" mode="icons" defaultmode="icons">
<!-- Menu -->
<toolbar type="menubar" id="toolbar-menubar" class="chromeclass-menubar" customizable="true"
defaultset="menubar-items"
mode="icons" iconsize="small" defaulticonsize="small"
context="toolbar-context-menu">
<toolbaritem id="menubar-items" align="center">
<menubar id="main-menubar"
style="border:0px;padding:0px;margin:0px;-moz-appearance:none">
<menu id="fileMenu" label="&fileMenu.label;" accesskey="&fileMenu.accesskey;">
<menupopup id="menu_FilePopup">
<menuitem id="menu_close" label="&closeCmd.label;" key="key_close"
accesskey="&closeCmd.accesskey;" command="cmd_close"/>
</menupopup>
</menu>
<menu id="editMenu" label="&editMenu.label;" accesskey="&editMenu.accesskey;">
<menupopup id="menu_EditPopup">
<menuitem id="menu_undo"/>
<menuitem id="menu_redo"/>
<menuseparator/>
<menuitem id="menu_cut"/>
<menuitem id="menu_copy" label="&copyCmd.label;"
key="key_copy" accesskey="&copyCmd.accesskey;"
command="cmd_copy"/>
<menuitem id="menu_paste"/>
<menuitem id="menu_delete"/>
<menuseparator/>
<menuitem id="menu_selectAll"/>
<menuseparator/>
<menuitem id="menu_find"/>
<menuseparator hidden="true" id="textfieldDirection-separator"/>
<menuitem id="textfieldDirection-swap"
command="cmd_switchTextDirection"
key="key_switchTextDirection"
label="&bidiSwitchTextDirectionItem.label;"
accesskey="&bidiSwitchTextDirectionItem.accesskey;"
hidden="true"/>
</menupopup>
</menu>
<menu id="windowMenu" />
</menubar>
</toolbaritem>
</toolbar>
</toolbox>
<hbox flex="1" id="browser">
<vbox id="appcontent" flex="1">
<browser id="my-browser" type="content" flex="1"/>
</vbox>
</hbox>
</window>