Don't load saved search list for every collection row
This commit is contained in:
parent
7c958f4bd3
commit
368e568fe1
1 changed files with 20 additions and 11 deletions
|
@ -879,9 +879,10 @@ Zotero.CollectionTreeView.prototype.deleteSelection = function(deleteItems)
|
||||||
*/
|
*/
|
||||||
Zotero.CollectionTreeView.prototype._expandRow = function (row, forceOpen) {
|
Zotero.CollectionTreeView.prototype._expandRow = function (row, forceOpen) {
|
||||||
var itemGroup = this._getItemAtRow(row);
|
var itemGroup = this._getItemAtRow(row);
|
||||||
|
var isLibrary = itemGroup.isLibrary(true);
|
||||||
var isGroup = itemGroup.isGroup();
|
var isGroup = itemGroup.isGroup();
|
||||||
var isCollection = itemGroup.isCollection();
|
var isCollection = itemGroup.isCollection();
|
||||||
var level = this.getLevel(row) + 1;
|
var level = this.getLevel(row);
|
||||||
var libraryID = itemGroup.ref.libraryID;
|
var libraryID = itemGroup.ref.libraryID;
|
||||||
var intLibraryID = libraryID ? libraryID : 0;
|
var intLibraryID = libraryID ? libraryID : 0;
|
||||||
|
|
||||||
|
@ -893,11 +894,19 @@ Zotero.CollectionTreeView.prototype._expandRow = function (row, forceOpen) {
|
||||||
var collections = Zotero.getCollections(itemGroup.ref.id);
|
var collections = Zotero.getCollections(itemGroup.ref.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isLibrary) {
|
||||||
var savedSearches = Zotero.Searches.getAll(libraryID);
|
var savedSearches = Zotero.Searches.getAll(libraryID);
|
||||||
var showDuplicates = this.hideSources.indexOf('duplicates') == -1
|
var showDuplicates = (this.hideSources.indexOf('duplicates') == -1
|
||||||
&& this._duplicateLibraries.indexOf(intLibraryID + '') != -1;
|
&& this._duplicateLibraries.indexOf(intLibraryID) != -1);
|
||||||
var showUnfiled = this._unfiledLibraries.indexOf(intLibraryID + '') != -1;
|
var showUnfiled = this._unfiledLibraries.indexOf(intLibraryID) != -1;
|
||||||
var showTrash = this.hideSources.indexOf('trash') == -1;
|
var showTrash = this.hideSources.indexOf('trash') == -1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var savedSearches = [];
|
||||||
|
var showDuplicates = false;
|
||||||
|
var showUnfiled = false;
|
||||||
|
var showTrash = false;
|
||||||
|
}
|
||||||
|
|
||||||
// If not a manual open and either the library is set to be hidden
|
// If not a manual open and either the library is set to be hidden
|
||||||
// or this is a collection that isn't explicitly opened,
|
// or this is a collection that isn't explicitly opened,
|
||||||
|
@ -930,7 +939,7 @@ Zotero.CollectionTreeView.prototype._expandRow = function (row, forceOpen) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var newRow = this._showRow(new Zotero.ItemGroup('collection', collections[i]), level, row + 1 + newRows);
|
var newRow = this._showRow(new Zotero.ItemGroup('collection', collections[i]), level + 1, row + 1 + newRows);
|
||||||
|
|
||||||
// Recursively expand child collections that should be open
|
// Recursively expand child collections that should be open
|
||||||
newRows += this._expandRow(newRow);
|
newRows += this._expandRow(newRow);
|
||||||
|
@ -944,14 +953,14 @@ Zotero.CollectionTreeView.prototype._expandRow = function (row, forceOpen) {
|
||||||
|
|
||||||
// Add searches
|
// Add searches
|
||||||
for (var i = 0, len = savedSearches.length; i < len; i++) {
|
for (var i = 0, len = savedSearches.length; i < len; i++) {
|
||||||
this._showRow(new Zotero.ItemGroup('search', savedSearches[i]), level, row + 1 + newRows);
|
this._showRow(new Zotero.ItemGroup('search', savedSearches[i]), level + 1, row + 1 + newRows);
|
||||||
newRows++;
|
newRows++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Duplicate items
|
// Duplicate items
|
||||||
if (showDuplicates) {
|
if (showDuplicates) {
|
||||||
var d = new Zotero.Duplicates(intLibraryID);
|
var d = new Zotero.Duplicates(intLibraryID);
|
||||||
this._showRow(new Zotero.ItemGroup('duplicates', d), level, row + 1 + newRows);
|
this._showRow(new Zotero.ItemGroup('duplicates', d), level + 1, row + 1 + newRows);
|
||||||
newRows++;
|
newRows++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -964,7 +973,7 @@ Zotero.CollectionTreeView.prototype._expandRow = function (row, forceOpen) {
|
||||||
s.name = Zotero.getString('pane.collections.unfiled');
|
s.name = Zotero.getString('pane.collections.unfiled');
|
||||||
s.addCondition('libraryID', 'is', libraryID);
|
s.addCondition('libraryID', 'is', libraryID);
|
||||||
s.addCondition('unfiled', 'true');
|
s.addCondition('unfiled', 'true');
|
||||||
this._showRow(new Zotero.ItemGroup('unfiled', s), level, row + 1 + newRows);
|
this._showRow(new Zotero.ItemGroup('unfiled', s), level + 1, row + 1 + newRows);
|
||||||
newRows++;
|
newRows++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -974,7 +983,7 @@ Zotero.CollectionTreeView.prototype._expandRow = function (row, forceOpen) {
|
||||||
var ref = {
|
var ref = {
|
||||||
libraryID: libraryID
|
libraryID: libraryID
|
||||||
};
|
};
|
||||||
this._showRow(new Zotero.ItemGroup('trash', ref), level, row + 1 + newRows);
|
this._showRow(new Zotero.ItemGroup('trash', ref), level + 1, row + 1 + newRows);
|
||||||
newRows++;
|
newRows++;
|
||||||
}
|
}
|
||||||
this._trashNotEmpty[intLibraryID] = !!deletedItems.length;
|
this._trashNotEmpty[intLibraryID] = !!deletedItems.length;
|
||||||
|
|
Loading…
Reference in a new issue