diff --git a/Zotero.dot.dmg b/Zotero.dot.dmg index ff34aeeb0..f11d8530a 100644 Binary files a/Zotero.dot.dmg and b/Zotero.dot.dmg differ diff --git a/chrome/chromeFiles/content/scholar/xpcom/cite.js b/chrome/chromeFiles/content/scholar/xpcom/cite.js index 1053bae92..9f8e02bc8 100644 --- a/chrome/chromeFiles/content/scholar/xpcom/cite.js +++ b/chrome/chromeFiles/content/scholar/xpcom/cite.js @@ -108,9 +108,19 @@ CSL = function(csl) { * set items - convert to array and pre-process */ CSL.prototype.setItems = function(items) { + // create a serialized string of all of the unique items var serializedItemString = ""; + + this._items = items; + this._uniqueItems = new Array(); + var existingItems = new Object(); for each(var item in items) { - serializedItemString += item.getID()+","; + var itemID = item.getID(); + if(!existingItems[itemID]) { + existingItems[itemID] = true; + this._uniqueItems.push(item); + serializedItemString += itemID+","; + } } Scholar.debug("CSL: items set to "+serializedItemString); @@ -118,7 +128,6 @@ CSL.prototype.setItems = function(items) { if(serializedItemString != this._serializedItemString) { // only re-process if there are new items this._serializedItemString = serializedItemString; - this._items = items; this._preprocessItems(); } } @@ -192,8 +201,8 @@ CSL.prototype.createBibliography = function(format) { output += "\r\n"; } - for(var i in this._items) { - var item = this._items[i]; + for(var i in this._uniqueItems) { + var item = this._uniqueItems[i]; var string = this._getCitation(item, format, this._bib); @@ -991,8 +1000,8 @@ CSL.prototype._lpad = function(string, pad, length) { */ CSL.prototype._preprocessItems = function() { // get data necessary to generate citations before sorting - for(var i in this._items) { - var item = this._items[i]; + for(var i in this._uniqueItems) { + var item = this._uniqueItems[i]; if(!item._csl) { // namespace everything in item._csl so there's no chance of overlap @@ -1016,9 +1025,9 @@ CSL.prototype._preprocessItems = function() { // sort by sort order if(this._bib.sortOrder) { - Scholar.debug("CSL: sorting this._items"); + Scholar.debug("CSL: sorting items"); var me = this; - this._items.sort(function(a, b) { + this._uniqueItems.sort(function(a, b) { return me._compareItem(a, b); }); } @@ -1027,8 +1036,8 @@ CSL.prototype._preprocessItems = function() { var usedCitations = new Array(); var lastAuthor; - for(var i in this._items) { - var item = this._items[i]; + for(var i in this._uniqueItems) { + var item = this._uniqueItems[i]; var author = this._getFieldValue("author", this._getFieldDefaults("author"), diff --git a/scrapers.sql b/scrapers.sql index 09cf7b7d2..9110c0ccf 100644 --- a/scrapers.sql +++ b/scrapers.sql @@ -5930,15 +5930,19 @@ REPLACE INTO "csl" VALUES('http://purl.org/net/xbiblio/csl/styles/apa.csl', '200 Simon Kornblith simon@simonster.com - 2006-08-19T17:12:00-05:00 + + Johan Kool + johankool@users.sourceforge.net + + 2006-08-24T16:30:00+01:00 - + - +