Changeset 8075


Ignore:
Timestamp:
Mar 19, 2009, 12:46:53 PM (13 years ago)
Author:
livings124
Message:

#1940 Disable file wanted and priority selector when there is only one file.

Location:
trunk/web
Files:
2 edited

Legend:

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

    r8069 r8075  
    8989                // insert the element
    9090                $('#torrent_list').append(this._element);
    91                 this.initializeTorrentFilesInspectorGroup();
     91                this.initializeTorrentFilesInspectorGroup(data.files.length);
    9292               
    9393                for (var i = 0; i < data.files.length; i++) {
     
    108108        },
    109109       
    110         initializeTorrentFilesInspectorGroup: function() {
     110        initializeTorrentFilesInspectorGroup: function(length) {
    111111                this._files = [];
    112                 this._fileList = $('<ul/>').addClass('inspector_torrent_file_list').addClass('inspector_group').hide().
    113                         append($('<li/>').addClass('inspector_group_label').append(
    114                                 $('<div/>').append(this.name())
    115                         )
    116                 );
    117                 $('#inspector_file_list').append(this._fileList);
     112        this._fileList = $('<ul/>').addClass('inspector_torrent_file_list').addClass('inspector_group').hide();
     113        if(length == 1)
     114            this._fileList.addClass('single_file');
     115        $('#inspector_file_list').append(this._fileList);
    118116        },
    119117       
     
    673671       
    674672        setPriority: function(priority) {
    675                 if(this.element().hasClass('complete'))
     673                if(this.element().hasClass('complete') || this._torrent._files.length == 1)
    676674                  return;
    677675                var priority_level = { high: 1, normal: 0, low: -1 }[priority];
     
    697695       
    698696        toggleWanted: function() {
    699                 if(this.element().hasClass('complete'))
     697                if(this.element().hasClass('complete') || this._torrent._files.length == 1)
    700698                  return;
    701699                this.setWanted(!this._wanted);
  • trunk/web/stylesheets/common.css

    r8070 r8075  
    646646}
    647647
     648ul.single_file li.inspector_torrent_file_list_entry>.file_wanted_control,
    648649li.inspector_torrent_file_list_entry.complete>.file_wanted_control {
    649650        background-position: left -38px;
     
    679680        background-position: right -38px;
    680681}
    681 li.inspector_torrent_file_list_entry.complete div.file_priority_control,
    682 li.inspector_torrent_file_list_entry.complete div.file_priority_control:hover {
     682ul.single_file li.inspector_torrent_file_list_entry>.file_priority_control,
     683li.inspector_torrent_file_list_entry.complete div.file_priority_control {
    683684  background-position: left -57px;
    684685  cursor: default;
Note: See TracChangeset for help on using the changeset viewer.