Merge branch '4.0'

Conflicts:
	chrome/content/zotero/xpcom/zotero.js
	install.rdf
	update.rdf
This commit is contained in:
Dan Stillman 2014-09-08 20:24:44 -04:00
commit 3d7a35addc
11 changed files with 59 additions and 41 deletions

View file

@ -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;
}

@ -1 +1 @@
Subproject commit 6c4c38a013f58dea82d683e4c8b70ff25da8172c
Subproject commit 76af9741424cc1432ffa0165d7b7bd5bbebe0d26

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -910,6 +910,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;
@ -1040,11 +1043,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;
@ -1530,7 +1542,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
*/
@ -1602,6 +1614,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);
}
}

View file

@ -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

View file

@ -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",

View file

@ -1 +1 @@
2014-06-24 00:00:01
2014-09-01 18:06:00

2
styles

@ -1 +1 @@
Subproject commit feb40111bacae97b61cfbf8b4948054ead1b4570
Subproject commit c8aed347aed9a6350a48f3d6f9d4b0df13fc1f6f

@ -1 +1 @@
Subproject commit 1c919d5c3d9e6be7106c36cbacd34ae850167497
Subproject commit 821eda178b2fe1c7e7bbabc5d7a3113923a4f9c7