diff --git a/chrome/content/zotero/addCitationDialog.js b/chrome/content/zotero/addCitationDialog.js index 8bcbb760f..5a8fd4ade 100644 --- a/chrome/content/zotero/addCitationDialog.js +++ b/chrome/content/zotero/addCitationDialog.js @@ -73,8 +73,8 @@ var Zotero_Citation_Dialog = new function () { if(io.citation.sortable) { _sortCheckbox = document.getElementById("keepSorted"); _sortCheckbox.hidden = false; - _sortCheckbox.checked = true; - io.citation.properties.sort = true; + if(io.citation.properties.sort === undefined) io.citation.properties.sort = true; + _sortCheckbox.checked = io.citation.properties.sort; } // load locators @@ -345,10 +345,27 @@ var Zotero_Citation_Dialog = new function () { */ function accept() { _getCitation(); - if(_previewShown && io.citation.citationItems.length // if a citation is selected - && document.getElementById('editor').value != _originalHTML) { // and citation has been edited - io.citation.properties.custom = document.getElementById('editor').value; + var isCustom = _previewShown && io.citation.citationItems.length // if a citation is selected + && document.getElementById('editor').value != _originalHTML // and citation has been edited + + if(isCustom) { + var citation = document.getElementById('editor').value + } else { + var citation = (io.citation.citationItems.length ? io.previewFunction() : ""); } + + if(Zotero.Utilities.prototype.trim(citation) == "") { + var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] + .getService(Components.interfaces.nsIPromptService); + var insert = promptService.confirm(window, + Zotero.getString("integration.emptyCitationWarning.title"), + Zotero.getString("integration.emptyCitationWarning.body")); + if(!insert) return false; + } + + if(isCustom) io.citation.properties.custom = citation; + + return true; } /* diff --git a/chrome/content/zotero/addCitationDialog.xul b/chrome/content/zotero/addCitationDialog.xul index 1dfdb628a..3dc99d1c7 100644 --- a/chrome/content/zotero/addCitationDialog.xul +++ b/chrome/content/zotero/addCitationDialog.xul @@ -33,7 +33,7 @@ width="600" height="450" onload="Zotero_Citation_Dialog.load();" onunload="doUnload();" - ondialogaccept="Zotero_Citation_Dialog.accept();" + ondialogaccept="return Zotero_Citation_Dialog.accept();" ondialogcancel="Zotero_Citation_Dialog.cancel();" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js index 66ec4b29f..92386b0a2 100644 --- a/chrome/content/zotero/overlay.js +++ b/chrome/content/zotero/overlay.js @@ -1534,36 +1534,39 @@ var ZoteroPane = new function() m.attachLink, m.sep2, m.duplicateItem); // If all items can be reindexed, or all items can be recognized, show option - var items = this.getSelectedItems(); - var canIndex = true; - var canRecognize = true; - for (var i=0; i + // element appears within instead of + try { + aCSS.cssRules + } + catch (e) { + var msg = "Unable to access cssRules property of " + aCSS.href + + " in wpdDOMSaver.processCSSRecursively()"; + Zotero.debug(msg, 2); + Components.utils.reportError(msg); + return ""; + } + for ( var i=0; i