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 = |
88 | 88 | |
89 | 89 | // insert the element |
90 | 90 | $('#torrent_list').append(this._element); |
91 | | this.initializeTorrentFilesInspectorGroup(); |
| 91 | this.initializeTorrentFilesInspectorGroup(data.files.length); |
92 | 92 | |
93 | 93 | for (var i = 0; i < data.files.length; i++) { |
94 | 94 | var file = data.files[i]; |
… |
… |
Torrent.prototype = |
107 | 107 | this.refresh(data); |
108 | 108 | }, |
109 | 109 | |
110 | | initializeTorrentFilesInspectorGroup: function() { |
| 110 | initializeTorrentFilesInspectorGroup: function(length) { |
111 | 111 | 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'); |
117 | 115 | $('#inspector_file_list').append(this._fileList); |
118 | 116 | }, |
119 | 117 | |
… |
… |
TorrentFile.prototype = { |
672 | 670 | }, |
673 | 671 | |
674 | 672 | setPriority: function(priority) { |
675 | | if(this.element().hasClass('complete')) |
| 673 | if(this.element().hasClass('complete') || this._torrent._files.length == 1) |
676 | 674 | return; |
677 | 675 | var priority_level = { high: 1, normal: 0, low: -1 }[priority]; |
678 | 676 | if (this._prio == priority_level) { return; } |
… |
… |
TorrentFile.prototype = { |
696 | 694 | }, |
697 | 695 | |
698 | 696 | toggleWanted: function() { |
699 | | if(this.element().hasClass('complete')) |
| 697 | if(this.element().hasClass('complete') || this._torrent._files.length == 1) |
700 | 698 | return; |
701 | 699 | this.setWanted(!this._wanted); |
702 | 700 | }, |
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 { |
645 | 645 | background-position: left -19px; |
646 | 646 | } |
647 | 647 | |
| 648 | ul.single_file li.inspector_torrent_file_list_entry>.file_wanted_control, |
648 | 649 | li.inspector_torrent_file_list_entry.complete>.file_wanted_control { |
649 | 650 | background-position: left -38px; |
650 | 651 | cursor: default; |
… |
… |
div.file_priority_control.low { |
678 | 679 | div.file_priority_control.low:hover { |
679 | 680 | background-position: right -38px; |
680 | 681 | } |
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 { |
| 682 | ul.single_file li.inspector_torrent_file_list_entry>.file_priority_control, |
| 683 | li.inspector_torrent_file_list_entry.complete div.file_priority_control { |
683 | 684 | background-position: left -57px; |
684 | 685 | cursor: default; |
685 | 686 | } |