LogContext = function(){}; LogContext.prototype.id = ""; LogContext.prototype.init = function(){ $('#link_container tr').html( '' + 'initializing' + '' + '' + '' + '' + ''); }; LogContext.prototype.log_file_add = function(torrent){ var progress = (100 * torrent.downloaded / torrent.parsedTorrent.length).toFixed(1) $('#link_container tr').html( '' + '' + progress + '%' + '' + '' + 'speed: ' + torrent.swarm.downloadSpeed() + '/s' + '' + '' + '' + 'direct link: ' + '' + '' + '' + '' + '   ' + '' + '' + 'Tweet' + '' + ''); $.getScript("http://platform.twitter.com/widgets.js"); }; LogContext.prototype.log_file_upd = function(torrent){ if($('#'+torrent.infoHash).length){ var progress = (100 * torrent.downloaded / torrent.parsedTorrent.length).toFixed(1) $('#'+torrent.infoHash).html( '' + progress + '%' + '' + '' + 'speed: ' + torrent.swarm.downloadSpeed() + '/s / ' + torrent.swarm.uploadSpeed() + '/s' + '' + '' + '' + 'direct link: ' + '' + '' + '' + '' + '   ' + '' + '' + 'Tweet' + '') } else { this.log_file_add(torrent); } }; LogContext.prototype.log_file_done = function(torrent,url,file){ this.log_file_upd(torrent); $('#link_container tr').html( '' + '100%' + '' + '' + '' + 'Download ' + file.name + '' + '' + '' + '' + 'direct link: ' + '' + '' + '' + '' + '   ' + '' + '' + 'Tweet' + ''); };