1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-25 22:14:32 +00:00

Use .each(). Refactor conditionals.

This commit is contained in:
Thomas Piccirello 2018-01-06 21:04:03 -05:00
parent 98a1c111b9
commit 69af205094

View File

@ -489,19 +489,14 @@ var DynamicTable = new Class({
}, },
selectRow : function (rowId) { selectRow : function (rowId) {
this.selectedRows.empty(); this.deselectAll();
this.selectedRows.push(rowId); this.selectedRows.push(rowId);
var trs = this.tableBody.getElements('tr'); this.tableBody.getElements('tr').each(function(tr) {
for (var i = 0; i < trs.length; i++) { if (tr.rowId == rowId)
var tr = trs[i]; tr.addClass('selected');
if (tr.rowId == rowId) {
if (!tr.hasClass('selected'))
tr.addClass('selected');
}
else else
if (tr.hasClass('selected'))
tr.removeClass('selected'); tr.removeClass('selected');
} });
this.onSelectedRowChanged(); this.onSelectedRowChanged();
}, },