1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 08:43:27 +00:00

(trunk web) when creating new Torrent objects, build the file list in a document fragment too...

This commit is contained in:
Charles Kerr 2009-05-24 19:34:54 +00:00
parent 51582ff90e
commit 7901f908af
2 changed files with 17 additions and 11 deletions

View file

@ -6,8 +6,8 @@
* Class Torrent
*/
function Torrent(domParent,controller,data) {
this.initialize(domParent,controller,data);
function Torrent( transferListParent, fileListParent, controller, data) {
this.initialize( transferListParent, fileListParent, controller, data);
}
// Constants
@ -23,7 +23,7 @@ Torrent.prototype =
/*
* Constructor
*/
initialize: function(domParent,controller, data) {
initialize: function( transferListParent, fileListParent, controller, data) {
this._id = data.id;
this._is_private = data.isPrivate;
this._hashString = data.hashString;
@ -101,7 +101,7 @@ Torrent.prototype =
if ($.browser.safari)
this._element.css('margin-top', '7px');
this.initializeTorrentFilesInspectorGroup();
this.initializeTorrentFilesInspectorGroup( fileListParent );
if( data.files ) {
for( var i=0, row; row=data.files[i]; ++i ) {
@ -118,14 +118,14 @@ Torrent.prototype =
this.refresh(data);
// insert the element
domParent.appendChild(top_e);
transferListParent.appendChild(top_e);
},
initializeTorrentFilesInspectorGroup: function(length) {
initializeTorrentFilesInspectorGroup: function( fileListParent ) {
var e = document.createElement( 'ul' );
e.className = 'inspector_torrent_file_list inspector_group';
e.style.display = 'none';
this._controller._inspector_file_list.appendChild( e );
fileListParent.appendChild( e );
this._fileList = e;
},

View file

@ -1183,11 +1183,17 @@ Transmission.prototype =
this.remote.getInitialDataFor( null ,function(torrents) { tr.addTorrents(torrents); } );
},
addTorrents: function( new_torrents ){
var fragment = document.createDocumentFragment( );
addTorrents: function( new_torrents )
{
var transferFragment = document.createDocumentFragment( );
var fileFragment = document.createDocumentFragment( );
for( var i=0, row; row=new_torrents[i]; ++i )
this._torrents.push( new Torrent( fragment, this, row ) );
this._torrent_list.appendChild( fragment );
this._torrents.push( new Torrent( transferFragment, fileFragment, this, row ) );
this._inspector_file_list.appendChild( fileFragment );
this._torrent_list.appendChild( transferFragment );
this.refilter( );
},