Changeset 8494
- Timestamp:
- May 23, 2009, 6:09:56 PM (14 years ago)
- Location:
- trunk/web/javascript
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web/javascript/torrent.js
r8493 r8494 40 40 41 41 // Create a new <li> element 42 var element = $('<li/>'); 43 element.addClass('torrent'); 44 element[0].id = 'torrent_' + data.id; 42 var top_e = document.createElement( 'li' ); 43 top_e.className = 'torrent'; 44 top_e.id = 'torrent_' + data.id; 45 var element = $(top_e); 45 46 element._torrent = this; 46 47 this._element = element; … … 51 52 var e = document.createElement( 'div' ); 52 53 e.className = 'torrent_name'; 53 element[0].appendChild( e );54 top_e.appendChild( e ); 54 55 element._name_container = e; 55 56 … … 57 58 e = document.createElement( 'div' ); 58 59 e.className = 'torrent_progress_details'; 59 element[0].appendChild( e );60 top_e.appendChild( e ); 60 61 element._progress_details_container = e; 61 62 … … 64 65 e.className = 'torrent_progress_bar incomplete'; 65 66 e.style.width = '0%'; 66 element[0].appendChild( e );67 top_e.appendChild( e ); 67 68 element._progress_complete_container = e; 68 69 … … 71 72 e.className = 'torrent_progress_bar incomplete'; 72 73 e.style.display = 'none'; 73 element[0].appendChild( e );74 top_e.appendChild( e ); 74 75 element._progress_incomplete_container = e; 75 76 … … 81 82 e = document.createElement( 'a' ); 82 83 e.appendChild( image ); 83 element[0].appendChild( e );84 top_e.appendChild( e ); 84 85 element._pause_resume_button_image = image; 85 86 //element._pause_resume_button = e; … … 89 90 e = document.createElement( 'div' ); 90 91 e.className = 'torrent_peer_details'; 91 element[0].appendChild( e );92 top_e.appendChild( e ); 92 93 element._peer_details_container = e; 93 94 … … 102 103 103 104 // insert the element 104 $('#torrent_list').append(this._element);105 this._controller._torrent_list.appendChild( top_e ); 105 106 106 107 this._files = []; … … 108 109 if(data.files){ 109 110 if(data.files.length == 1) 110 this._fileList. addClass('single_file');111 this._fileList.className += ' single_file'; 111 112 for (var i = 0; i < data.files.length; i++) { 112 113 var file = data.files[i]; … … 117 118 var torrentFile = new TorrentFile(file); 118 119 this._files.push(torrentFile); 119 var class = (i % 2 ? 'even' : 'odd') + ' inspector_torrent_file_list_entry';120 torrentFile.element()[0].className = class;121 this._fileList [0].appendChild(torrentFile.element()[0]);120 var e = torrentFile.domElement(); 121 e.className = (i % 2 ? 'even' : 'odd') + ' inspector_torrent_file_list_entry'; 122 this._fileList.appendChild( e ); 122 123 } 123 124 } … … 128 129 129 130 initializeTorrentFilesInspectorGroup: function(length) { 130 this._fileList = $('<ul/>').addClass('inspector_torrent_file_list').addClass('inspector_group').hide(); 131 $('#inspector_file_list').append(this._fileList); 131 var e = document.createElement( 'ul' ); 132 e.className = 'inspector_torrent_file_list inspector_group'; 133 e.style.display = 'none'; 134 this._controller._inspector_file_list.appendChild( e ); 135 this._fileList = e; 132 136 }, 133 137 134 138 fileList: function() { 135 return this._fileList;139 return $(this._fileList); 136 140 }, 137 141 … … 479 483 */ 480 484 isSelected: function() { 481 var e = this.element( ); 482 return e && $.className.has( e[0], 'selected' ); 485 return this.element()[0].className.indexOf('selected') != -1; 483 486 }, 484 487 … … 670 673 li.appendChild(prog_div); 671 674 672 this._element = $(li);675 this._element = li; 673 676 this._priority_control = $(pri_div); 674 677 this._progress = $(prog_div); … … 702 705 703 706 element: function() { 707 return $(this._element); 708 }, 709 710 domElement: function() { 704 711 return this._element; 705 712 }, -
trunk/web/javascript/transmission.js
r8492 r8494 75 75 this.createSettingsMenu(); 76 76 } 77 78 this._torrent_list = $('#torrent_list')[0]; 79 this._inspector_file_list = $('#inspector_file_list')[0]; 77 80 78 81 // Setup the preference box
Note: See TracChangeset
for help on using the changeset viewer.