(trunk web) in tr.refilter(), instead of calling the expensive tr.getSelectedRows(), use a cheaper jQuery equivalent.
This commit is contained in:
parent
c44ce249d2
commit
0c221893d3
|
@ -345,18 +345,16 @@ TorrentRendererCompact.prototype =
|
||||||
*****
|
*****
|
||||||
****/
|
****/
|
||||||
|
|
||||||
function TorrentRow(view, controller, torrent, selected)
|
function TorrentRow(view, controller, torrent)
|
||||||
{
|
{
|
||||||
this.initialize(view, controller, torrent, selected);
|
this.initialize(view, controller, torrent);
|
||||||
}
|
}
|
||||||
TorrentRow.prototype =
|
TorrentRow.prototype =
|
||||||
{
|
{
|
||||||
initialize: function(view, controller, torrent, selected) {
|
initialize: function(view, controller, torrent) {
|
||||||
this._view = view;
|
this._view = view;
|
||||||
this._element = view.createRow();
|
this._element = view.createRow();
|
||||||
this.setTorrent(controller, torrent);
|
this.setTorrent(controller, torrent);
|
||||||
if (selected)
|
|
||||||
this.setSelected(selected);
|
|
||||||
this.render(controller);
|
this.render(controller);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
|
@ -1949,24 +1949,20 @@ Transmission.prototype =
|
||||||
|
|
||||||
refilter: function(rebuildEverything)
|
refilter: function(rebuildEverything)
|
||||||
{
|
{
|
||||||
var i, e, id, t, row, tmp, sel, rows, clean_rows, dirty_rows,
|
var i, e, id, t, row, tmp, rows, clean_rows, dirty_rows,
|
||||||
sort_mode = this[Prefs._SortMethod],
|
sort_mode = this[Prefs._SortMethod],
|
||||||
sort_direction = this[Prefs._SortDirection],
|
sort_direction = this[Prefs._SortDirection],
|
||||||
filter_mode = this[Prefs._FilterMode],
|
filter_mode = this[Prefs._FilterMode],
|
||||||
filter_text = this.filterText,
|
filter_text = this.filterText,
|
||||||
filter_tracker = this.filterTracker,
|
filter_tracker = this.filterTracker,
|
||||||
renderer = this.torrentRenderer,
|
renderer = this.torrentRenderer,
|
||||||
list = this._torrent_list;
|
list = this._torrent_list,
|
||||||
|
old_sel_count = $(list).children('.selected').length;
|
||||||
|
|
||||||
|
|
||||||
clearTimeout(this.refilterTimer);
|
clearTimeout(this.refilterTimer);
|
||||||
delete this.refilterTimer;
|
delete this.refilterTimer;
|
||||||
|
|
||||||
// build a temporary lookup table of selected torrent ids
|
|
||||||
sel = { };
|
|
||||||
for (i=0; row=this._rows[i]; ++i)
|
|
||||||
if (row.isSelected())
|
|
||||||
sel[row.getTorrentId()] = row;
|
|
||||||
|
|
||||||
if (rebuildEverything) {
|
if (rebuildEverything) {
|
||||||
$(list).empty();
|
$(list).empty();
|
||||||
this._rows = [];
|
this._rows = [];
|
||||||
|
@ -2007,8 +2003,7 @@ Transmission.prototype =
|
||||||
for (id in this.dirtyTorrents) {
|
for (id in this.dirtyTorrents) {
|
||||||
t = this._torrents[id];
|
t = this._torrents[id];
|
||||||
if (t && t.test(filter_mode, filter_text, filter_tracker)) {
|
if (t && t.test(filter_mode, filter_text, filter_tracker)) {
|
||||||
var s = t.getId() in sel;
|
row = new TorrentRow(renderer, this, t);
|
||||||
row = new TorrentRow(renderer, this, t, s);
|
|
||||||
row.getElement().row = row;
|
row.getElement().row = row;
|
||||||
dirty_rows.push(row);
|
dirty_rows.push(row);
|
||||||
}
|
}
|
||||||
|
@ -2063,7 +2058,7 @@ Transmission.prototype =
|
||||||
// sync gui
|
// sync gui
|
||||||
this.updateStatusbar();
|
this.updateStatusbar();
|
||||||
this.refreshFilterButton();
|
this.refreshFilterButton();
|
||||||
if (Object.keys(sel).length !== this.getSelectedRows().length)
|
if (old_sel_count !== $(list).children('.selected').length)
|
||||||
this.selectionChanged();
|
this.selectionChanged();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue