Make sorting case-insensitive in tags and elsewhere

This commit is contained in:
Dan Stillman 2007-06-15 20:23:54 +00:00
parent acf86fcee4
commit affcc45690
2 changed files with 6 additions and 12 deletions

View File

@ -1790,7 +1790,7 @@ Zotero.Item.prototype.getTags = function(){
var collation = Zotero.getLocaleCollation();
tags.sort(function(a, b) {
return collation.compareString(0, a.tag, b.tag);
return collation.compareString(1, a.tag, b.tag);
});
return tags;
}
@ -3674,7 +3674,7 @@ Zotero.Tags = new function(){
var collation = Zotero.getLocaleCollation();
tags.sort(function(a, b) {
return collation.compareString(0, a.tag, b.tag);
return collation.compareString(1, a.tag, b.tag);
});
var indexed = {};
@ -3716,7 +3716,7 @@ Zotero.Tags = new function(){
var collation = Zotero.getLocaleCollation();
tags.sort(function(a, b) {
return collation.compareString(0, a.tag, b.tag);
return collation.compareString(1, a.tag, b.tag);
});
var indexed = {};
@ -4587,7 +4587,7 @@ Zotero.getCollections = function(parent, recursive){
// Do proper collation sort
var collation = Zotero.getLocaleCollation();
children.sort(function (a, b) {
return collation.compareString(0, a.name, b.name);
return collation.compareString(1, a.name, b.name);
});
for (var i=0, len=children.length; i<len; i++){

View File

@ -788,17 +788,11 @@ Zotero.ItemTreeView.prototype.sort = function(itemID)
default:
if (fieldA == undefined) {
fieldA = a.getField(columnField, unformatted, true);
if (typeof fieldA == 'string') {
fieldA = fieldA.toLowerCase();
}
cache[aItemID] = fieldA;
}
if (fieldB == undefined) {
fieldB = b.getField(columnField, unformatted, true);
if (typeof fieldB == 'string') {
fieldB = fieldB.toLowerCase();
}
cache[bItemID] = fieldB;
}
@ -812,7 +806,7 @@ Zotero.ItemTreeView.prototype.sort = function(itemID)
}
//cmp = (fieldA > fieldB) ? -1 : (fieldA < fieldB) ? 1 : 0;
cmp = collation.compareString(0, fieldB, fieldA);
cmp = collation.compareString(1, fieldB, fieldA);
if (cmp) {
return cmp;
}
@ -830,7 +824,7 @@ Zotero.ItemTreeView.prototype.sort = function(itemID)
}
//cmp = (fieldA > fieldB) ? -1 : (fieldA < fieldB) ? 1 : 0;
cmp = collation.compareString(0, fieldB, fieldA);
cmp = collation.compareString(1, fieldB, fieldA);
if (cmp) {
return cmp;
}