commit 490d24f43b52a363f38d06d7858bb547db4a7073
parent 9db4927f78e7aed501dc92876500e26e59b79b6e
Author: Dan Stillman <dstillman@zotero.org>
Date: Tue, 9 Sep 2014 00:34:18 -0400
Merge branch 'master' into async_db
Diffstat:
8 files changed, 56 insertions(+), 38 deletions(-)
diff --git a/chrome/content/zotero-platform/win/overlay.css b/chrome/content/zotero-platform/win/overlay.css
@@ -90,7 +90,7 @@
#zotero-view-item {
padding: 0 !important;
-moz-appearance: none;
- background-color: white;
+ background-color: -moz-field;
border-width: 1px 0 0 1px;
}
diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js
@@ -80,7 +80,7 @@ if (!Array.indexOf) {
};
}
var CSL = {
- PROCESSOR_VERSION: "1.0.536",
+ PROCESSOR_VERSION: "1.0.539",
CONDITION_LEVEL_TOP: 1,
CONDITION_LEVEL_BOTTOM: 2,
PLAIN_HYPHEN_REGEX: /(?:[^\\]-|\u2013)/,
@@ -1029,11 +1029,16 @@ CSL.getSortCompare = function (default_locale) {
return CSL.stringCompare;
}
var strcmp;
+ var strcmp_opts = {
+ sensitivity:"base",
+ ignorePunctuation:true,
+ numeric:true
+ }
if (!default_locale) {
default_locale = "en-US";
}
strcmp = function (a, b) {
- return a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase());
+ return a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase(),default_locale,strcmp_opts);
};
var stripPunct = function (str) {
return str.replace(/^[\[\]\'\"]*/g, "");
@@ -4262,6 +4267,7 @@ CSL.getAmbiguousCite = function (Item, disambig, visualForm) {
};
if (this.registry.registry[Item.id]
&& this.registry.citationreg.citationsByItemId
+ && this.registry.citationreg.citationsByItemId[Item.id]
&& this.registry.citationreg.citationsByItemId[Item.id].length
&& visualForm) {
if (this.citation.opt["givenname-disambiguation-rule"] === "by-cite") {
@@ -7362,7 +7368,9 @@ CSL.NameOutput.prototype._runDisambigNames = function (lst, pos) {
param = paramx;
}
if (!this.state.tmp.just_looking && this.item && this.item.position === CSL.POSITION_FIRST) {
- param = paramx;
+ if (paramx > param) {
+ param = paramx;
+ }
}
if (!this.state.tmp.sort_key_flag) {
this.state.tmp.disambig_settings.givens[pos][i] = param;
diff --git a/chrome/content/zotero/xpcom/openurl.js b/chrome/content/zotero/xpcom/openurl.js
@@ -243,6 +243,13 @@ Zotero.OpenURL = new function() {
if(asObj) return entries;
return entries.join("&");
}
+
+ function _cloneIfNecessary(obj1, obj2) {
+ if(Zotero.isFx && !Zotero.isBookmarklet && Zotero.platformMajorVersion >= 32) {
+ return Components.utils.cloneInto(obj1, obj2);
+ }
+ return obj1;
+ }
/*
* Generates an item in the format returned by item.fromArray() given an
@@ -380,14 +387,14 @@ Zotero.OpenURL = new function() {
if(complexAu.length && !lastCreator.lastName && !lastCreator.institutional) {
lastCreator.lastName = value;
} else {
- complexAu.push({lastName:value, creatorType:(key == "rft.aulast" ? "author" : "inventor"), offset:item.creators.length});
+ complexAu.push(_cloneIfNecessary({lastName:value, creatorType:(key == "rft.aulast" ? "author" : "inventor"), offset:item.creators.length}, item));
}
} else if(key == "rft.aufirst" || key == "rft.invfirst") {
var lastCreator = complexAu[complexAu.length-1];
if(complexAu.length && !lastCreator.firstName && !lastCreator.institutional) {
lastCreator.firstName = value;
} else {
- complexAu.push({firstName:value, creatorType:(key == "rft.aufirst" ? "author" : "inventor"), offset:item.creators.length});
+ complexAu.push(_cloneIfNecessary({firstName:value, creatorType:(key == "rft.aufirst" ? "author" : "inventor"), offset:item.creators.length}, item));
}
} else if(key == "rft.au" || key == "rft.creator" || key == "rft.contributor" || key == "rft.inventor") {
if(key == "rft.contributor") {
@@ -398,13 +405,9 @@ Zotero.OpenURL = new function() {
var type = "author";
}
- if(value.indexOf(",") !== -1) {
- item.creators.push(Zotero.Utilities.cleanAuthor(value, type, true));
- } else {
- item.creators.push(Zotero.Utilities.cleanAuthor(value, type, false));
- }
+ item.creators.push(_cloneIfNecessary(Zotero.Utilities.cleanAuthor(value, type, value.indexOf(",") !== -1), item));
} else if(key == "rft.aucorp") {
- complexAu.push({lastName:value, isInstitution:true});
+ complexAu.push(_cloneIfNecessary({lastName:value, isInstitution:true}, item));
} else if(key == "rft.isbn" && !item.ISBN) {
item.ISBN = value;
} else if(key == "rft.pub" || key == "rft.publisher") {
@@ -475,17 +478,18 @@ Zotero.OpenURL = new function() {
var pushMe = true;
var offset = complexAu[i].offset;
delete complexAu[i].offset;
- for(var j=0; j<item.creators.length; j++) {
- // if there's a plain author that is close to this author (the
- // same last name, and the same first name up to a point), keep
- // the plain author, since it might have a middle initial
- if(item.creators[j].lastName == complexAu[i].lastName &&
- (item.creators[j].firstName == complexAu[i].firstName == "" ||
- (item.creators[j].firstName.length >= complexAu[i].firstName.length &&
- item.creators[j].firstName.substr(0, complexAu[i].firstName.length) == complexAu[i].firstName))) {
- pushMe = false;
- break;
- }
+ for (var j = 0; j < item.creators.length; j++) {
+ // if there's a plain author that is close to this author (the
+ // same last name, and the same first name up to a point), keep
+ // the plain author, since it might have a middle initial
+ if (item.creators[j].lastName == complexAu[i].lastName &&
+ item.creators[j].firstName &&
+ ((item.creators[j].firstName == "" && complexAu[i].firstName == "") ||
+ (item.creators[j].firstName.length >= complexAu[i].firstName.length &&
+ item.creators[j].firstName.substr(0, complexAu[i].firstName.length) == complexAu[i].firstName))) {
+ pushMe = false;
+ break;
+ }
}
// Splice in the complex creator at the correct location,
// accounting for previous insertions
diff --git a/chrome/content/zotero/xpcom/translation/translate_firefox.js b/chrome/content/zotero/xpcom/translation/translate_firefox.js
@@ -462,16 +462,6 @@ Zotero.Translate.SandboxManager.prototype = {
if(isFunction) {
attachTo[localKey] = function() {
var args = Array.prototype.slice.apply(arguments);
- if(Zotero.platformMajorVersion >= 32) {
- // This is necessary on Nightly and works
- // fine on 31, but apparently breaks
- // ZU.xpath in an unusual way on 24
- for(var i=0; i<args.length; i++) {
- if(typeof args[i] === "object" && args[i] !== null && args[i].wrappedJSObject) {
- args[i] = args[i].wrappedJSObject;
- }
- }
- }
if(passAsFirstArgument) args.unshift(passAsFirstArgument);
return me._copyObject(object[localKey].apply(object, args));
};
@@ -512,7 +502,7 @@ Zotero.Translate.SandboxManager.prototype = {
"_copyObject":function(obj, wm) {
if(!this._canCopy(obj)) return obj
if(!wm) wm = new WeakMap();
- var obj2 = (obj instanceof Array ? this.sandbox.Array() : this.sandbox.Object());
+ var obj2 = (obj.constructor.name === "Array" ? this.sandbox.Array() : this.sandbox.Object());
var wobj2 = obj2.wrappedJSObject ? obj2.wrappedJSObject : obj2;
for(var i in obj) {
if(!obj.hasOwnProperty(i)) continue;
diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js
@@ -968,6 +968,9 @@ Zotero.Utilities = {
* @param {Function} onDone Function to call when done
*/
"processAsync":function (sets, callbacks, onDone) {
+ if(sets.wrappedJSObject) sets = sets.wrappedJSObject;
+ if(callbacks.wrappedJSObject) callbacks = callbacks.wrappedJSObject;
+
var currentSet;
var index = 0;
@@ -1098,11 +1101,20 @@ Zotero.Utilities = {
var results = [];
for(var i=0, n=elements.length; i<n; i++) {
- var element = elements[i];
+ // For some reason, if elements is wrapped by an object
+ // Xray, we won't be able to unwrap the DOMWrapper around
+ // the element. So waive the object Xray.
+ var element = elements.wrappedJSObject ? elements.wrappedJSObject[i] : elements[i];
// Firefox 5 hack, so we will preserve Fx5DOMWrappers
var isWrapped = Zotero.Translate.DOMWrapper && Zotero.Translate.DOMWrapper.isWrapped(element);
if(isWrapped) element = Zotero.Translate.DOMWrapper.unwrap(element);
+
+ // We waived the object Xray above, which will waive the
+ // DOM Xray, so make sure we have a DOM Xray wrapper.
+ if(Zotero.isFx) {
+ element = new XPCNativeWrapper(element);
+ }
if(element.ownerDocument) {
var rootDoc = element.ownerDocument;
@@ -1588,7 +1600,7 @@ Zotero.Utilities = {
},
/**
- * Converts an item in CSL JSON format to a Zotero tiem
+ * Converts an item in CSL JSON format to a Zotero item
* @param {Zotero.Item} item
* @param {Object} cslItem
*/
@@ -1660,6 +1672,9 @@ Zotero.Utilities = {
item.setCreator(item.getCreators().length, creator, creatorTypeID);
} else {
creator.creatorType = Zotero.CreatorTypes.getName(creatorTypeID);
+ if(Zotero.isFx && !Zotero.isBookmarklet && Zotero.platformMajorVersion >= 32) {
+ creator = Components.utils.cloneInto(creator, item);
+ }
item.creators.push(creator);
}
}
diff --git a/chrome/skin/default/zotero/bindings/tagselector.css b/chrome/skin/default/zotero/bindings/tagselector.css
@@ -11,7 +11,7 @@ groupbox
overflow-x: hidden;
overflow-y: auto;
display: block; /* allow labels to wrap instead of all being in one line */
- background-color: white;
+ background-color: -moz-field;
}
checkbox
diff --git a/resource/schema/renamed-styles.json b/resource/schema/renamed-styles.json
@@ -23,6 +23,7 @@
"annual-reviews-alphabetically": "annual-reviews-alphabetical",
"annual-reviews-by-appearance": "annual-reviews",
"apa5th": "apa-5th-edition",
+ "apa-fr": "apa-fr-provost",
"apsa": "american-political-science-association",
"archives-of-dermatology": "jama-dermatology",
"asa": "american-sociological-association",
diff --git a/resource/schema/repotime.txt b/resource/schema/repotime.txt
@@ -1 +1 @@
-2014-06-24 00:00:01
+2014-09-01 18:06:00