(trunk web) bind globally instead of to each individual transfer.
This commit is contained in:
parent
818575dced
commit
a32cbd7a91
|
@ -40,10 +40,9 @@ Torrent.prototype =
|
||||||
this._file_view = [ ];
|
this._file_view = [ ];
|
||||||
|
|
||||||
// Create a new <li> element
|
// Create a new <li> element
|
||||||
var top_e = document.createElement( 'li' );
|
var element = document.createElement( 'li' );
|
||||||
top_e.className = 'torrent';
|
element.className = 'torrent';
|
||||||
top_e.id = 'torrent_' + data.id;
|
element.id = 'torrent_' + data.id;
|
||||||
var element = $(top_e);
|
|
||||||
element._torrent = this;
|
element._torrent = this;
|
||||||
this._element = element;
|
this._element = element;
|
||||||
this._controller = controller;
|
this._controller = controller;
|
||||||
|
@ -52,27 +51,27 @@ Torrent.prototype =
|
||||||
// Create the 'name' <div>
|
// Create the 'name' <div>
|
||||||
var e = document.createElement( 'div' );
|
var e = document.createElement( 'div' );
|
||||||
e.className = 'torrent_name';
|
e.className = 'torrent_name';
|
||||||
top_e.appendChild( e );
|
element.appendChild( e );
|
||||||
element._name_container = e;
|
element._name_container = e;
|
||||||
|
|
||||||
// Create the 'progress details' <div>
|
// Create the 'progress details' <div>
|
||||||
e = document.createElement( 'div' );
|
e = document.createElement( 'div' );
|
||||||
e.className = 'torrent_progress_details';
|
e.className = 'torrent_progress_details';
|
||||||
top_e.appendChild( e );
|
element.appendChild( e );
|
||||||
element._progress_details_container = e;
|
element._progress_details_container = e;
|
||||||
|
|
||||||
// Create the 'in progress' bar
|
// Create the 'in progress' bar
|
||||||
e = document.createElement( 'div' );
|
e = document.createElement( 'div' );
|
||||||
e.className = 'torrent_progress_bar incomplete';
|
e.className = 'torrent_progress_bar incomplete';
|
||||||
e.style.width = '0%';
|
e.style.width = '0%';
|
||||||
top_e.appendChild( e );
|
element.appendChild( e );
|
||||||
element._progress_complete_container = e;
|
element._progress_complete_container = e;
|
||||||
|
|
||||||
// Create the 'incomplete' bar (initially hidden)
|
// Create the 'incomplete' bar (initially hidden)
|
||||||
e = document.createElement( 'div' );
|
e = document.createElement( 'div' );
|
||||||
e.className = 'torrent_progress_bar incomplete';
|
e.className = 'torrent_progress_bar incomplete';
|
||||||
e.style.display = 'none';
|
e.style.display = 'none';
|
||||||
top_e.appendChild( e );
|
element.appendChild( e );
|
||||||
element._progress_incomplete_container = e;
|
element._progress_incomplete_container = e;
|
||||||
|
|
||||||
// Add the pause/resume button - don't specify the
|
// Add the pause/resume button - don't specify the
|
||||||
|
@ -82,20 +81,15 @@ Torrent.prototype =
|
||||||
image.className = 'torrent_pause';
|
image.className = 'torrent_pause';
|
||||||
e = document.createElement( 'a' );
|
e = document.createElement( 'a' );
|
||||||
e.appendChild( image );
|
e.appendChild( image );
|
||||||
top_e.appendChild( e );
|
element.appendChild( e );
|
||||||
element._pause_resume_button_image = image;
|
element._pause_resume_button_image = image;
|
||||||
if (!iPhone) $(e).bind('click', {element: element}, this.clickPauseResumeButton);
|
|
||||||
|
|
||||||
// Create the 'peer details' <div>
|
// Create the 'peer details' <div>
|
||||||
e = document.createElement( 'div' );
|
e = document.createElement( 'div' );
|
||||||
e.className = 'torrent_peer_details';
|
e.className = 'torrent_peer_details';
|
||||||
top_e.appendChild( e );
|
element.appendChild( e );
|
||||||
element._peer_details_container = e;
|
element._peer_details_container = e;
|
||||||
|
|
||||||
// Set the torrent click observer
|
|
||||||
element.bind('click', {element: element}, this.clickTorrent);
|
|
||||||
if (!iPhone) element.bind('contextmenu', {element: element}, this.rightClickTorrent);
|
|
||||||
|
|
||||||
// Safari hack - first torrent needs to be moved down for some reason. Seems to be ok when
|
// Safari hack - first torrent needs to be moved down for some reason. Seems to be ok when
|
||||||
// using <li>'s in straight html, but adding through the DOM gets a bit odd.
|
// using <li>'s in straight html, but adding through the DOM gets a bit odd.
|
||||||
if ($.browser.safari)
|
if ($.browser.safari)
|
||||||
|
@ -118,7 +112,7 @@ Torrent.prototype =
|
||||||
this.refresh(data);
|
this.refresh(data);
|
||||||
|
|
||||||
// insert the element
|
// insert the element
|
||||||
transferListParent.appendChild(top_e);
|
transferListParent.appendChild(element);
|
||||||
},
|
},
|
||||||
|
|
||||||
initializeTorrentFilesInspectorGroup: function( fileListParent ) {
|
initializeTorrentFilesInspectorGroup: function( fileListParent ) {
|
||||||
|
@ -201,88 +195,6 @@ Torrent.prototype =
|
||||||
},
|
},
|
||||||
hideFileList: function() { this.fileList().hide(); },
|
hideFileList: function() { this.fileList().hide(); },
|
||||||
|
|
||||||
/*--------------------------------------------
|
|
||||||
*
|
|
||||||
* E V E N T F U N C T I O N S
|
|
||||||
*
|
|
||||||
*--------------------------------------------*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Process a right-click event on this torrent
|
|
||||||
*/
|
|
||||||
rightClickTorrent: function(event)
|
|
||||||
{
|
|
||||||
// don't stop the event! need it for the right-click menu
|
|
||||||
|
|
||||||
var t = event.data.element._torrent;
|
|
||||||
if ( !t.isSelected( ) )
|
|
||||||
t._controller.setSelectedTorrent( t );
|
|
||||||
},
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Process a click event on this torrent
|
|
||||||
*/
|
|
||||||
clickTorrent: function( event )
|
|
||||||
{
|
|
||||||
// Prevents click carrying to parent element
|
|
||||||
// which deselects all on click
|
|
||||||
event.stopPropagation();
|
|
||||||
var torrent = event.data.element._torrent;
|
|
||||||
|
|
||||||
// 'Apple' button emulation on PC :
|
|
||||||
// Need settable meta-key and ctrl-key variables for mac emulation
|
|
||||||
var meta_key = event.metaKey;
|
|
||||||
var ctrl_key = event.ctrlKey;
|
|
||||||
if (event.ctrlKey && navigator.appVersion.toLowerCase().indexOf("mac") == -1) {
|
|
||||||
meta_key = true;
|
|
||||||
ctrl_key = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shift-Click - Highlight a range between this torrent and the last-clicked torrent
|
|
||||||
if (iPhone) {
|
|
||||||
torrent._controller.setSelectedTorrent( torrent, true );
|
|
||||||
|
|
||||||
} else if (event.shiftKey) {
|
|
||||||
torrent._controller.selectRange( torrent, true );
|
|
||||||
// Need to deselect any selected text
|
|
||||||
window.focus();
|
|
||||||
|
|
||||||
// Apple-Click, not selected
|
|
||||||
} else if (!torrent.isSelected() && meta_key) {
|
|
||||||
torrent._controller.selectTorrent( torrent, true );
|
|
||||||
|
|
||||||
// Regular Click, not selected
|
|
||||||
} else if (!torrent.isSelected()) {
|
|
||||||
torrent._controller.setSelectedTorrent( torrent, true );
|
|
||||||
|
|
||||||
// Apple-Click, selected
|
|
||||||
} else if (torrent.isSelected() && meta_key) {
|
|
||||||
torrent._controller.deselectTorrent( torrent, true );
|
|
||||||
|
|
||||||
// Regular Click, selected
|
|
||||||
} else if (torrent.isSelected()) {
|
|
||||||
torrent._controller.setSelectedTorrent( torrent, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
torrent._controller.setLastTorrentClicked(torrent);
|
|
||||||
},
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Process a click event on the pause/resume button
|
|
||||||
*/
|
|
||||||
clickPauseResumeButton: function( event )
|
|
||||||
{
|
|
||||||
// prevent click event resulting in selection of torrent
|
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
// either stop or start the torrent
|
|
||||||
var torrent = event.data.element._torrent;
|
|
||||||
if( torrent.isActive( ) )
|
|
||||||
torrent._controller.stopTorrent( torrent );
|
|
||||||
else
|
|
||||||
torrent._controller.startTorrent( torrent );
|
|
||||||
},
|
|
||||||
|
|
||||||
/*--------------------------------------------
|
/*--------------------------------------------
|
||||||
*
|
*
|
||||||
* I N T E R F A C E F U N C T I O N S
|
* I N T E R F A C E F U N C T I O N S
|
||||||
|
@ -499,7 +411,7 @@ Torrent.prototype =
|
||||||
* Return true if this torrent is selected
|
* Return true if this torrent is selected
|
||||||
*/
|
*/
|
||||||
isSelected: function() {
|
isSelected: function() {
|
||||||
return this.element()[0].className.indexOf('selected') != -1;
|
return this.element().className.indexOf('selected') != -1;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -60,12 +60,15 @@ Transmission.prototype =
|
||||||
$('.inspector_tab').bind('click', function(e){ tr.inspectorTabClicked(e, this); });
|
$('.inspector_tab').bind('click', function(e){ tr.inspectorTabClicked(e, this); });
|
||||||
$('.file_wanted_control').live('click', function(e){ tr.fileWantedClicked(e, this); });
|
$('.file_wanted_control').live('click', function(e){ tr.fileWantedClicked(e, this); });
|
||||||
$('.file_priority_control').live('click', function(e){ tr.filePriorityClicked(e, this); });
|
$('.file_priority_control').live('click', function(e){ tr.filePriorityClicked(e, this); });
|
||||||
|
$('.torrent_list > .torrent').live('click', function(e){ tr.torrentClicked(e, this); });
|
||||||
if (iPhone) {
|
if (iPhone) {
|
||||||
$('#torrent_inspector').bind('click', function(e){ tr.hideInspector(); });
|
$('#torrent_inspector').bind('click', function(e){ tr.hideInspector(); });
|
||||||
$('#preferences_link').bind('click', function(e){ tr.releaseClutchPreferencesButton(e); });
|
$('#preferences_link').bind('click', function(e){ tr.releaseClutchPreferencesButton(e); });
|
||||||
} else {
|
} else {
|
||||||
|
$('.torrent_resume').live('click', function(e){ tr.torrentResumeClicked(e, this); });
|
||||||
|
$('.torrent_pause').live('click', function(e){ tr.torrentPauseClicked(e, this); });
|
||||||
$(document).bind('keydown', function(e){ tr.keyDown(e); });
|
$(document).bind('keydown', function(e){ tr.keyDown(e); });
|
||||||
$('#torrent_container').bind('click', function(e){ tr.deselectAll( true ); });
|
//$('#torrent_container').bind('click', function(e){ tr.deselectAll( true ); });
|
||||||
$('#open_link').bind('click', function(e){ tr.openTorrentClicked(e); });
|
$('#open_link').bind('click', function(e){ tr.openTorrentClicked(e); });
|
||||||
$('#filter_toggle_link').bind('click', function(e){ tr.toggleFilterClicked(e); });
|
$('#filter_toggle_link').bind('click', function(e){ tr.toggleFilterClicked(e); });
|
||||||
$('#inspector_link').bind('click', function(e){ tr.toggleInspectorClicked(e); });
|
$('#inspector_link').bind('click', function(e){ tr.toggleInspectorClicked(e); });
|
||||||
|
@ -288,7 +291,11 @@ Transmission.prototype =
|
||||||
shadow: false,
|
shadow: false,
|
||||||
boundingElement: $('div#torrent_container'),
|
boundingElement: $('div#torrent_container'),
|
||||||
boundingRightPad: 20,
|
boundingRightPad: 20,
|
||||||
boundingBottomPad: 5
|
boundingBottomPad: 5,
|
||||||
|
onContextMenu: function(e) {
|
||||||
|
tr.setSelectedElement( $(e.target).closest('.torrent')[0], true );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -323,7 +330,7 @@ Transmission.prototype =
|
||||||
{
|
{
|
||||||
var torrents = [ ];
|
var torrents = [ ];
|
||||||
for( var i=0, row; row=this._rows[i]; ++i )
|
for( var i=0, row; row=this._rows[i]; ++i )
|
||||||
if( row._torrent && ( row[0].style.display != 'none' ) )
|
if( row._torrent && ( row.style.display != 'none' ) )
|
||||||
torrents.push( row._torrent );
|
torrents.push( row._torrent );
|
||||||
return torrents;
|
return torrents;
|
||||||
},
|
},
|
||||||
|
@ -353,7 +360,7 @@ Transmission.prototype =
|
||||||
{
|
{
|
||||||
var rows = [ ];
|
var rows = [ ];
|
||||||
for( var i=0, row; row=this._rows[i]; ++i )
|
for( var i=0, row; row=this._rows[i]; ++i )
|
||||||
if( row[0].style.display != 'none' )
|
if( row.style.display != 'none' )
|
||||||
rows.push( row );
|
rows.push( row );
|
||||||
return rows;
|
return rows;
|
||||||
},
|
},
|
||||||
|
@ -374,20 +381,20 @@ Transmission.prototype =
|
||||||
|
|
||||||
scrollToElement: function( e )
|
scrollToElement: function( e )
|
||||||
{
|
{
|
||||||
if( iPhone )
|
if( !iPhone )
|
||||||
return;
|
{
|
||||||
|
|
||||||
var container = $('#torrent_container');
|
var container = $('#torrent_container');
|
||||||
var scrollTop = container.scrollTop( );
|
var scrollTop = container.scrollTop( );
|
||||||
var innerHeight = container.innerHeight( );
|
var innerHeight = container.innerHeight( );
|
||||||
|
|
||||||
var offsetTop = e[0].offsetTop;
|
var offsetTop = e.offsetTop;
|
||||||
var offsetHeight = e.outerHeight( );
|
var offsetHeight = $(e).outerHeight( );
|
||||||
|
|
||||||
if( offsetTop < scrollTop )
|
if( offsetTop < scrollTop )
|
||||||
container.scrollTop( offsetTop );
|
container.scrollTop( offsetTop );
|
||||||
else if( innerHeight + scrollTop < offsetTop + offsetHeight )
|
else if( innerHeight + scrollTop < offsetTop + offsetHeight )
|
||||||
container.scrollTop( offsetTop + offsetHeight - innerHeight );
|
container.scrollTop( offsetTop + offsetHeight - innerHeight );
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/*--------------------------------------------
|
/*--------------------------------------------
|
||||||
|
@ -396,35 +403,23 @@ Transmission.prototype =
|
||||||
*
|
*
|
||||||
*--------------------------------------------*/
|
*--------------------------------------------*/
|
||||||
|
|
||||||
setSelectedTorrent: function( torrent, doUpdate ) {
|
setSelectedElement: function( element, doUpdate ) {
|
||||||
this.deselectAll( );
|
this.deselectAll( );
|
||||||
this.selectTorrent( torrent, doUpdate );
|
this.selectElement( element, doUpdate );
|
||||||
},
|
},
|
||||||
|
|
||||||
selectElement: function( e, doUpdate ) {
|
selectElement: function( e, doUpdate ) {
|
||||||
$.className.add( e[0], 'selected' );
|
|
||||||
this.scrollToElement( e );
|
this.scrollToElement( e );
|
||||||
|
$.className.add( e, 'selected' );
|
||||||
if( doUpdate )
|
if( doUpdate )
|
||||||
this.selectionChanged( );
|
this.selectionChanged( );
|
||||||
$.className.add( e[0], 'selected' );
|
|
||||||
},
|
|
||||||
selectRow: function( rowIndex, doUpdate ) {
|
|
||||||
this.selectElement( this._rows[rowIndex], doUpdate );
|
|
||||||
},
|
|
||||||
selectTorrent: function( torrent, doUpdate ) {
|
|
||||||
if( torrent._element )
|
|
||||||
this.selectElement( torrent._element, doUpdate );
|
|
||||||
},
|
},
|
||||||
|
|
||||||
deselectElement: function( e, doUpdate ) {
|
deselectElement: function( e, doUpdate ) {
|
||||||
$.className.remove( e[0], 'selected' );
|
$.className.remove( e, 'selected' );
|
||||||
if( doUpdate )
|
if( doUpdate )
|
||||||
this.selectionChanged( );
|
this.selectionChanged( );
|
||||||
},
|
},
|
||||||
deselectTorrent: function( torrent, doUpdate ) {
|
|
||||||
if( torrent._element )
|
|
||||||
this.deselectElement( torrent._element, doUpdate );
|
|
||||||
},
|
|
||||||
|
|
||||||
selectAll: function( doUpdate ) {
|
selectAll: function( doUpdate ) {
|
||||||
var tr = this;
|
var tr = this;
|
||||||
|
@ -437,7 +432,7 @@ Transmission.prototype =
|
||||||
var tr = this;
|
var tr = this;
|
||||||
for( var i=0, row; row=tr._rows[i]; ++i )
|
for( var i=0, row; row=tr._rows[i]; ++i )
|
||||||
tr.deselectElement( row );
|
tr.deselectElement( row );
|
||||||
tr._last_torrent_clicked = null;
|
tr._last_element_clicked = null;
|
||||||
if( doUpdate )
|
if( doUpdate )
|
||||||
tr.selectionChanged( );
|
tr.selectionChanged( );
|
||||||
},
|
},
|
||||||
|
@ -445,21 +440,17 @@ Transmission.prototype =
|
||||||
/*
|
/*
|
||||||
* Select a range from this torrent to the last clicked torrent
|
* Select a range from this torrent to the last clicked torrent
|
||||||
*/
|
*/
|
||||||
selectRange: function( torrent, doUpdate )
|
selectRange: function( element, doUpdate )
|
||||||
{
|
{
|
||||||
if( !this._last_torrent_clicked )
|
if( !this._last_element_clicked )
|
||||||
{
|
this.selectElement( element );
|
||||||
this.selectTorrent( torrent );
|
else { // select the range between the prevous & current
|
||||||
}
|
var a = this._rows.indexOf( this._last_element_clicked );
|
||||||
else // select the range between the prevous & current
|
var b = this._rows.indexOf( element );
|
||||||
{
|
var begin = a < b ? a : b;
|
||||||
var rows = this.getVisibleRows( );
|
var end = a > b ? a : b;
|
||||||
var i = this.getTorrentIndex( rows, this._last_torrent_clicked );
|
for( var i=begin; i<=end; ++i )
|
||||||
var end = this.getTorrentIndex( rows, torrent );
|
this.selectElement( this._rows[i] );
|
||||||
var step = i < end ? 1 : -1;
|
|
||||||
for( ; i!=end; i+=step )
|
|
||||||
this.selectRow( i );
|
|
||||||
this.selectRow( i );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( doUpdate )
|
if( doUpdate )
|
||||||
|
@ -503,10 +494,8 @@ Transmission.prototype =
|
||||||
i = rows.length - 1;
|
i = rows.length - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( 0<=i && i<rows.length ) {
|
if( 0<=i && i<rows.length )
|
||||||
tr.deselectAll( );
|
this.setSelectedElement (this._rows[i]);
|
||||||
tr.selectRow( i, true );
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isButtonEnabled: function(e) {
|
isButtonEnabled: function(e) {
|
||||||
|
@ -651,6 +640,61 @@ Transmission.prototype =
|
||||||
this.updateVisibleFileLists();
|
this.updateVisibleFileLists();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
torrentClicked: function(event, element)
|
||||||
|
{
|
||||||
|
var torrent = element._torrent;
|
||||||
|
var isSelected = element.className.indexOf('selected') != -1;
|
||||||
|
|
||||||
|
|
||||||
|
//console.log ('torrent clicked. meta ' + event.metaKey + ' ctrl ' + event.ctrlKey + ' shift ' + event.shiftKey );
|
||||||
|
// 'Apple' button emulation on PC:
|
||||||
|
// TODO: Need settable meta-key and ctrl-key variables for mac emulation
|
||||||
|
var meta_key = event.metaKey;
|
||||||
|
var ctrl_key = event.ctrlKey;
|
||||||
|
if (event.ctrlKey && navigator.appVersion.toLowerCase().indexOf("mac") == -1) {
|
||||||
|
meta_key = true;
|
||||||
|
ctrl_key = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shift-Click - Highlight a range between this torrent and the last-clicked torrent
|
||||||
|
if (iPhone) {
|
||||||
|
this.setSelectedElement( element, true );
|
||||||
|
} else if (event.shiftKey) {
|
||||||
|
this.selectRange( element, true );
|
||||||
|
// Need to deselect any selected text
|
||||||
|
window.focus();
|
||||||
|
|
||||||
|
} else if (!isSelected && meta_key) { // Apple-Click, not selected
|
||||||
|
this.selectElement( element, true );
|
||||||
|
} else if (!isSelected) { // Regular Click, not selected
|
||||||
|
this.setSelectedElement( element, true );
|
||||||
|
} else if (isSelected && meta_key) { // Apple-Click, selected
|
||||||
|
this.deselectElement( element, true );
|
||||||
|
} else if (isSelected) { // Regular Click, selected
|
||||||
|
this.setSelectedElement( element, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
this._last_element_clicked = element;
|
||||||
|
|
||||||
|
// Prevents click carrying to parent element
|
||||||
|
// which deselects all on click
|
||||||
|
event.stopPropagation();
|
||||||
|
},
|
||||||
|
|
||||||
|
torrentPauseClicked: function (event, element) {
|
||||||
|
var row = element.parentNode.parentNode;
|
||||||
|
console.log ('pause clicked');
|
||||||
|
this.stopTorrent (row._torrent);
|
||||||
|
event.stopPropagation ();
|
||||||
|
},
|
||||||
|
|
||||||
|
torrentResumeClicked: function (event, element) {
|
||||||
|
var row = element.parentNode.parentNode;
|
||||||
|
console.log ('resume clicked');
|
||||||
|
this.startTorrent (row._torrent);
|
||||||
|
event.stopPropagation ();
|
||||||
|
},
|
||||||
|
|
||||||
fileWantedClicked: function(event, element){
|
fileWantedClicked: function(event, element){
|
||||||
this.extractFileFromElement(element).fileWantedControlClicked(event);
|
this.extractFileFromElement(element).fileWantedControlClicked(event);
|
||||||
},
|
},
|
||||||
|
@ -900,11 +944,6 @@ Transmission.prototype =
|
||||||
return false; // to prevent the event from bubbling up
|
return false; // to prevent the event from bubbling up
|
||||||
},
|
},
|
||||||
|
|
||||||
setLastTorrentClicked: function( torrent )
|
|
||||||
{
|
|
||||||
this._last_torrent_clicked = torrent;
|
|
||||||
},
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update the inspector with the latest data for the selected torrents
|
* Update the inspector with the latest data for the selected torrents
|
||||||
*/
|
*/
|
||||||
|
@ -1249,10 +1288,10 @@ Transmission.prototype =
|
||||||
{
|
{
|
||||||
var rows = this.getVisibleRows( );
|
var rows = this.getVisibleRows( );
|
||||||
for( var i=0, row; row=rows[i]; ++i ) {
|
for( var i=0, row; row=rows[i]; ++i ) {
|
||||||
var wasEven = row[0].className.indexOf('even') != -1;
|
var wasEven = row.className.indexOf('even') != -1;
|
||||||
var isEven = ((i+1) % 2 == 0);
|
var isEven = ((i+1) % 2 == 0);
|
||||||
if( wasEven != isEven )
|
if( wasEven != isEven )
|
||||||
row.toggleClass('even', isEven);
|
$(row).toggleClass('even', isEven);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1457,14 +1496,14 @@ Transmission.prototype =
|
||||||
// hide the ones we're not keeping
|
// hide the ones we're not keeping
|
||||||
for( var i=keep.length, e; e=this._rows[i]; ++i ) {
|
for( var i=keep.length, e; e=this._rows[i]; ++i ) {
|
||||||
delete e._torrent;
|
delete e._torrent;
|
||||||
e[0].style.display = 'none';
|
e.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
// show the ones we're keeping
|
// show the ones we're keeping
|
||||||
sel.sort( Torrent.compareById );
|
sel.sort( Torrent.compareById );
|
||||||
for( var i=0, len=keep.length; i<len; ++i ) {
|
for( var i=0, len=keep.length; i<len; ++i ) {
|
||||||
var e = this._rows[i];
|
var e = this._rows[i];
|
||||||
e[0].style.display = 'block';
|
e.style.display = 'block';
|
||||||
var t = keep[i];
|
var t = keep[i];
|
||||||
t.setElement( e );
|
t.setElement( e );
|
||||||
if( Torrent.indexOf( sel, t.id() ) != -1 )
|
if( Torrent.indexOf( sel, t.id() ) != -1 )
|
||||||
|
|
Loading…
Reference in New Issue