@ -56,64 +56,102 @@ var loadTorrentData = function() {
if ( data ) {
if ( data ) {
var temp ;
var temp ;
// Update Torrent data
// Update Torrent data
temp = friendlyDuration ( data . time _elapsed )
if ( data . seeding _time > 0 )
if ( data . seeding _time > 0 )
temp += " (" + "QBT_TR(seeded for %1)QBT_TR" . replace ( "%1" , friendlyDuration ( data . seeding _time ) ) + ")" ;
temp = "QBT_TR(%1 (%2 this session))QBT_TR"
. replace ( "%1" , friendlyDuration ( data . time _elapsed ) )
. replace ( "%2" , friendlyDuration ( data . seeding _time ) )
else
temp = friendlyDuration ( data . time _elapsed )
$ ( 'time_elapsed' ) . set ( 'html' , temp ) ;
$ ( 'time_elapsed' ) . set ( 'html' , temp ) ;
$ ( 'eta' ) . set ( 'html' , friendlyDuration ( data . eta ) ) ;
$ ( 'eta' ) . set ( 'html' , friendlyDuration ( data . eta ) ) ;
temp = data . nb _connections + " (" + "QBT_TR(%1 max)QBT_TR" . replace ( "%1" , data . nb _connections _limit ) + ")" ;
temp = "QBT_TR(%1 (%2 max))QBT_TR"
. replace ( "%1" , data . nb _connections )
. replace ( "%2" , data . nb _connections _limit )
$ ( 'nb_connections' ) . set ( 'html' , temp ) ;
$ ( 'nb_connections' ) . set ( 'html' , temp ) ;
temp = friendlyUnit ( data . total _downloaded ) +
" (" + friendlyUnit ( data . total _downloaded _session ) +
temp = "QBT_TR(%1 (%2 this session))QBT_TR"
" QBT_TR(this session)QBT_TR" + ")" ;
. replace ( "%1" , friendlyUnit ( data . total _downloaded ) )
. replace ( "%2" , friendlyUnit ( data . total _downloaded _session ) )
$ ( 'total_downloaded' ) . set ( 'html' , temp ) ;
$ ( 'total_downloaded' ) . set ( 'html' , temp ) ;
temp = friendlyUnit ( data . total _uploaded ) +
" (" + friendlyUnit ( data . total _uploaded _session ) +
temp = "QBT_TR(%1 (%2 this session))QBT_TR"
" QBT_TR(this session)QBT_TR" + ")" ;
. replace ( "%1" , friendlyUnit ( data . total _uploaded ) )
. replace ( "%2" , friendlyUnit ( data . total _uploaded _session ) )
$ ( 'total_uploaded' ) . set ( 'html' , temp ) ;
$ ( 'total_uploaded' ) . set ( 'html' , temp ) ;
temp = friendlyUnit ( data . dl _speed , true ) + " QBT_TR((%1/s avg.))QBT_TR" . replace ( "%1" , friendlyUnit ( data . dl _speed _avg ) ) ;
temp = "QBT_TR(%1 (%2 avg.))QBT_TR"
. replace ( "%1" , friendlyUnit ( data . dl _speed , true ) )
. replace ( "%2" , friendlyUnit ( data . dl _speed _avg , true ) ) ;
$ ( 'dl_speed' ) . set ( 'html' , temp ) ;
$ ( 'dl_speed' ) . set ( 'html' , temp ) ;
temp = friendlyUnit ( data . up _speed , true ) + " QBT_TR((%1/s avg.))QBT_TR" . replace ( "%1" , friendlyUnit ( data . up _speed _avg ) ) ;
temp = "QBT_TR(%1 (%2 avg.))QBT_TR"
. replace ( "%1" , friendlyUnit ( data . up _speed , true ) )
. replace ( "%2" , friendlyUnit ( data . up _speed _avg , true ) ) ;
$ ( 'up_speed' ) . set ( 'html' , temp ) ;
$ ( 'up_speed' ) . set ( 'html' , temp ) ;
temp = ( data . dl _limit == - 1 ? "∞" : friendlyUnit ( data . dl _limit , true ) ) ;
temp = ( data . dl _limit == - 1 ? "∞" : friendlyUnit ( data . dl _limit , true ) ) ;
$ ( 'dl_limit' ) . set ( 'html' , temp ) ;
$ ( 'dl_limit' ) . set ( 'html' , temp ) ;
temp = ( data . up _limit == - 1 ? "∞" : friendlyUnit ( data . up _limit , true ) ) ;
temp = ( data . up _limit == - 1 ? "∞" : friendlyUnit ( data . up _limit , true ) ) ;
$ ( 'up_limit' ) . set ( 'html' , temp ) ;
$ ( 'up_limit' ) . set ( 'html' , temp ) ;
$ ( 'total_wasted' ) . set ( 'html' , friendlyUnit ( data . total _wasted ) ) ;
$ ( 'total_wasted' ) . set ( 'html' , friendlyUnit ( data . total _wasted ) ) ;
temp = data . seeds + " QBT_TR((%1 total))QBT_TR" . replace ( "%1" , data . seeds _total ) ;
temp = "QBT_TR(%1 (%2 total))QBT_TR"
. replace ( "%1" , data . seeds )
. replace ( "%2" , data . seeds _total ) ;
$ ( 'seeds' ) . set ( 'html' , temp ) ;
$ ( 'seeds' ) . set ( 'html' , temp ) ;
temp = data . peers + " QBT_TR((%1 total))QBT_TR" . replace ( "%1" , data . peers _total ) ;
temp = "QBT_TR(%1 (%2 total))QBT_TR"
. replace ( "%1" , data . peers )
. replace ( "%2" , data . peers _total ) ;
$ ( 'peers' ) . set ( 'html' , temp ) ;
$ ( 'peers' ) . set ( 'html' , temp ) ;
$ ( 'share_ratio' ) . set ( 'html' , data . share _ratio . toFixed ( 2 ) ) ;
$ ( 'share_ratio' ) . set ( 'html' , data . share _ratio . toFixed ( 2 ) ) ;
$ ( 'reannounce' ) . set ( 'html' , friendlyDuration ( data . reannounce ) ) ;
$ ( 'reannounce' ) . set ( 'html' , friendlyDuration ( data . reannounce ) ) ;
if ( data . last _seen != - 1 )
if ( data . last _seen != - 1 )
temp = new Date ( data . last _seen * 1000 ) . toLocaleString ( ) ;
temp = new Date ( data . last _seen * 1000 ) . toLocaleString ( ) ;
else
else
temp = "QBT_TR(Never)QBT_TR" ;
temp = "QBT_TR(Never)QBT_TR" ;
$ ( 'last_seen' ) . set ( 'html' , temp ) ;
$ ( 'last_seen' ) . set ( 'html' , temp ) ;
$ ( 'total_size' ) . set ( 'html' , friendlyUnit ( data . total _size ) ) ;
$ ( 'total_size' ) . set ( 'html' , friendlyUnit ( data . total _size ) ) ;
if ( data . pieces _num != - 1 )
if ( data . pieces _num != - 1 )
temp = "QBT_TR(%1 x %2 (have %3))QBT_TR" . replace ( "%1" , data . pieces _num ) . replace ( "%2" , friendlyUnit ( data . piece _size ) ) . replace ( "%3" , data . pieces _have ) ;
temp = "QBT_TR(%1 x %2 (have %3))QBT_TR"
. replace ( "%1" , data . pieces _num )
. replace ( "%2" , friendlyUnit ( data . piece _size ) )
. replace ( "%3" , data . pieces _have ) ;
else
else
temp = "QBT_TR(Unknown)QBT_TR" ;
temp = "QBT_TR(Unknown)QBT_TR" ;
$ ( 'pieces' ) . set ( 'html' , temp ) ;
$ ( 'pieces' ) . set ( 'html' , temp ) ;
$ ( 'created_by' ) . set ( 'html' , data . created _by ) ;
$ ( 'created_by' ) . set ( 'html' , data . created _by ) ;
if ( data . addition _date != - 1 )
if ( data . addition _date != - 1 )
temp = new Date ( data . addition _date * 1000 ) . toLocaleString ( ) ;
temp = new Date ( data . addition _date * 1000 ) . toLocaleString ( ) ;
else
else
temp = "QBT_TR(Unknown)QBT_TR" ;
temp = "QBT_TR(Unknown)QBT_TR" ;
$ ( 'addition_date' ) . set ( 'html' , temp ) ;
$ ( 'addition_date' ) . set ( 'html' , temp ) ;
if ( data . completion _date != - 1 )
if ( data . completion _date != - 1 )
temp = new Date ( data . completion _date * 1000 ) . toLocaleString ( ) ;
temp = new Date ( data . completion _date * 1000 ) . toLocaleString ( ) ;
else
else
temp = "" ;
temp = "" ;
$ ( 'completion_date' ) . set ( 'html' , temp ) ;
$ ( 'completion_date' ) . set ( 'html' , temp ) ;
if ( data . creation _date != - 1 )
if ( data . creation _date != - 1 )
temp = new Date ( data . creation _date * 1000 ) . toLocaleString ( ) ;
temp = new Date ( data . creation _date * 1000 ) . toLocaleString ( ) ;
else
else
temp = "QBT_TR(Unknown)QBT_TR" ;
temp = "QBT_TR(Unknown)QBT_TR" ;
$ ( 'creation_date' ) . set ( 'html' , temp ) ;
$ ( 'creation_date' ) . set ( 'html' , temp ) ;
$ ( 'save_path' ) . set ( 'html' , data . save _path ) ;
$ ( 'save_path' ) . set ( 'html' , data . save _path ) ;
$ ( 'comment' ) . set ( 'html' , parseHtmlLinks ( data . comment ) ) ;
$ ( 'comment' ) . set ( 'html' , parseHtmlLinks ( data . comment ) ) ;
}
}
else {
else {