From ac53f350569746e8abd9cc095feadfcd3bf405c2 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Fri, 1 May 2009 11:46:07 +0000 Subject: [PATCH] Adds RTF scan feature. this could probably use some more testing. Acceptable citations are in the form (Smith, 2006) The database is scanned for each citation, and positioning is adjusted automatically for footnotes. Currently, this won't work with names with accents, but I'll get to that. --- chrome/content/zotero/bibliography.js | 27 +- chrome/content/zotero/overlay.xul | 1 + chrome/content/zotero/rtfScan.js | 583 ++++++++++++++++++ chrome/content/zotero/rtfScan.xul | 101 +++ chrome/content/zotero/selectItemsDialog.js | 1 + chrome/locale/en-US/zotero/zotero.dtd | 18 +- chrome/locale/en-US/zotero/zotero.properties | 3 +- chrome/skin/default/zotero/rtfscan-accept.png | Bin 0 -> 516 bytes chrome/skin/default/zotero/rtfscan-link.png | Bin 0 -> 614 bytes defaults/preferences/zotero.js | 2 + 10 files changed, 724 insertions(+), 12 deletions(-) create mode 100644 chrome/content/zotero/rtfScan.js create mode 100644 chrome/content/zotero/rtfScan.xul create mode 100755 chrome/skin/default/zotero/rtfscan-accept.png create mode 100755 chrome/skin/default/zotero/rtfscan-link.png diff --git a/chrome/content/zotero/bibliography.js b/chrome/content/zotero/bibliography.js index f4246ab597..4eedf0bbc3 100644 --- a/chrome/content/zotero/bibliography.js +++ b/chrome/content/zotero/bibliography.js @@ -43,11 +43,13 @@ var Zotero_File_Interface_Bibliography = new function() { // Set font size from pref // Affects bibliography.xul and integrationDocPrefs.xul var sbc = document.getElementById('zotero-bibliography-container'); - Zotero.setFontSize(sbc); + if(sbc) Zotero.setFontSize(sbc); - _io = window.arguments[0]; - if(_io.wrappedJSObject){ - _io = _io.wrappedJSObject; + if(window.arguments && window.arguments.length) { + _io = window.arguments[0]; + if(_io.wrappedJSObject) _io = _io.wrappedJSObject; + } else { + _io = {}; } var listbox = document.getElementById("style-listbox"); @@ -103,7 +105,8 @@ var Zotero_File_Interface_Bibliography = new function() { if(document.getElementById("displayAs")) { if(_io.useEndnotes && _io.useEndnotes == 1) document.getElementById("displayAs").selectedIndex = 1; styleChanged(selectIndex); - + } + if(document.getElementById("formatUsing")) { if(_io.useBookmarks && _io.useBookmarks == 1) document.getElementById("formatUsing").selectedIndex = 1; if(_io.openOffice) { var formatOption = "referenceMarks"; @@ -139,13 +142,17 @@ var Zotero_File_Interface_Bibliography = new function() { var selectedStyle = selectedItem.getAttribute('value'); // update status of displayAs box based on style class - var isNote = Zotero.Styles.get(selectedStyle).class == "note"; - document.getElementById("displayAs").disabled = !isNote; + if(document.getElementById("displayAs")) { + var isNote = Zotero.Styles.get(selectedStyle).class == "note"; + document.getElementById("displayAs").disabled = !isNote; + } // update status of formatUsing box based on style class - if(isNote) document.getElementById("formatUsing").selectedIndex = 0; - document.getElementById("bookmarks").disabled = isNote; - document.getElementById("bookmarks-caption").disabled = isNote; + if(document.getElementById("formatUsing")) { + if(isNote) document.getElementById("formatUsing").selectedIndex = 0; + document.getElementById("bookmarks").disabled = isNote; + document.getElementById("bookmarks-caption").disabled = isNote; + } } function acceptSelection() { diff --git a/chrome/content/zotero/overlay.xul b/chrome/content/zotero/overlay.xul index ff634a7e80..b1e015a435 100644 --- a/chrome/content/zotero/overlay.xul +++ b/chrome/content/zotero/overlay.xul @@ -124,6 +124,7 @@ +