Merge branch '3.0'
Conflicts: chrome/content/zotero/xpcom/translation/translate_firefox.js chrome/content/zotero/xpcom/zotero.js install.rdf update.rdf
This commit is contained in:
commit
723213f11f
7 changed files with 81 additions and 61 deletions
|
@ -57,7 +57,7 @@ if (!Array.indexOf) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
var CSL = {
|
var CSL = {
|
||||||
PROCESSOR_VERSION: "1.0.351",
|
PROCESSOR_VERSION: "1.0.353",
|
||||||
STATUTE_SUBDIV_GROUPED_REGEX: /((?:^| )(?:art|ch|Ch|subch|p|pp|para|subpara|pt|r|sec|subsec|Sec|sch|tit)\.)/g,
|
STATUTE_SUBDIV_GROUPED_REGEX: /((?:^| )(?:art|ch|Ch|subch|p|pp|para|subpara|pt|r|sec|subsec|Sec|sch|tit)\.)/g,
|
||||||
STATUTE_SUBDIV_PLAIN_REGEX: /(?:(?:^| )(?:art|ch|Ch|subch|p|pp|para|subpara|pt|r|sec|subsec|Sec|sch|tit)\.)/,
|
STATUTE_SUBDIV_PLAIN_REGEX: /(?:(?:^| )(?:art|ch|Ch|subch|p|pp|para|subpara|pt|r|sec|subsec|Sec|sch|tit)\.)/,
|
||||||
STATUTE_SUBDIV_STRINGS: {
|
STATUTE_SUBDIV_STRINGS: {
|
||||||
|
@ -9590,7 +9590,7 @@ CSL.Transform = function (state) {
|
||||||
secondary_tok.strings.prefix = " ";
|
secondary_tok.strings.prefix = " ";
|
||||||
}
|
}
|
||||||
for (var i = secondary_tok.decorations.length - 1; i > -1; i += -1) {
|
for (var i = secondary_tok.decorations.length - 1; i > -1; i += -1) {
|
||||||
if (secondary_tok.decorations[i][0] === '@quotes') {
|
if (['@quotes/true','@font-style/italic','@font-style/oblique','@font-weight/bold'].indexOf(secondary_tok.decorations[i].join('/')) > -1) {
|
||||||
secondary_tok.decorations = secondary_tok.decorations.slice(0, i).concat(secondary_tok.decorations.slice(i + 1))
|
secondary_tok.decorations = secondary_tok.decorations.slice(0, i).concat(secondary_tok.decorations.slice(i + 1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9604,7 +9604,7 @@ CSL.Transform = function (state) {
|
||||||
tertiary_tok.strings.prefix = " ";
|
tertiary_tok.strings.prefix = " ";
|
||||||
}
|
}
|
||||||
for (var i = tertiary_tok.decorations.length - 1; i > -1; i += -1) {
|
for (var i = tertiary_tok.decorations.length - 1; i > -1; i += -1) {
|
||||||
if (tertiary_tok.decorations[i][0] === '@quotes') {
|
if (['@quotes/true','@font-style/italic','@font-style/oblique','@font-weight/bold'].indexOf(tertiary_tok.decorations[i].join('/')) > -1) {
|
||||||
tertiary_tok.decorations = tertiary_tok.decorations.slice(0, i).concat(tertiary_tok.decorations.slice(i + 1))
|
tertiary_tok.decorations = tertiary_tok.decorations.slice(0, i).concat(tertiary_tok.decorations.slice(i + 1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10531,66 +10531,83 @@ CSL.Util.Dates.year.numeric = function (state, num) {
|
||||||
}
|
}
|
||||||
return (pre + num);
|
return (pre + num);
|
||||||
};
|
};
|
||||||
CSL.Util.Dates.month = {};
|
CSL.Util.Dates.normalizeMonth = function (num, useSeason) {
|
||||||
CSL.Util.Dates.month.numeric = function (state, num) {
|
var ret;
|
||||||
if (num) {
|
|
||||||
num = parseInt(num, 10);
|
|
||||||
if (num > 12) {
|
|
||||||
num = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var ret = "" + num;
|
|
||||||
return ret;
|
|
||||||
};
|
|
||||||
CSL.Util.Dates.month["numeric-leading-zeros"] = function (state, num) {
|
|
||||||
if (!num) {
|
if (!num) {
|
||||||
num = 0;
|
num = 0;
|
||||||
}
|
}
|
||||||
num = parseInt(num, 10);
|
num = "" + num;
|
||||||
if (num > 12) {
|
if (!num.match(/^[0-9]+$/)) {
|
||||||
num = 0;
|
num = 0;
|
||||||
}
|
}
|
||||||
num = "" + num;
|
num = parseInt(num, 10);
|
||||||
while (num.length < 2) {
|
if (useSeason) {
|
||||||
num = "0" + num;
|
var res = {stub: "month-", num: num};
|
||||||
|
if (res.num < 1 || res.num > 20) {
|
||||||
|
res.num = 0;
|
||||||
|
} else if (res.num > 16) {
|
||||||
|
res.stub = "season-";
|
||||||
|
res.num = res.num - 16;
|
||||||
|
} else if (res.num > 12) {
|
||||||
|
res.stub = "season-";
|
||||||
|
res.num = res.num - 12;
|
||||||
|
}
|
||||||
|
ret = res;
|
||||||
|
} else {
|
||||||
|
if (num < 1 || num > 12) {
|
||||||
|
num = 0;
|
||||||
|
}
|
||||||
|
ret = num;
|
||||||
}
|
}
|
||||||
return num.toString();
|
return ret;
|
||||||
|
}
|
||||||
|
CSL.Util.Dates.month = {};
|
||||||
|
CSL.Util.Dates.month.numeric = function (state, num) {
|
||||||
|
var num = CSL.Util.Dates.normalizeMonth(num);
|
||||||
|
if (!num) {
|
||||||
|
num = "";
|
||||||
|
}
|
||||||
|
return num;
|
||||||
|
};
|
||||||
|
CSL.Util.Dates.month["numeric-leading-zeros"] = function (state, num) {
|
||||||
|
var num = CSL.Util.Dates.normalizeMonth(num);
|
||||||
|
if (!num) {
|
||||||
|
num = "";
|
||||||
|
} else {
|
||||||
|
num = "" + num;
|
||||||
|
while (num.length < 2) {
|
||||||
|
num = "0" + num;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return num;
|
||||||
};
|
};
|
||||||
CSL.Util.Dates.month["long"] = function (state, num) {
|
CSL.Util.Dates.month["long"] = function (state, num) {
|
||||||
var stub = "month-";
|
var res = CSL.Util.Dates.normalizeMonth(num, true);
|
||||||
num = parseInt(num, 10);
|
var num = res.num;
|
||||||
if (num > 12) {
|
if (!num) {
|
||||||
stub = "season-";
|
num = "";
|
||||||
if (num > 16) {
|
} else {
|
||||||
num = num - 16;
|
num = "" + num;
|
||||||
} else {
|
while (num.length < 2) {
|
||||||
num = num - 12;
|
num = "0" + num;
|
||||||
}
|
}
|
||||||
|
num = state.getTerm(res.stub + num, "long", 0);
|
||||||
}
|
}
|
||||||
num = "" + num;
|
return num;
|
||||||
while (num.length < 2) {
|
|
||||||
num = "0" + num;
|
|
||||||
}
|
|
||||||
num = stub + num;
|
|
||||||
return state.getTerm(num, "long", 0);
|
|
||||||
};
|
};
|
||||||
CSL.Util.Dates.month["short"] = function (state, num) {
|
CSL.Util.Dates.month["short"] = function (state, num) {
|
||||||
var stub = "month-";
|
var res = CSL.Util.Dates.normalizeMonth(num, true);
|
||||||
num = parseInt(num, 10);
|
var num = res.num;
|
||||||
if (num > 12) {
|
if (!num) {
|
||||||
stub = "season-";
|
num = "";
|
||||||
if (num > 16) {
|
} else {
|
||||||
num = num - 16;
|
num = "" + num;
|
||||||
} else {
|
while (num.length < 2) {
|
||||||
num = num - 12;
|
num = "0" + num;
|
||||||
}
|
}
|
||||||
|
num = state.getTerm(res.stub + num, "short", 0);
|
||||||
}
|
}
|
||||||
num = "" + num;
|
return num;
|
||||||
while (num.length < 2) {
|
|
||||||
num = "0" + num;
|
|
||||||
}
|
|
||||||
num = "month-" + num;
|
|
||||||
return state.getTerm(num, "short", 0);
|
|
||||||
};
|
};
|
||||||
CSL.Util.Dates.day = {};
|
CSL.Util.Dates.day = {};
|
||||||
CSL.Util.Dates.day.numeric = function (state, num) {
|
CSL.Util.Dates.day.numeric = function (state, num) {
|
||||||
|
|
|
@ -195,7 +195,7 @@ Zotero.Translate.ItemSaver.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
var me = this;
|
var me = this;
|
||||||
Zotero.OAuth.createItem({"items":newItems}, null, function(statusCode, response) {
|
Zotero.API.createItem({"items":newItems}, null, function(statusCode, response) {
|
||||||
if(statusCode !== 201) {
|
if(statusCode !== 201) {
|
||||||
callback(false, new Error("Save to server failed"));
|
callback(false, new Error("Save to server failed"));
|
||||||
} else {
|
} else {
|
||||||
|
@ -258,7 +258,7 @@ Zotero.Translate.ItemSaver.prototype = {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Zotero.OAuth.createItem({"items":attachmentPayload}, itemKey, function(statusCode, response) {
|
Zotero.API.createItem({"items":attachmentPayload}, itemKey, function(statusCode, response) {
|
||||||
var err;
|
var err;
|
||||||
if(statusCode === 201) {
|
if(statusCode === 201) {
|
||||||
try {
|
try {
|
||||||
|
@ -430,7 +430,7 @@ Zotero.Translate.ItemSaver.prototype = {
|
||||||
Zotero.Translate.ItemSaver._attachmentCallbacks[attachment.id] = function(status, error) {
|
Zotero.Translate.ItemSaver._attachmentCallbacks[attachment.id] = function(status, error) {
|
||||||
attachmentCallback(attachment, status, error);
|
attachmentCallback(attachment, status, error);
|
||||||
};
|
};
|
||||||
Zotero.OAuth.uploadAttachment(attachment);
|
Zotero.API.uploadAttachment(attachment);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1406,7 +1406,6 @@ Zotero.Translate.Base.prototype = {
|
||||||
Zotero.debug(string, level);
|
Zotero.debug(string, level);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a string from an exception
|
* Generates a string from an exception
|
||||||
* @param {String|Exception} error
|
* @param {String|Exception} error
|
||||||
|
@ -1416,13 +1415,17 @@ Zotero.Translate.Base.prototype = {
|
||||||
if(typeof(error) == "string") {
|
if(typeof(error) == "string") {
|
||||||
errorString = "\nthrown exception => "+error;
|
errorString = "\nthrown exception => "+error;
|
||||||
} else {
|
} else {
|
||||||
|
var haveStack = false;
|
||||||
for(var i in error) {
|
for(var i in error) {
|
||||||
if(typeof(error[i]) != "object") {
|
if(typeof(error[i]) != "object") {
|
||||||
|
if(i === "stack") haveStack = true;
|
||||||
errorString += "\n"+i+' => '+error[i];
|
errorString += "\n"+i+' => '+error[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(error) {
|
errorString += "\nstring => "+error.toString();
|
||||||
errorString += "\nstring => "+error.toString();
|
if(!haveStack && error.stack) {
|
||||||
|
// In case the stack is not enumerable
|
||||||
|
errorString += "\nstack => "+error.stack.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1569,7 +1572,7 @@ Zotero.Translate.Web.prototype._translateTranslatorLoaded = function() {
|
||||||
}, function(obj) { me._translateRPCComplete(obj) });
|
}, function(obj) { me._translateRPCComplete(obj) });
|
||||||
} else if(runMode === Zotero.Translator.RUN_MODE_ZOTERO_SERVER) {
|
} else if(runMode === Zotero.Translator.RUN_MODE_ZOTERO_SERVER) {
|
||||||
var me = this;
|
var me = this;
|
||||||
Zotero.OAuth.createItem({"url":this.document.location.href.toString()}, null,
|
Zotero.API.createItem({"url":this.document.location.href.toString()}, null,
|
||||||
function(statusCode, response) {
|
function(statusCode, response) {
|
||||||
me._translateServerComplete(statusCode, response);
|
me._translateServerComplete(statusCode, response);
|
||||||
});
|
});
|
||||||
|
@ -1618,7 +1621,7 @@ Zotero.Translate.Web.prototype._translateServerComplete = function(statusCode, r
|
||||||
var me = this;
|
var me = this;
|
||||||
this._runHandler("select", response,
|
this._runHandler("select", response,
|
||||||
function(selectedItems) {
|
function(selectedItems) {
|
||||||
Zotero.OAuth.createItem({
|
Zotero.API.createItem({
|
||||||
"url":me.document.location.href.toString(),
|
"url":me.document.location.href.toString(),
|
||||||
"items":selectedItems
|
"items":selectedItems
|
||||||
}, null,
|
}, null,
|
||||||
|
|
|
@ -956,7 +956,7 @@ Zotero.Utilities = {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(elements instanceof Array)) elements = [elements];
|
if(!("length" in elements)) elements = [elements];
|
||||||
|
|
||||||
var results = [];
|
var results = [];
|
||||||
for(var i=0, n=elements.length; i<n; i++) {
|
for(var i=0, n=elements.length; i<n; i++) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ const ZOTERO_CONFIG = {
|
||||||
API_URL: 'https://api.zotero.org/',
|
API_URL: 'https://api.zotero.org/',
|
||||||
PREF_BRANCH: 'extensions.zotero.',
|
PREF_BRANCH: 'extensions.zotero.',
|
||||||
BOOKMARKLET_URL: 'https://www.zotero.org/bookmarklet/',
|
BOOKMARKLET_URL: 'https://www.zotero.org/bookmarklet/',
|
||||||
VERSION: "3.5a1.SOURCE"
|
VERSION: "3.0.8.SOURCE"
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
2012-05-04 03:15:00
|
2012-07-03 23:35:00
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 0cd9ff974b6eb15eb06fa303326c48f0cddd401c
|
Subproject commit 153776b6d3644f0bfaa0b52b72eae9da4080d1e6
|
Loading…
Add table
Add a link
Reference in a new issue