Add link to cslPreview.xul and make sure things work in Standalone (and tab mode)

This commit is contained in:
Simon Kornblith 2011-08-24 06:58:42 +00:00
parent 6cdcb8a1fb
commit d382f293ca
4 changed files with 7 additions and 19 deletions

View file

@ -807,6 +807,7 @@ To add a new preference:
<hbox align="center"> <hbox align="center">
<button id="openAboutConfig" label="&zotero.preferences.openAboutConfig;" oncommand="openInViewer('about:config', '')"/> <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="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', '')"/>
</hbox> </hbox>
</groupbox> </groupbox>

View file

@ -37,13 +37,6 @@
<script> <script>
<![CDATA[ <![CDATA[
var Zotero_CSL_Editor = new function() { var Zotero_CSL_Editor = new function() {
var mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindow);
this.init = init; this.init = init;
this.handleKeyPress = handleKeyPress; this.handleKeyPress = handleKeyPress;
this.loadCSL = loadCSL; this.loadCSL = loadCSL;
@ -103,7 +96,7 @@
var editor = document.getElementById('zotero-csl-editor') var editor = document.getElementById('zotero-csl-editor')
var iframe = document.getElementById('zotero-csl-preview-box'); var iframe = document.getElementById('zotero-csl-preview-box');
var items = mainWindow.ZoteroPane.getSelectedItems(); var items = Zotero.getActiveZoteroPane().getSelectedItems();
if (items.length == 0) { if (items.length == 0) {
iframe.contentDocument.documentElement.innerHTML = '<html><head><title></title></head><body><p style="color: red">No references selected in Zotero.</p></body></html>'; iframe.contentDocument.documentElement.innerHTML = '<html><head><title></title></head><body><p style="color: red">No references selected in Zotero.</p></body></html>';
return; return;

View file

@ -40,13 +40,6 @@
default xml namespace = "http://purl.org/net/xbiblio/csl"; default xml namespace = "http://purl.org/net/xbiblio/csl";
var Zotero_CSL_Preview = new function() { var Zotero_CSL_Preview = new function() {
var mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindow);
this.init = init; this.init = init;
this.refresh = refresh; this.refresh = refresh;
this.generateBibliography = generateBibliography; this.generateBibliography = generateBibliography;
@ -56,7 +49,7 @@
} }
function refresh() { function refresh() {
var iframe = document.getElementById('zotero-csl-preview-box'); var iframe = document.getElementById('zotero-csl-preview-box');
var items = mainWindow.ZoteroPane.getSelectedItems(); var items = Zotero.getActiveZoteroPane().getSelectedItems();
if (items.length == 0) { if (items.length == 0) {
iframe.contentDocument.documentElement.innerHTML = '<html><head><title></title></head><body><p style="color: red">No references selected in Zotero.</p></body></html>'; iframe.contentDocument.documentElement.innerHTML = '<html><head><title></title></head><body><p style="color: red">No references selected in Zotero.</p></body></html>';
return; return;
@ -65,7 +58,7 @@
// XXX needs its own string really! // XXX needs its own string really!
progressWin.changeHeadline(Zotero.getString("pane.items.menu.createBib.multiple")); progressWin.changeHeadline(Zotero.getString("pane.items.menu.createBib.multiple"));
var icon = 'chrome://zotero/skin/treeitem-attachment-file.png'; var icon = 'chrome://zotero/skin/treeitem-attachment-file.png';
progressWin.addLines(window.content.document.title, icon) progressWin.addLines(document.title, icon)
progressWin.show(); progressWin.show();
progressWin.startCloseTimer(); progressWin.startCloseTimer();
var f = function() { var f = function() {
@ -94,7 +87,7 @@
function generateBibliography(style) { function generateBibliography(style) {
var iframe = document.getElementById('zotero-csl-preview-box'); var iframe = document.getElementById('zotero-csl-preview-box');
var items = mainWindow.ZoteroPane.getSelectedItems(); var items = Zotero.getActiveZoteroPane().getSelectedItems();
if (items.length == 0) { if (items.length == 0) {
iframe.contentDocument.documentElement.innerHTML = '<html><head><title></title></head><body><p style="color: red">No references selected in Zotero.</p></body></html>'; iframe.contentDocument.documentElement.innerHTML = '<html><head><title></title></head><body><p style="color: red">No references selected in Zotero.</p></body></html>';
return ''; return '';

View file

@ -186,4 +186,5 @@
<!ENTITY zotero.preferences.debugOutputLogging.submitToServer "Submit to Zotero Server"> <!ENTITY zotero.preferences.debugOutputLogging.submitToServer "Submit to Zotero Server">
<!ENTITY zotero.preferences.openAboutConfig "Open about:config"> <!ENTITY zotero.preferences.openAboutConfig "Open about:config">
<!ENTITY zotero.preferences.openCSLEdit "Open csledit.xul"> <!ENTITY zotero.preferences.openCSLEdit "Open CSL Editor">
<!ENTITY zotero.preferences.openCSLPreview "Open CSL Preview">