2011-08-16 18:49:26 +00:00
|
|
|
/*
|
|
|
|
* Copyright © Jordan Lee
|
|
|
|
* This code is licensed under the GPL version 2.
|
|
|
|
* <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/****
|
|
|
|
*****
|
|
|
|
*****
|
|
|
|
****/
|
|
|
|
|
|
|
|
function TorrentRendererHelper()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
TorrentRendererHelper.getProgressInfo = function(controller, t)
|
2011-08-16 18:49:26 +00:00
|
|
|
{
|
2011-08-24 02:04:35 +00:00
|
|
|
var seed_ratio_limit = t.seedRatioLimit(controller);
|
2011-08-16 18:49:26 +00:00
|
|
|
|
2011-08-25 02:42:56 +00:00
|
|
|
var pct;
|
2011-08-24 02:04:35 +00:00
|
|
|
if (t.needsMetaData())
|
2011-08-20 21:17:12 +00:00
|
|
|
pct = t.getMetadataPercentComplete() * 100;
|
2011-08-24 02:04:35 +00:00
|
|
|
else if (!t.isDone())
|
|
|
|
pct = Math.round(t.getPercentDone() * 100);
|
2011-08-25 03:27:33 +00:00
|
|
|
else if (seed_ratio_limit > 0 && t.isSeeding()) // don't split up the bar if paused or queued
|
2011-08-24 02:04:35 +00:00
|
|
|
pct = Math.round(t.getUploadRatio() * 100 / seed_ratio_limit);
|
2011-08-16 18:49:26 +00:00
|
|
|
else
|
|
|
|
pct = 100;
|
|
|
|
|
2011-08-25 06:18:42 +00:00
|
|
|
var extra = '';
|
|
|
|
var s = t.getStatus();
|
|
|
|
if (s == Torrent._StatusStopped)
|
2011-08-16 18:49:26 +00:00
|
|
|
extra = 'paused';
|
2011-08-25 06:18:42 +00:00
|
|
|
else if (s == Torrent._StatusDownloadWait)
|
|
|
|
extra = 'leeching queued';
|
2011-08-24 02:04:35 +00:00
|
|
|
else if (t.needsMetaData())
|
2011-08-16 18:49:26 +00:00
|
|
|
extra = 'magnet';
|
2011-08-25 06:18:42 +00:00
|
|
|
else if (s === Torrent._StatusDownload)
|
2011-08-16 18:49:26 +00:00
|
|
|
extra = 'leeching';
|
2011-08-25 06:18:42 +00:00
|
|
|
else if (s == Torrent._StatusSeedWait)
|
|
|
|
extra = 'seeding queued';
|
|
|
|
else if (s == Torrent._StatusSeed)
|
|
|
|
extra = 'seeding';
|
2011-08-16 18:49:26 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
percent: pct,
|
|
|
|
complete: [ 'torrent_progress_bar', 'complete', extra ].join(' '),
|
|
|
|
incomplete: [ 'torrent_progress_bar', 'incomplete', extra ].join(' ')
|
|
|
|
};
|
2011-08-24 02:04:35 +00:00
|
|
|
};
|
2011-08-16 18:49:26 +00:00
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
TorrentRendererHelper.createProgressbar = function(classes)
|
2011-08-20 15:31:34 +00:00
|
|
|
{
|
2011-08-24 02:04:35 +00:00
|
|
|
var complete = document.createElement('div');
|
2011-08-20 15:31:34 +00:00
|
|
|
complete.className = 'torrent_progress_bar complete';
|
2011-08-24 02:04:35 +00:00
|
|
|
var incomplete = document.createElement('div');
|
2011-08-20 15:31:34 +00:00
|
|
|
incomplete.className = 'torrent_progress_bar incomplete';
|
2011-08-24 02:04:35 +00:00
|
|
|
var progressbar = document.createElement('div');
|
2011-08-20 15:31:34 +00:00
|
|
|
progressbar.className = 'torrent_progress_bar_container ' + classes;
|
2011-08-24 02:04:35 +00:00
|
|
|
progressbar.appendChild(complete);
|
|
|
|
progressbar.appendChild(incomplete);
|
|
|
|
return { 'element': progressbar, 'complete': complete, 'incomplete': incomplete };
|
|
|
|
};
|
2011-08-20 15:31:34 +00:00
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
TorrentRendererHelper.renderProgressbar = function(controller, t, progressbar)
|
2011-08-16 18:49:26 +00:00
|
|
|
{
|
2011-08-24 02:04:35 +00:00
|
|
|
var info = TorrentRendererHelper.getProgressInfo(controller, t);
|
2011-08-16 18:49:26 +00:00
|
|
|
var e;
|
2011-08-20 15:31:34 +00:00
|
|
|
e = progressbar.complete;
|
2011-08-16 18:49:26 +00:00
|
|
|
e.style.width = '' + info.percent + "%";
|
2011-08-24 03:40:23 +00:00
|
|
|
if (e.className !== info.complete)
|
|
|
|
e.className = info.complete;
|
2011-08-16 18:49:26 +00:00
|
|
|
e.style.display = info.percent<=0 ? 'none' : 'block';
|
2011-08-20 15:31:34 +00:00
|
|
|
e = progressbar.incomplete;
|
2011-08-24 03:40:23 +00:00
|
|
|
if (e.className !== info.incomplete)
|
|
|
|
e.className = info.incomplete;
|
2011-08-16 18:49:26 +00:00
|
|
|
e.style.display = info.percent>=100 ? 'none' : 'block';
|
2011-08-24 02:04:35 +00:00
|
|
|
};
|
2011-08-16 18:49:26 +00:00
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
TorrentRendererHelper.formatUL = function(t)
|
2011-08-16 18:49:26 +00:00
|
|
|
{
|
2011-08-24 02:04:35 +00:00
|
|
|
return '↑ ' + Transmission.fmt.speedBps(t.getUploadSpeed());
|
|
|
|
};
|
2011-08-16 18:49:26 +00:00
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
TorrentRendererHelper.formatDL = function(t)
|
2011-08-16 18:49:26 +00:00
|
|
|
{
|
2011-08-24 02:04:35 +00:00
|
|
|
return '↓ ' + Transmission.fmt.speedBps(t.getDownloadSpeed());
|
|
|
|
};
|
2011-08-16 18:49:26 +00:00
|
|
|
|
|
|
|
/****
|
|
|
|
*****
|
|
|
|
*****
|
|
|
|
****/
|
|
|
|
|
|
|
|
function TorrentRendererFull()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
TorrentRendererFull.prototype =
|
|
|
|
{
|
2011-08-24 02:04:35 +00:00
|
|
|
createRow: function()
|
2011-08-16 18:49:26 +00:00
|
|
|
{
|
2011-08-24 02:04:35 +00:00
|
|
|
var root = document.createElement('li');
|
2011-08-16 18:49:26 +00:00
|
|
|
root.className = 'torrent';
|
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
var name = document.createElement('div');
|
2011-08-16 18:49:26 +00:00
|
|
|
name.className = 'torrent_name';
|
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
var peers = document.createElement('div');
|
2011-08-16 18:49:26 +00:00
|
|
|
peers.className = 'torrent_peer_details';
|
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
var progressbar = TorrentRendererHelper.createProgressbar('full');
|
2011-08-16 18:49:26 +00:00
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
var details = document.createElement('div');
|
2011-08-16 18:49:26 +00:00
|
|
|
details.className = 'torrent_progress_details';
|
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
var image = document.createElement('div');
|
|
|
|
var button = document.createElement('a');
|
|
|
|
button.appendChild(image);
|
2011-08-16 18:49:26 +00:00
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
root.appendChild(name);
|
|
|
|
root.appendChild(peers);
|
|
|
|
root.appendChild(button);
|
|
|
|
root.appendChild(progressbar.element);
|
|
|
|
root.appendChild(details);
|
2011-08-16 18:49:26 +00:00
|
|
|
|
|
|
|
root._name_container = name;
|
|
|
|
root._peer_details_container = peers;
|
|
|
|
root._progress_details_container = details;
|
2011-08-20 15:31:34 +00:00
|
|
|
root._progressbar = progressbar;
|
2011-08-16 18:49:26 +00:00
|
|
|
root._pause_resume_button_image = image;
|
|
|
|
root._toggle_running_button = button;
|
|
|
|
|
|
|
|
return root;
|
|
|
|
},
|
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
getPeerDetails: function(t)
|
2011-08-16 18:49:26 +00:00
|
|
|
{
|
|
|
|
var err;
|
2011-08-24 02:04:35 +00:00
|
|
|
if ((err = t.getErrorMessage()))
|
2011-08-16 18:49:26 +00:00
|
|
|
return err;
|
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
if (t.isDownloading())
|
2011-08-16 18:49:26 +00:00
|
|
|
return [ 'Downloading from',
|
2011-08-20 21:17:12 +00:00
|
|
|
t.getPeersSendingToUs(),
|
2011-08-16 18:49:26 +00:00
|
|
|
'of',
|
2011-08-20 21:17:12 +00:00
|
|
|
t.getPeersConnected(),
|
2011-08-16 18:49:26 +00:00
|
|
|
'peers',
|
|
|
|
'-',
|
|
|
|
TorrentRendererHelper.formatDL(t),
|
|
|
|
TorrentRendererHelper.formatUL(t) ].join(' ');
|
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
if (t.isSeeding())
|
2011-08-16 18:49:26 +00:00
|
|
|
return [ 'Seeding to',
|
2011-08-20 21:17:12 +00:00
|
|
|
t.getPeersGettingFromUs(),
|
2011-08-16 18:49:26 +00:00
|
|
|
'of',
|
2011-08-20 21:17:12 +00:00
|
|
|
t.getPeersConnected(),
|
2011-08-16 18:49:26 +00:00
|
|
|
'peers',
|
|
|
|
'-',
|
|
|
|
TorrentRendererHelper.formatUL(t) ].join(' ');
|
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
if (t.isChecking())
|
2011-08-16 18:49:26 +00:00
|
|
|
return [ 'Verifying local data (',
|
2011-08-24 02:04:35 +00:00
|
|
|
Transmission.fmt.percentString(100.0 * t.getRecheckProgress()),
|
2011-08-16 18:49:26 +00:00
|
|
|
'% tested)' ].join('');
|
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
return t.getStateString();
|
2011-08-16 18:49:26 +00:00
|
|
|
},
|
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
getProgressDetails: function(controller, t)
|
2011-08-16 18:49:26 +00:00
|
|
|
{
|
2011-08-24 02:04:35 +00:00
|
|
|
if (t.needsMetaData()) {
|
2011-08-20 21:17:12 +00:00
|
|
|
var percent = 100 * t.getMetadataPercentComplete();
|
2011-08-16 18:49:26 +00:00
|
|
|
return [ "Magnetized transfer - retrieving metadata (",
|
2011-08-24 02:04:35 +00:00
|
|
|
Transmission.fmt.percentString(percent),
|
2011-08-16 18:49:26 +00:00
|
|
|
"%)" ].join('');
|
|
|
|
}
|
|
|
|
|
|
|
|
var c;
|
2011-08-24 02:04:35 +00:00
|
|
|
var sizeWhenDone = t.getSizeWhenDone();
|
|
|
|
var totalSize = t.getTotalSize();
|
|
|
|
var is_done = t.isDone() || t.isSeeding();
|
2011-08-20 21:17:12 +00:00
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
if (is_done) {
|
|
|
|
if (totalSize == sizeWhenDone) // seed: '698.05 MiB'
|
|
|
|
c = [ Transmission.fmt.size(totalSize) ];
|
2011-08-16 18:49:26 +00:00
|
|
|
else // partial seed: '127.21 MiB of 698.05 MiB (18.2%)'
|
2011-08-24 02:04:35 +00:00
|
|
|
c = [ Transmission.fmt.size(sizeWhenDone),
|
2011-08-16 18:49:26 +00:00
|
|
|
' of ',
|
2011-08-24 02:04:35 +00:00
|
|
|
Transmission.fmt.size(t.getTotalSize()),
|
2011-08-23 15:32:52 +00:00
|
|
|
' (', t.getPercentDoneStr(), '%)' ];
|
2011-08-16 18:49:26 +00:00
|
|
|
// append UL stats: ', uploaded 8.59 GiB (Ratio: 12.3)'
|
2011-08-24 02:04:35 +00:00
|
|
|
c.push(', uploaded ',
|
|
|
|
Transmission.fmt.size(t.getUploadedEver()),
|
2011-08-16 18:49:26 +00:00
|
|
|
' (Ratio ',
|
2011-08-24 02:04:35 +00:00
|
|
|
Transmission.fmt.ratioString(t.getUploadRatio()),
|
|
|
|
')');
|
2011-08-16 18:49:26 +00:00
|
|
|
} else { // not done yet
|
2011-08-24 02:04:35 +00:00
|
|
|
c = [ Transmission.fmt.size(sizeWhenDone - t.getLeftUntilDone()),
|
|
|
|
' of ', Transmission.fmt.size(sizeWhenDone),
|
2011-08-16 18:49:26 +00:00
|
|
|
' (', t.getPercentDoneStr(), '%)' ];
|
|
|
|
}
|
|
|
|
|
|
|
|
// maybe append eta
|
2011-08-24 02:04:35 +00:00
|
|
|
if (!t.isStopped() && (!is_done || t.seedRatioLimit(controller)>0)) {
|
2011-08-16 18:49:26 +00:00
|
|
|
c.push(' - ');
|
2011-08-24 02:04:35 +00:00
|
|
|
var eta = t.getETA();
|
|
|
|
if (eta < 0 || eta >= (999*60*60) /* arbitrary */)
|
|
|
|
c.push('remaining time unknown');
|
2011-08-16 18:49:26 +00:00
|
|
|
else
|
2011-08-24 02:04:35 +00:00
|
|
|
c.push(Transmission.fmt.timeInterval(t.getETA()),
|
|
|
|
' remaining');
|
2011-08-16 18:49:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return c.join('');
|
|
|
|
},
|
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
render: function(controller, t, root)
|
2011-08-16 18:49:26 +00:00
|
|
|
{
|
|
|
|
// name
|
2011-08-24 02:04:35 +00:00
|
|
|
setInnerHTML(root._name_container, t.getName());
|
2011-08-16 18:49:26 +00:00
|
|
|
|
|
|
|
// progressbar
|
2011-08-24 02:04:35 +00:00
|
|
|
TorrentRendererHelper.renderProgressbar(controller, t, root._progressbar);
|
2011-08-16 18:49:26 +00:00
|
|
|
|
|
|
|
// peer details
|
2011-08-20 21:17:12 +00:00
|
|
|
var has_error = t.getError() !== Torrent._ErrNone;
|
2011-08-16 18:49:26 +00:00
|
|
|
var e = root._peer_details_container;
|
|
|
|
$(e).toggleClass('error',has_error);
|
2011-08-24 02:04:35 +00:00
|
|
|
setInnerHTML(e, this.getPeerDetails(t));
|
2011-08-16 18:49:26 +00:00
|
|
|
|
|
|
|
// progress details
|
|
|
|
e = root._progress_details_container;
|
2011-08-24 02:04:35 +00:00
|
|
|
setInnerHTML(e, this.getProgressDetails(controller, t));
|
2011-08-16 18:49:26 +00:00
|
|
|
|
|
|
|
// pause/resume button
|
2011-08-24 02:04:35 +00:00
|
|
|
var is_stopped = t.isStopped();
|
|
|
|
e = root._pause_resume_button_image;
|
|
|
|
e.alt = is_stopped ? 'Resume' : 'Pause';
|
|
|
|
e.className = is_stopped ? 'torrent_resume' : 'torrent_pause';
|
2011-08-16 18:49:26 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/****
|
|
|
|
*****
|
|
|
|
*****
|
|
|
|
****/
|
|
|
|
|
|
|
|
function TorrentRendererCompact()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
TorrentRendererCompact.prototype =
|
|
|
|
{
|
2011-08-24 02:04:35 +00:00
|
|
|
createRow: function()
|
2011-08-16 18:49:26 +00:00
|
|
|
{
|
2011-08-24 02:04:35 +00:00
|
|
|
var progressbar = TorrentRendererHelper.createProgressbar('compact');
|
2011-08-16 18:49:26 +00:00
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
var details = document.createElement('div');
|
2011-08-16 18:49:26 +00:00
|
|
|
details.className = 'torrent_peer_details compact';
|
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
var name = document.createElement('div');
|
2011-08-23 15:32:52 +00:00
|
|
|
name.className = 'torrent_name compact';
|
2011-08-16 18:49:26 +00:00
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
var root = document.createElement('li');
|
|
|
|
root.appendChild(progressbar.element);
|
|
|
|
root.appendChild(details);
|
|
|
|
root.appendChild(name);
|
2011-08-16 18:49:26 +00:00
|
|
|
root.className = 'torrent compact';
|
2011-08-20 15:31:34 +00:00
|
|
|
root._progressbar = progressbar;
|
2011-08-16 18:49:26 +00:00
|
|
|
root._details_container = details;
|
|
|
|
root._name_container = name;
|
|
|
|
return root;
|
|
|
|
},
|
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
getPeerDetails: function(t)
|
2011-08-16 18:49:26 +00:00
|
|
|
{
|
|
|
|
var c;
|
2011-08-24 02:04:35 +00:00
|
|
|
if ((c = t.getErrorMessage()))
|
2011-08-16 18:49:26 +00:00
|
|
|
return c;
|
2011-08-25 06:18:42 +00:00
|
|
|
if (t.isDownloading()) {
|
|
|
|
var have_dn = t.getDownloadSpeed() > 0;
|
|
|
|
var have_up = t.getUploadSpeed() > 0;
|
|
|
|
if (!have_up && !have_dn)
|
|
|
|
return 'Idle';
|
|
|
|
var s = '';
|
|
|
|
if (have_dn)
|
|
|
|
s += TorrentRendererHelper.formatDL(t);
|
|
|
|
if (have_dn && have_up)
|
|
|
|
s += ' '
|
|
|
|
if (have_up)
|
|
|
|
s += TorrentRendererHelper.formatUL(t);
|
|
|
|
return s;
|
|
|
|
}
|
2011-08-24 02:04:35 +00:00
|
|
|
if (t.isSeeding())
|
2011-08-24 19:20:59 +00:00
|
|
|
return [ 'Ratio: ',
|
|
|
|
Transmission.fmt.ratioString(t.getUploadRatio()),
|
|
|
|
', ',
|
|
|
|
TorrentRendererHelper.formatUL(t) ].join('');
|
2011-08-24 02:04:35 +00:00
|
|
|
return t.getStateString();
|
2011-08-16 18:49:26 +00:00
|
|
|
},
|
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
render: function(controller, t, root)
|
2011-08-16 18:49:26 +00:00
|
|
|
{
|
|
|
|
// name
|
2011-08-24 02:04:35 +00:00
|
|
|
var is_stopped = t.isStopped();
|
2011-08-16 18:49:26 +00:00
|
|
|
var e = root._name_container;
|
2011-08-24 02:04:35 +00:00
|
|
|
$(e).toggleClass('paused', is_stopped);
|
|
|
|
setInnerHTML(e, t.getName());
|
2011-08-16 18:49:26 +00:00
|
|
|
|
|
|
|
// peer details
|
2011-08-20 21:17:12 +00:00
|
|
|
var has_error = t.getError() !== Torrent._ErrNone;
|
2011-08-16 18:49:26 +00:00
|
|
|
e = root._details_container;
|
2011-08-24 02:04:35 +00:00
|
|
|
$(e).toggleClass('error', has_error);
|
|
|
|
setInnerHTML(e, this.getPeerDetails(t));
|
2011-08-16 18:49:26 +00:00
|
|
|
|
|
|
|
// progressbar
|
2011-08-24 02:04:35 +00:00
|
|
|
TorrentRendererHelper.renderProgressbar(controller, t, root._progressbar);
|
2011-08-16 18:49:26 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/****
|
|
|
|
*****
|
|
|
|
*****
|
|
|
|
****/
|
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
function TorrentRow(view, controller, torrent, selected)
|
2011-08-16 18:49:26 +00:00
|
|
|
{
|
2011-08-24 02:04:35 +00:00
|
|
|
this.initialize(view, controller, torrent, selected);
|
2011-08-16 18:49:26 +00:00
|
|
|
}
|
|
|
|
TorrentRow.prototype =
|
|
|
|
{
|
2011-08-24 02:04:35 +00:00
|
|
|
initialize: function(view, controller, torrent, selected) {
|
2011-08-20 15:31:34 +00:00
|
|
|
this._view = view;
|
2011-08-24 02:04:35 +00:00
|
|
|
this._element = view.createRow();
|
|
|
|
this.setTorrent(controller, torrent);
|
|
|
|
if (selected)
|
|
|
|
this.setSelected(selected);
|
|
|
|
this.render(controller);
|
2011-08-16 18:49:26 +00:00
|
|
|
|
|
|
|
},
|
2011-08-24 02:04:35 +00:00
|
|
|
getElement: function() {
|
2011-08-16 18:49:26 +00:00
|
|
|
return this._element;
|
|
|
|
},
|
2011-08-24 02:04:35 +00:00
|
|
|
render: function(controller) {
|
|
|
|
var tor = this.getTorrent();
|
|
|
|
if (tor)
|
|
|
|
this._view.render(controller, tor, this.getElement());
|
2011-08-16 18:49:26 +00:00
|
|
|
},
|
2011-08-24 02:04:35 +00:00
|
|
|
isSelected: function() {
|
|
|
|
return this.getElement().className.indexOf('selected') !== -1;
|
2011-08-16 18:49:26 +00:00
|
|
|
},
|
2011-08-24 02:04:35 +00:00
|
|
|
setSelected: function(flag) {
|
|
|
|
$(this.getElement()).toggleClass('selected', flag);
|
2011-08-16 18:49:26 +00:00
|
|
|
},
|
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
getToggleRunningButton: function() {
|
2011-08-16 18:49:26 +00:00
|
|
|
return this.getElement()._toggle_running_button;
|
|
|
|
},
|
|
|
|
|
2011-08-24 02:04:35 +00:00
|
|
|
setTorrent: function(controller, t) {
|
|
|
|
if (this._torrent !== t) {
|
|
|
|
var row = this;
|
2011-08-23 15:32:52 +00:00
|
|
|
var key = 'dataChanged.torrentRowListener';
|
2011-08-24 02:04:35 +00:00
|
|
|
if (this._torrent)
|
2011-08-23 15:32:52 +00:00
|
|
|
$(this._torrent).unbind(key);
|
2011-08-24 02:04:35 +00:00
|
|
|
if ((this._torrent = t))
|
|
|
|
$(this._torrent).bind(key,function(){row.render(controller);});
|
2011-08-16 18:49:26 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
getTorrent: function() {
|
|
|
|
return this._torrent;
|
|
|
|
},
|
|
|
|
isEven: function() {
|
|
|
|
return this.getElement().className.indexOf('even') != -1;
|
|
|
|
},
|
2011-08-24 02:04:35 +00:00
|
|
|
setEven: function(even) {
|
|
|
|
if (this.isEven() != even)
|
2011-08-16 18:49:26 +00:00
|
|
|
$(this.getElement()).toggleClass('even', even);
|
|
|
|
}
|
|
|
|
};
|