Ticket #1940: 0001-disable-wanted-and-priority-on-single-files.patch

File 0001-disable-wanted-and-priority-on-single-files.patch, 3.0 KB (added by kjg, 13 years ago)
  • web/javascript/torrent.js

    From eea00427a6f35561732fde86f8e3c884ffbb098b Mon Sep 17 00:00:00 2001
    From: Kevin Glowacz <kevin@glowacz.info>
    Date: Wed, 18 Mar 2009 19:02:31 -0500
    Subject: [PATCH] disable wanted and priority on single files
    
    ---
     web/javascript/torrent.js  |   16 +++++++---------
     web/stylesheets/common.css |    5 +++--
     2 files changed, 10 insertions(+), 11 deletions(-)
    
    diff --git a/web/javascript/torrent.js b/web/javascript/torrent.js
    index 4caba9d..cddb623 100644
    a b Torrent.prototype = 
    8888               
    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++) {
    9494                        var file = data.files[i];
    Torrent.prototype = 
    107107                this.refresh(data);
    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                 );
     112                this._fileList = $('<ul/>').addClass('inspector_torrent_file_list').addClass('inspector_group').hide();
     113                if(length == 1)
     114                  this._fileList.addClass('single_file');
    117115                $('#inspector_file_list').append(this._fileList);
    118116        },
    119117
    TorrentFile.prototype = { 
    672670        },
    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];
    678676                if (this._prio == priority_level) { return; }
    TorrentFile.prototype = { 
    696694        },
    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);
    702700        },
  • web/stylesheets/common.css

    diff --git a/web/stylesheets/common.css b/web/stylesheets/common.css
    index a895b1d..2a01202 100644
    a b li.inspector_torrent_file_list_entry.complete>.file_wanted_control { 
    645645        background-position: left -19px;
    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;
    650651        cursor: default;
    div.file_priority_control.low { 
    678679div.file_priority_control.low:hover {
    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;
    685686}