Changeset 8494


Ignore:
Timestamp:
May 23, 2009, 6:09:56 PM (14 years ago)
Author:
charles
Message:

(trunk web) #2052: "Warning: Unresponsive Script" in Web GUI

Location:
trunk/web/javascript
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/javascript/torrent.js

    r8493 r8494  
    4040
    4141                // 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);
    4546                element._torrent = this;
    4647                this._element = element;
     
    5152                var e = document.createElement( 'div' );
    5253                e.className = 'torrent_name';
    53                 element[0].appendChild( e );
     54                top_e.appendChild( e );
    5455                element._name_container = e;
    5556               
     
    5758                e = document.createElement( 'div' );
    5859                e.className = 'torrent_progress_details';
    59                 element[0].appendChild( e );
     60                top_e.appendChild( e );
    6061                element._progress_details_container = e;
    6162
     
    6465                e.className = 'torrent_progress_bar incomplete';
    6566                e.style.width = '0%';
    66                 element[0].appendChild( e );
     67                top_e.appendChild( e );
    6768                element._progress_complete_container = e;
    6869                       
     
    7172                e.className = 'torrent_progress_bar incomplete';
    7273                e.style.display = 'none';
    73                 element[0].appendChild( e );
     74                top_e.appendChild( e );
    7475                element._progress_incomplete_container = e;
    7576               
     
    8182                e = document.createElement( 'a' );
    8283                e.appendChild( image );
    83                 element[0].appendChild( e );
     84                top_e.appendChild( e );
    8485                element._pause_resume_button_image = image;
    8586                //element._pause_resume_button = e;
     
    8990                e = document.createElement( 'div' );
    9091                e.className = 'torrent_peer_details';
    91                 element[0].appendChild( e );
     92                top_e.appendChild( e );
    9293                element._peer_details_container = e;
    9394               
     
    102103               
    103104                // insert the element
    104                 $('#torrent_list').append(this._element);
     105                this._controller._torrent_list.appendChild( top_e );
    105106
    106107                this._files = [];
     
    108109                if(data.files){
    109110                        if(data.files.length == 1)
    110                                 this._fileList.addClass('single_file');
     111                                this._fileList.className += ' single_file';
    111112                        for (var i = 0; i < data.files.length; i++) {
    112113                                var file = data.files[i];
     
    117118                                var torrentFile = new TorrentFile(file);
    118119                                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 );
    122123                        }
    123124                }
     
    128129       
    129130        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;
    132136        },
    133137       
    134138        fileList: function() {
    135                 return this._fileList;
     139                return $(this._fileList);
    136140        },
    137141       
     
    479483         */
    480484        isSelected: function() {
    481                 var e = this.element( );
    482                 return e && $.className.has( e[0], 'selected' );
     485                return this.element()[0].className.indexOf('selected') != -1;
    483486        },
    484487
     
    670673                li.appendChild(prog_div);
    671674               
    672                 this._element = $(li);
     675                this._element = li;
    673676                this._priority_control = $(pri_div);
    674677                this._progress = $(prog_div);
     
    702705       
    703706        element: function() {
     707                return $(this._element);
     708        },
     709       
     710        domElement: function() {
    704711                return this._element;
    705712        },
  • trunk/web/javascript/transmission.js

    r8492 r8494  
    7575                        this.createSettingsMenu();
    7676                }
     77
     78                this._torrent_list = $('#torrent_list')[0];
     79                this._inspector_file_list = $('#inspector_file_list')[0];
    7780               
    7881                // Setup the preference box
Note: See TracChangeset for help on using the changeset viewer.