diff --git a/chrome/content/zotero/bibliography.js b/chrome/content/zotero/bibliography.js index 76c08d09df..f68dfe2d82 100644 --- a/chrome/content/zotero/bibliography.js +++ b/chrome/content/zotero/bibliography.js @@ -124,10 +124,22 @@ var Zotero_File_Interface_Bibliography = new function() { if(document.getElementById("formatUsing")) { if(_io.fieldType == "Bookmark") document.getElementById("formatUsing").selectedIndex = 1; var formatOption = (_io.primaryFieldType == "ReferenceMark" ? "referenceMarks" : "fields"); - document.getElementById("fields").label = Zotero.getString("integration."+formatOption+".label"); - document.getElementById("fields-caption").textContent = Zotero.getString("integration."+formatOption+".caption"); - document.getElementById("fields-file-format-notice").textContent = Zotero.getString("integration."+formatOption+".fileFormatNotice"); - document.getElementById("bookmarks-file-format-notice").textContent = Zotero.getString("integration.fields.fileFormatNotice"); + document.getElementById("fields").label = + Zotero.getString("integration."+formatOption+".label"); + document.getElementById("fields-caption").textContent = + Zotero.getString("integration."+formatOption+".caption"); + document.getElementById("fields-file-format-notice").textContent = + Zotero.getString("integration."+formatOption+".fileFormatNotice"); + document.getElementById("bookmarks-file-format-notice").textContent = + Zotero.getString("integration.fields.fileFormatNotice"); + } + if(document.getElementById("automaticJournalAbbreviations-checkbox")) { + if(_io.automaticJournalAbbreviations === undefined) { + _io.automaticJournalAbbreviations = Zotero.Prefs.get("cite.automaticJournalAbbreviations"); + } + if(_io.automaticJournalAbbreviations) { + document.getElementById("automaticJournalAbbreviations-checkbox").checked = true; + } } if(document.getElementById("storeReferences")) { if(_io.storeReferences || _io.storeReferences === undefined) { @@ -152,23 +164,30 @@ var Zotero_File_Interface_Bibliography = new function() { var selectedItem = document.getElementById("style-listbox").selectedItem; } - var selectedStyle = selectedItem.getAttribute('value'); + var selectedStyle = selectedItem.getAttribute('value'), + selectedStyleObj = Zotero.Styles.get(selectedStyle); // // For integrationDocPrefs.xul // // update status of displayAs box based on style class - if(document.getElementById("displayAs")) { - var isNote = Zotero.Styles.get(selectedStyle).class == "note"; - document.getElementById("displayAs").disabled = !isNote; + if(document.getElementById("displayAs-groupbox")) { + var isNote = selectedStyleObj.class == "note"; + document.getElementById("displayAs-groupbox").hidden = !isNote; + + // update status of formatUsing box based on style class + if(document.getElementById("formatUsing")) { + if(isNote) document.getElementById("formatUsing").selectedIndex = 0; + document.getElementById("bookmarks").disabled = isNote; + document.getElementById("bookmarks-caption").disabled = isNote; + } } - - // update status of formatUsing box based on style class - if(document.getElementById("formatUsing")) { - if(isNote) document.getElementById("formatUsing").selectedIndex = 0; - document.getElementById("bookmarks").disabled = isNote; - document.getElementById("bookmarks-caption").disabled = isNote; + + // update status of displayAs box based on style class + if(document.getElementById("automaticJournalAbbreviations-vbox")) { + document.getElementById("automaticJournalAbbreviations-vbox").hidden = + !selectedStyleObj.usesAbbreviation; } // @@ -184,6 +203,8 @@ var Zotero_File_Interface_Bibliography = new function() { } document.getElementById("citations").label = label; } + + window.sizeToContent(); } function acceptSelection() { @@ -198,8 +219,13 @@ var Zotero_File_Interface_Bibliography = new function() { JSON.stringify({ mode: _io.mode, method: _io.method })); } - // ONLY FOR integrationDocPrefs.xul: collect displayAs + // ONLY FOR integrationDocPrefs.xul: if(document.getElementById("displayAs")) { + var automaticJournalAbbreviationsEl = document.getElementById("automaticJournalAbbreviations-checkbox"); + _io.automaticJournalAbbreviations = automaticJournalAbbreviationsEl.checked; + if(!automaticJournalAbbreviationsEl.hidden && _saveStyle) { + Zotero.Prefs.set("cite.automaticJournalAbbreviations", _io.automaticJournalAbbreviations); + } _io.useEndnotes = document.getElementById("displayAs").selectedIndex; _io.fieldType = (document.getElementById("formatUsing").selectedIndex == 0 ? _io.primaryFieldType : _io.secondaryFieldType); _io.storeReferences = document.getElementById("storeReferences").checked; diff --git a/chrome/content/zotero/browser.js b/chrome/content/zotero/browser.js index 05b065446e..baf7d7c5f8 100644 --- a/chrome/content/zotero/browser.js +++ b/chrome/content/zotero/browser.js @@ -285,7 +285,7 @@ var Zotero_Browser = new function() { var annotationID = Zotero.Annotate.getAnnotationIDFromURL(browser.currentURI.spec); if(annotationID) { if(Zotero.Annotate.isAnnotated(annotationID)) { - window.alert(Zotero.getString("annotations.oneWindowWarning")); + //window.alert(Zotero.getString("annotations.oneWindowWarning")); } else if(!tab.page.annotations) { // enable annotation tab.page.annotations = new Zotero.Annotations(Zotero_Browser, browser, annotationID); diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js index 107e805113..4367a36351 100644 --- a/chrome/content/zotero/fileInterface.js +++ b/chrome/content/zotero/fileInterface.js @@ -473,7 +473,7 @@ var Zotero_File_Interface = new function() { var clipboardService = Components.classes["@mozilla.org/widget/clipboard;1"]. getService(Components.interfaces.nsIClipboard); - var style = Zotero.Styles.get(style).csl; + var style = Zotero.Styles.get(style).getCiteProc(); var citation = {"citationItems":[{id:item.id} for each(item in items)], properties:{}}; // add HTML diff --git a/chrome/content/zotero/integration/addCitationDialog.js b/chrome/content/zotero/integration/addCitationDialog.js index 3b45a36560..34b5e0bfcf 100644 --- a/chrome/content/zotero/integration/addCitationDialog.js +++ b/chrome/content/zotero/integration/addCitationDialog.js @@ -34,6 +34,7 @@ var Zotero_Citation_Dialog = new function () { "suppress-author":["checked", false] }; + var _accepted = false; var _itemData = new Object(); var _multipleSourcesOn = false; var _lastSelected = null; @@ -581,6 +582,8 @@ var Zotero_Citation_Dialog = new function () { * called when accept button is clicked */ function accept() { + if(_accepted) return true; + _getCitation(); var isCustom = _previewShown && io.citation.citationItems.length // if a citation is selected && _originalHTML @@ -600,6 +603,7 @@ var Zotero_Citation_Dialog = new function () { } io.accept(); + _accepted = true; return true; } @@ -607,8 +611,12 @@ var Zotero_Citation_Dialog = new function () { * called when cancel button is clicked */ function cancel() { + if(_accepted) return true; io.citation.citationItems = new Array(); + io.accept(); + _accepted = true; + return true; } /* diff --git a/chrome/content/zotero/integration/addCitationDialog.xul b/chrome/content/zotero/integration/addCitationDialog.xul index 6300f0faba..1888eec78d 100644 --- a/chrome/content/zotero/integration/addCitationDialog.xul +++ b/chrome/content/zotero/integration/addCitationDialog.xul @@ -41,7 +41,7 @@ onunload="doUnload();" ondialogaccept="return Zotero_Citation_Dialog.accept();" ondialogcancel="Zotero_Citation_Dialog.cancel();" - onclose="Zotero_Citation_Dialog.cancel(); event.preventDefault(); event.stopPropagation();" + onclose="Zotero_Citation_Dialog.cancel();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" persist="screenX screenY width height" resizable="true" diff --git a/chrome/content/zotero/integration/editBibliographyDialog.js b/chrome/content/zotero/integration/editBibliographyDialog.js index ee32a3f39c..f9663dde2d 100644 --- a/chrome/content/zotero/integration/editBibliographyDialog.js +++ b/chrome/content/zotero/integration/editBibliographyDialog.js @@ -235,15 +235,18 @@ var Zotero_Bibliography_Dialog = new function () { * Called when OK button is pressed */ this.accept = function() { - _accepted = true; + if(_accepted) return; _updatePreview(true); + _accepted = true; } /** * Called when Cancel button is pressed */ this.close = function() { - if(!_accepted) bibEditInterface.cancel(); + if(_accepted) return; + bibEditInterface.cancel(); + _accepted = true; } /** diff --git a/chrome/content/zotero/integration/editBibliographyDialog.xul b/chrome/content/zotero/integration/editBibliographyDialog.xul index faee0822f6..5b56b6c295 100644 --- a/chrome/content/zotero/integration/editBibliographyDialog.xul +++ b/chrome/content/zotero/integration/editBibliographyDialog.xul @@ -38,7 +38,7 @@ onload="Zotero_Bibliography_Dialog.load();" ondialogaccept="Zotero_Bibliography_Dialog.accept();" ondialogcancel="Zotero_Bibliography_Dialog.close();" - onclose="Zotero_Bibliography_Dialog.close(); event.preventDefault(); event.stopPropagation();" + onclose="Zotero_Bibliography_Dialog.close();" onunload="doUnload();" buttons="extra1,extra2,accept,cancel" buttonpack="end" xmlns:html="http://www.w3.org/1999/xhtml" diff --git a/chrome/content/zotero/integration/integrationDocPrefs.xul b/chrome/content/zotero/integration/integrationDocPrefs.xul index 0a04dbc3ea..8ac6bdbc38 100644 --- a/chrome/content/zotero/integration/integrationDocPrefs.xul +++ b/chrome/content/zotero/integration/integrationDocPrefs.xul @@ -48,7 +48,7 @@ - + @@ -67,9 +67,14 @@ &zotero.integration.prefs.bookmarks.caption; - - - &zotero.integration.prefs.storeReferences.caption; + + + + &zotero.integration.prefs.automaticJournalAbbeviations.caption; + + + + &zotero.integration.prefs.storeReferences.caption; \ No newline at end of file diff --git a/chrome/content/zotero/preferences/preferences_advanced.xul b/chrome/content/zotero/preferences/preferences_advanced.xul index e95bc6aa8b..d0b0cf547d 100644 --- a/chrome/content/zotero/preferences/preferences_advanced.xul +++ b/chrome/content/zotero/preferences/preferences_advanced.xul @@ -112,7 +112,7 @@ - +