Merged revisions 1986,1988-1990,1996,1998,2000-2004,2006,2008-2010,2013,2020-2028,2032-2034,2037,2039,2044-2049,2052-2056,2059,2065-2066,2068-2072,2075,2077-2079,2081,2083-2084,2086,2088-2094,2096,2099,2101,2103-2104,2107-2110,2115,2118,2120-2122,2126-2128,2131,2140,2142-2145,2149-2153,2155-2159,2165,2167-2168,2170-2171,2173-2176,2179-2183,2185-2186 via svnmerge from
https://www.zotero.org/svn/extension/branches/1.0
This commit is contained in:
parent
85a74dc6ec
commit
200cca74a6
101 changed files with 7001 additions and 1985 deletions
|
@ -154,8 +154,8 @@ function ChromeExtensionHandler() {
|
|||
// items were selected
|
||||
includeAllChildItems = false;
|
||||
}
|
||||
// If combining children, add matching parents
|
||||
else if (combineChildItems) {
|
||||
// If combining children or standalone note/attachment, add matching parents
|
||||
else if (combineChildItems || !results[i].isRegularItem()) {
|
||||
itemsHash[results[i].getID()] = items.length;
|
||||
items.push(results[i].toArray(2));
|
||||
// Flag item as a search match
|
||||
|
@ -263,6 +263,10 @@ function ChromeExtensionHandler() {
|
|||
var sorts = sortBy.split(',');
|
||||
for (var i=0; i<sorts.length; i++) {
|
||||
var [field, order] = sorts[i].split('/');
|
||||
// Year field is really date field
|
||||
if (field == 'year') {
|
||||
field = 'date';
|
||||
}
|
||||
switch (order) {
|
||||
case 'd':
|
||||
case 'desc':
|
||||
|
@ -286,10 +290,45 @@ function ChromeExtensionHandler() {
|
|||
|
||||
// Multidimensional sort
|
||||
do {
|
||||
var cmp = collation.compareString(0,
|
||||
a[sorts[index].field],
|
||||
b[sorts[index].field]
|
||||
);
|
||||
// Note and attachment sorting when combineChildItems is false
|
||||
if (!combineChildItems && sorts[index].field == 'note') {
|
||||
if (a.itemType == 'note' || a.itemType == 'attachment') {
|
||||
var valA = a.note;
|
||||
}
|
||||
else if (a.reportChildren) {
|
||||
var valA = a.reportChildren.notes[0].note;
|
||||
}
|
||||
else {
|
||||
var valA = '';
|
||||
}
|
||||
|
||||
if (b.itemType == 'note' || b.itemType == 'attachment') {
|
||||
var valB = b.note;
|
||||
}
|
||||
else if (b.reportChildren) {
|
||||
var valB = b.reportChildren.notes[0].note;
|
||||
}
|
||||
else {
|
||||
var valB = '';
|
||||
}
|
||||
|
||||
// Put items without notes last
|
||||
if (valA == '' && valB != '') {
|
||||
var cmp = 1;
|
||||
}
|
||||
else if (valA != '' && valB == '') {
|
||||
var cmp = -1;
|
||||
}
|
||||
else {
|
||||
var cmp = collation.compareString(0, valA, valB);
|
||||
}
|
||||
}
|
||||
else {
|
||||
var cmp = collation.compareString(0,
|
||||
a[sorts[index].field],
|
||||
b[sorts[index].field]
|
||||
);
|
||||
}
|
||||
|
||||
if (cmp == 0) {
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue