diff --git a/chrome/content/zotero/integration/addCitationDialog.js b/chrome/content/zotero/integration/addCitationDialog.js index cb7174e349..a169c8b6cc 100644 --- a/chrome/content/zotero/integration/addCitationDialog.js +++ b/chrome/content/zotero/integration/addCitationDialog.js @@ -492,7 +492,7 @@ var Zotero_Citation_Dialog = new function () { // run preview function to re-sort, if it hasn't already been // run - io.previewFunction(); + io.sort(); // add items back to list scrollToItem = null; @@ -588,22 +588,16 @@ var Zotero_Citation_Dialog = new function () { if(isCustom) { var citation = document.getElementById('editor').value; - } else { - var citation = (io.citation.citationItems.length ? io.previewFunction() : ""); + if(Zotero.Utilities.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; + } + io.citation.properties.custom = citation; } - Zotero.debug("verified not custom"); - - if(Zotero.Utilities.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; - } - Zotero.debug("verified not empty"); - - if(isCustom) io.citation.properties.custom = citation; return true; } diff --git a/chrome/content/zotero/integration/quickFormat.js b/chrome/content/zotero/integration/quickFormat.js index 0187858bb4..c891f1b66d 100644 --- a/chrome/content/zotero/integration/quickFormat.js +++ b/chrome/content/zotero/integration/quickFormat.js @@ -573,7 +573,7 @@ var Zotero_QuickFormat = new function () { if(!shouldKeepSorted && !editorShowing) return; _updateCitationObject(); - io.previewFunction(); + io.sort(); if(shouldKeepSorted) { // means we need to resort citations _clearCitation(); @@ -652,12 +652,26 @@ var Zotero_QuickFormat = new function () { panel.addEventListener("popuphidden", closeListener, false); } + /** + * Called when progress changes + */ + function _onProgress(percent) { + var meter = document.getElementById("quick-format-progress-meter"); + if(percent === null) { + meter.mode = "undetermined"; + } else { + meter.mode = "determined"; + meter.value = Math.round(percent); + } + } + /** * Accepts current selection and adds citation */ function _accept() { _updateCitationObject(); - window.close(); + document.getElementById("quick-format-deck").selectedIndex = 1; + io.accept(_onProgress); } /** @@ -667,7 +681,7 @@ var Zotero_QuickFormat = new function () { var keyCode = event.keyCode; if(keyCode === event.DOM_VK_ESCAPE) { io.citation.citationItems = []; - window.close(); + io.accept(); } } diff --git a/chrome/content/zotero/integration/quickFormat.xul b/chrome/content/zotero/integration/quickFormat.xul index 87e1dd5bac..6cf5b945e1 100644 --- a/chrome/content/zotero/integration/quickFormat.xul +++ b/chrome/content/zotero/integration/quickFormat.xul @@ -43,22 +43,27 @@