Changeset 12837


Ignore:
Timestamp:
Sep 3, 2011, 7:15:03 PM (10 years ago)
Author:
jordan
Message:

avoid unnecessary callback closures in the inspector.

File:
1 edited

Legend:

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

    r12833 r12837  
    3838    },
    3939
    40     onTabClicked = function (ev, tab) {
     40    onTabClicked = function (ev) {
     41        var tab = ev.currentTarget;
     42
    4143        if (isMobileDevice)
    4244            ev.stopPropagation();
     
    204206        var i, row, rows=[], t=data.file_torrent;
    205207        if (!t)
    206                 return;
     208            return;
    207209        for (i=0; row=data.file_rows[i]; ++i)
    208210            if (row.isEditable() && (t.getFile(i).wanted !== s))
     
    213215
    214216    changeFileCommand = function(rows, command) {
    215         var torrentId = data.file_torrent.getId();
    216         var rowIndices = $.map(rows.slice(0),function (row) {return row.getIndex();});
     217        var torrentId = data.file_torrent.getId();
     218        var rowIndices = $.map(rows.slice(0),function (row) {return row.getIndex();});
    217219        data.controller.changeFileCommand(torrentId, rowIndices, command);
    218220    },
    219221
    220     onFileWantedToggled = function(row, want) {
     222    onFileWantedToggled = function(ev, row, want) {
    221223        changeFileCommand([row], want?'files-wanted':'files-unwanted');
    222224    },
    223225
    224     onFilePriorityToggled = function(row, priority) {
     226    onFilePriorityToggled = function(ev, row, priority) {
    225227        var command;
    226228        switch(priority) {
     
    261263            row = data.file_rows[i] = new FileRow(tor, i);
    262264            fragment.appendChild(row.getElement());
    263                     $(row).bind('wantedToggled',function(e,row,want) {onFileWantedToggled(row,want);});
    264                     $(row).bind('priorityToggled',function(e,row,priority) {onFilePriorityToggled(row,priority);});
     265                    $(row).bind('wantedToggled',onFileWantedToggled);
     266                    $(row).bind('priorityToggled',onFilePriorityToggled);
    265267        }
    266268
     
    451453        data.controller = controller;
    452454
    453         $('.inspector_tab').click(function (e) {onTabClicked(e, this);});
    454         $('#files_select_all').live('click', function(e) { filesSelectAllClicked(); });
    455         $('#files_deselect_all').live('click', function(e) { filesDeselectAllClicked(); });
     455        $('.inspector_tab').click(onTabClicked);
     456        $('#files_select_all').click(filesSelectAllClicked);
     457        $('#files_deselect_all').click(filesDeselectAllClicked);
    456458
    457459        data.elements.info_page      = $('#inspector_tab_info_container')[0];
Note: See TracChangeset for help on using the changeset viewer.