mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 20:44:15 +00:00
- Fix using SHIFT+Click for extended selection in Web UI transfer list
* Was broken in an early release candidate when column sorting was added
This commit is contained in:
parent
269bbdf01d
commit
95a6de9b00
@ -292,24 +292,25 @@ var dynamicTable = new Class ({
|
|||||||
} else {
|
} else {
|
||||||
if(e.shift && this.cur.length == 1) {
|
if(e.shift && this.cur.length == 1) {
|
||||||
// Shift key was pressed
|
// Shift key was pressed
|
||||||
ids = this.getRowIds();
|
var first_id = this.cur[0];
|
||||||
beginIndex = ids.indexOf(this.cur[0]);
|
var first_tr = this.rows.get(first_id);
|
||||||
endIndex = ids.indexOf(id);
|
var last_id = id;
|
||||||
if(beginIndex > endIndex) {
|
var last_tr = this.rows.get(last_id);
|
||||||
// Backward shift
|
var all_trs = this.table.getChildren('tr');
|
||||||
tmp = beginIndex;
|
var index_first_tr = all_trs.indexOf(first_tr);
|
||||||
beginIndex = endIndex-1;
|
var index_last_tr = all_trs.indexOf(last_tr);
|
||||||
endIndex = tmp-1;
|
var trs_to_select = all_trs.filter(function(item, index){
|
||||||
}
|
if(index_first_tr < index_last_tr)
|
||||||
for(i=beginIndex+1; i<(endIndex+1); i++) {
|
return (index > index_first_tr) && (index <= index_last_tr);
|
||||||
curID = ids[i];
|
else
|
||||||
this.cur[this.cur.length] = curID;
|
return (index < index_first_tr) && (index >= index_last_tr);
|
||||||
// Add selected style
|
});
|
||||||
if(this.rows.has(curID)) {
|
trs_to_select.each(function(item, index){
|
||||||
temptr = this.rows.get(curID);
|
// Add to selection
|
||||||
temptr.addClass('selected');
|
this.cur[this.cur.length] = this.getRowId(item);
|
||||||
}
|
// Select it visually
|
||||||
}
|
item.addClass('selected');
|
||||||
|
}.bind(this));
|
||||||
} else {
|
} else {
|
||||||
// Simple selection
|
// Simple selection
|
||||||
// Remove selected style from previous ones
|
// Remove selected style from previous ones
|
||||||
@ -412,15 +413,14 @@ var dynamicTable = new Class ({
|
|||||||
return this.cur;
|
return this.cur;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getRowId: function(tr){
|
||||||
|
return this.rows.keyOf(tr);
|
||||||
|
},
|
||||||
|
|
||||||
getRowIds: function(){
|
getRowIds: function(){
|
||||||
var ids = new Array();
|
return this.rows.getKeys();
|
||||||
var i = 0;
|
|
||||||
this.rows.each(function(tr, id) {
|
|
||||||
ids[i] = id;
|
|
||||||
i++;
|
|
||||||
}.bind(this));
|
|
||||||
return ids;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
//dynamicTable.implement(new Options);
|
//dynamicTable.implement(new Options);
|
||||||
//dynamicTable.implement(new Events);
|
//dynamicTable.implement(new Events);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user