diff --git a/chrome/content/zotero/bindings/zoterosearch.xml b/chrome/content/zotero/bindings/zoterosearch.xml index ccf678671..380d2e36a 100644 --- a/chrome/content/zotero/bindings/zoterosearch.xml +++ b/chrome/content/zotero/bindings/zoterosearch.xml @@ -425,68 +425,63 @@ var rows = []; var libraryID = this.parent.search.libraryID; - var cols = Zotero.Collections.getByLibrary(libraryID, true); - for (var i in cols) { + + // Add collections + let cols = Zotero.Collections.getByLibrary(libraryID, true); + for (let col of cols) { // Indent subcollections var indent = ''; - if (cols[i].level) { - for (var j=1; j ({ + name: Zotero.ItemTypes.getLocalizedString(type.id), + value: type.name + })); // Sort by localized name - var types = []; - for (var i=0; i collation.compareString(1, a.name, b.name)); - for (var i in types) { - types[i][0] = types[i].localized; - types[i][1] = types[i].name; - delete types[i]['name']; - delete types[i]['id']; - } - this.createValueMenu(types); + this.createValueMenu(rows); break; case 'fileTypeID': - var types = Zotero.FileTypes.getTypes(); - for (var i in types) { - types[i][0] = Zotero.getString('fileTypes.' + types[i]['name']); - types[i][1] = types[i]['id']; - delete types[i]['name']; - delete types[i]['id']; - } - this.createValueMenu(types); + var rows = Zotero.FileTypes.getTypes().map(type => ({ + name: Zotero.getString('fileTypes.' + type.name), + value: type.id + })); + + // Sort by localized name + var collation = Zotero.getLocaleCollation(); + rows.sort((a, b) => collation.compareString(1, a.name, b.name)); + + this.createValueMenu(rows); break; default: @@ -522,7 +517,6 @@ // Drop-down menu if (conditionsMenu.value == 'collection' - || conditionsMenu.value == 'savedSearch' || conditionsMenu.value == 'itemType' || conditionsMenu.value == 'fileTypeID') { this.id('valuefield').hidden = true; @@ -557,19 +551,21 @@ - +