(trunk web) A lot of web cleanup, refactoring, bugfixes, and probably new breakage. Filterbar/statusbar has been reworked. Added filter-by-tracker. Compact mode now works in "iPhone" mode.

This commit is contained in:
Jordan Lee 2011-08-24 02:04:35 +00:00
parent 25ca73dca5
commit 2dc746a7b6
14 changed files with 2140 additions and 2149 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -9,13 +9,17 @@
<link href="./images/favicon.png" rel="shortcut icon" />
<link rel="apple-touch-icon" href="./images/webclip-icon.png"/>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css" type="text/css" media="all" />
<!--
<link media="screen" href="./stylesheets/iphone.css" type= "text/css" rel="stylesheet" />
-->
<link media="only screen and (max-device-width: 480px)" href="./stylesheets/iphone.css" type= "text/css" rel="stylesheet" />
<link media="screen and (min-device-width: 481px)" href="./stylesheets/common.css" type="text/css" rel="stylesheet" />
<!--[if IE]>
<link media="screen" href="./stylesheets/common.css" type="text/css" rel="stylesheet" />
<link media="screen" href="./stylesheets/ieAll.css" type="text/css" rel="stylesheet" />
<![endif]-->
<!--[if IE 6]><link media="screen" href="./stylesheets/ie6.css" type="text/css" rel="stylesheet" /><![endif]-->
<!--[if IE 7]><link media="screen" href="./stylesheets/ie7.css" type="text/css" rel="stylesheet" /><![endif]-->
<script type="text/javascript" src="./javascript/jquery/jquery.transmenu.min.js"></script>
<script type="text/javascript" src="./javascript/jquery/jquery.contextmenu.min.js"></script>
@ -34,7 +38,7 @@
</head>
<body id="transmission_body">
<div class="torrent_global_menu">
<div id="toolbar">
<ul>
<li id="open"><div id="open_link"><div class="toolbar_image"></div>Open</div></li>
<li id="remove" class="disabled"><div id="remove_link"><div class="toolbar_image"></div>Remove</div></li>
@ -45,26 +49,23 @@
<li id="pause_all" class="disabled"><div id="pause_all_link"><div class="toolbar_image"></div>Pause All</div></li>
<li id="resume_all" class="disabled"><div id="resume_all_link"><div class="toolbar_image"></div>Resume All</div></li>
<li id="inspector"><div id="inspector_link"><div class="toolbar_image"></div>Inspector</div></li>
<li id="filter"><div id="filter_toggle_link"><div class="toolbar_image"></div>Filter</div></li>
</ul>
</div>
<div class="torrent_global_details">
<div id="torrent_global_transfer">0 Transfers</div>
<div id="torrent_global_upload">0 B/s</div>
<div id="torrent_global_download">0 B/s</div>
</div>
<div id="torrent_filter_bar">
<ul>
<li><a href="#all" id="filter_all_link" class="active">All</a></li>
<li><a href="#active" id="filter_active_link">Active</a></li>
<li><a href="#downloading" id="filter_downloading_link">Downloading</a></li>
<li><a href="#seeding" id="filter_seeding_link">Seeding</a></li>
<li><a href="#paused" id="filter_paused_link">Paused</a></li>
<li><a href="#finished" id="filter_finished_link" class="finished">Finished</a></li>
</ul>
<div id="statusbar">
<input type="search" id="torrent_search" placeholder="Filter" results="0" />
<div id='filter-button'></div>
<div id='speed-info'>
<span id="speed-up-label">0 B/s</span>
<span id="speed-dn-label">0 B/s</span>
</div>
</div>
<div id="filter-popup" style="display:none;">
<div id='filter-popup-workarea'>
<div id='filter-by-state'></div>
<div id='filter-by-tracker'></div>
</div>
</div>
<div id="torrent_inspector" style="display:none;">
@ -539,6 +540,7 @@
</ul>
</li>
</ul>
<div id="compact-button">&nbsp;</div>
<div id="turtle_button">&nbsp;</div>
<div style="clear: both; visibility: hidden;"></div>
</div>

View File

@ -8,7 +8,6 @@
var transmission;
var dialog;
var resizeTimer = null;
// Test for a Webkit build that supports box-shadow: 521+ (release Safari 3 is
// actually 523.10.3). We need 3.1 for CSS animation (dialog sheets) but as it
// degrades gracefully let's not worry too much.
@ -16,11 +15,11 @@ var Safari3 = testSafari3();
var iPhone = RegExp("(iPhone|iPod|Android)").test(navigator.userAgent);
if (iPhone) var scroll_timeout;
if(!Array.indexOf){
if (!Array.indexOf){
Array.prototype.indexOf = function(obj){
var i, len;
for(i=0, len=this.length; i<len; i++)
if(this[i]==obj)
for (i=0, len=this.length; i<len; i++)
if (this[i]==obj)
return i;
return -1;
}
@ -29,7 +28,7 @@ if(!Array.indexOf){
function testSafari3()
{
var minimum = new Array(521,0);
var webKitFields = RegExp("( AppleWebKit/)([^ ]+)").exec(navigator.userAgent);
var webKitFields = RegExp("(AppleWebKit/)([^ ]+)").exec(navigator.userAgent);
if (!webKitFields || webKitFields.length < 3) return false;
var version = webKitFields[2].split(".");
for (var i = 0; i < minimum.length; i++) {
@ -43,7 +42,7 @@ function testSafari3()
return true;
};
$(document).ready( function() {
$(document).ready(function() {
// Initialise the dialog controller
dialog = new Dialog();
@ -83,20 +82,13 @@ $(document).ready( function() {
}
if (iPhone){
window.onload = function(){ setTimeout(function() { window.scrollTo(0,1); },500); };
window.onorientationchange = function(){ setTimeout( function() { window.scrollTo(0,1); },100); };
if(window.navigator.standalone)
window.onorientationchange = function(){ setTimeout(function() { window.scrollTo(0,1); },100); };
if (window.navigator.standalone)
// Fix min height for iPhone when run in full screen mode from home screen
// so the footer appears in the right place
$('body div#torrent_container').css('min-height', '338px');
$("label[for=torrent_upload_url]").text("URL: ");
}
// Add resize event handler with a timeout to handle browsers that fire a
// resize event for every pixel changed
$(window).bind('resize', function() {
if (resizeTimer) clearTimeout(resizeTimer);
resizeTimer = setTimeout('transmission.refreshDisplay()', 50)
});
});
/*
@ -113,15 +105,15 @@ Array.prototype.clone = function () {
* changes are triggered by periodic refreshes on torrents whose state hasn't
* changed since the last update, so even this simple test helps a lot.
*/
function setInnerHTML( e, html )
function setInnerHTML(e, html)
{
if( e == undefined )
if (e == undefined)
return;
/* innerHTML is listed as a string, but the browser seems to change it.
* For example, "&infin;" gets changed to "∞" somewhere down the line.
* So, let's use an arbitrary different field to test our state... */
if( e.currentHTML != html )
if (e.currentHTML != html)
{
e.currentHTML = html;
e.innerHTML = html;
@ -131,12 +123,12 @@ function setInnerHTML( e, html )
/*
* Given a numerator and denominator, return a ratio string
*/
Math.ratio = function( numerator, denominator ) {
Math.ratio = function(numerator, denominator) {
var result = Math.floor(100 * numerator / denominator) / 100;
// check for special cases
if(result==Number.POSITIVE_INFINITY || result==Number.NEGATIVE_INFINITY) result = -2;
else if(isNaN(result)) result = -1;
if (result==Number.POSITIVE_INFINITY || result==Number.NEGATIVE_INFINITY) result = -2;
else if (isNaN(result)) result = -1;
return result;
};
@ -150,16 +142,16 @@ Math.ratio = function( numerator, denominator ) {
* @returns float
*/
Math.truncateWithPrecision = function(floatnum, precision) {
return Math.floor( floatnum * Math.pow ( 10, precision ) ) / Math.pow( 10, precision );
return Math.floor(floatnum * Math.pow (10, precision)) / Math.pow(10, precision);
};
/*
* Round a string of a number to a specified number of decimal
* places
*/
Number.prototype.toTruncFixed = function( place ) {
var ret = Math.truncateWithPrecision( this, place );
return ret.toFixed( place );
Number.prototype.toTruncFixed = function(place) {
var ret = Math.truncateWithPrecision(this, place);
return ret.toFixed(place);
}
/*
@ -172,10 +164,10 @@ String.prototype.trim = function () {
/**
* @brief strcmp()-style compare useful for sorting
*/
String.prototype.compareTo = function( that ) {
String.prototype.compareTo = function(that) {
// FIXME: how to fold these two comparisons together?
if( this < that ) return -1;
if( this > that ) return 1;
if (this < that) return -1;
if (this > that) return 1;
return 0;
}
@ -183,7 +175,7 @@ String.prototype.compareTo = function( that ) {
* @brief Switch between different dialog tabs
*/
function changeTab(tab, id) {
for ( var x = 0, node; tab.parentNode.childNodes[x]; x++ ) {
for (var x = 0, node; tab.parentNode.childNodes[x]; x++) {
node = tab.parentNode.childNodes[x];
if (node == tab) {
node.className = "prefs_tab_enabled";
@ -191,7 +183,7 @@ function changeTab(tab, id) {
node.className = "prefs_tab_disabled";
}
}
for ( x = 0; tab.parentNode.parentNode.childNodes[x]; x++ ) {
for (x = 0; tab.parentNode.parentNode.childNodes[x]; x++) {
node = tab.parentNode.parentNode.childNodes[x];
if (node.tagName == "DIV") {
if (node.id == id) {
@ -213,8 +205,6 @@ Prefs.prototype = { };
Prefs._RefreshRate = 'refresh_rate';
Prefs._SessionRefreshRate = 'session_refresh_rate';
Prefs._ShowFilter = 'show_filter';
Prefs._ShowInspector = 'show_inspector';
Prefs._FilterMode = 'filter';
@ -257,10 +247,10 @@ Prefs._Defaults =
/*
* Set a preference option
*/
Prefs.setValue = function( key, val )
Prefs.setValue = function(key, val)
{
if( Prefs._Defaults[key] == undefined )
console.warn( "unrecognized preference key '%s'", key );
if (Prefs._Defaults[key] == undefined)
console.warn("unrecognized preference key '%s'", key);
var days = 30;
var date = new Date();
@ -274,25 +264,25 @@ Prefs.setValue = function( key, val )
* @param key the preference's key
* @param fallback if the option isn't set, return this instead
*/
Prefs.getValue = function( key, fallback )
Prefs.getValue = function(key, fallback)
{
var val;
if( Prefs._Defaults[key] == undefined )
console.warn( "unrecognized preference key '%s'", key );
if (Prefs._Defaults[key] == undefined)
console.warn("unrecognized preference key '%s'", key);
var lines = document.cookie.split( ';' );
for( var i=0, len=lines.length; !val && i<len; ++i ) {
var line = lines[i].trim( );
var delim = line.indexOf( '=' );
if( ( delim == key.length ) && line.indexOf( key ) == 0 )
val = line.substring( delim + 1 );
var lines = document.cookie.split(';');
for (var i=0, len=lines.length; !val && i<len; ++i) {
var line = lines[i].trim();
var delim = line.indexOf('=');
if ((delim == key.length) && line.indexOf(key) == 0)
val = line.substring(delim + 1);
}
// FIXME: we support strings and booleans... add number support too?
if( !val ) val = fallback;
else if( val == 'true' ) val = true;
else if( val == 'false' ) val = false;
if (!val) val = fallback;
else if (val == 'true') val = true;
else if (val == 'false') val = false;
return val;
};
@ -301,12 +291,12 @@ Prefs.getValue = function( key, fallback )
*
* @pararm o object to be populated (optional)
*/
Prefs.getClutchPrefs = function( o )
Prefs.getClutchPrefs = function(o)
{
if( !o )
if (!o)
o = { };
for( var key in Prefs._Defaults )
o[key] = Prefs.getValue( key, Prefs._Defaults[key] );
for (var key in Prefs._Defaults)
o[key] = Prefs.getValue(key, Prefs._Defaults[key]);
return o;
};
@ -334,3 +324,40 @@ jQuery.fn.forceNumeric = function () {
});
});
}
/**
* http://blog.stevenlevithan.com/archives/parseuri
*
* parseUri 1.2.2
* (c) Steven Levithan <stevenlevithan.com>
* MIT License
*/
function parseUri (str) {
var o = parseUri.options,
m = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
uri = {},
i = 14;
while (i--) uri[o.key[i]] = m[i] || "";
uri[o.q.name] = {};
uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
if ($1) uri[o.q.name][$1] = $2;
});
return uri;
};
parseUri.options = {
strictMode: false,
key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
q: {
name: "queryKey",
parser: /(?:^|&)([^&=]*)=?([^&]*)/g
},
parser: {
strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
}
};

View File

@ -29,8 +29,8 @@ Dialog.prototype = {
this._callback_data = null;
// Observe the buttons
this._cancel_button.bind('click', {dialog: this}, this.onCancelClicked );
this._confirm_button.bind('click', {dialog: this}, this.onConfirmClicked );
this._cancel_button.bind('click', {dialog: this}, this.onCancelClicked);
this._confirm_button.bind('click', {dialog: this}, this.onConfirmClicked);
},
@ -43,7 +43,7 @@ Dialog.prototype = {
*
*--------------------------------------------*/
hideDialog: function( )
hideDialog: function()
{
$('body.dialog_showing').removeClass('dialog_showing');
if (Safari3) {
@ -56,16 +56,16 @@ Dialog.prototype = {
transmission.updateButtonStates();
},
onCancelClicked: function( event )
onCancelClicked: function(event)
{
event.data.dialog.hideDialog( );
event.data.dialog.hideDialog();
},
onConfirmClicked: function( event )
onConfirmClicked: function(event)
{
var dialog = event.data.dialog;
eval( dialog._callback_function + "(dialog._callback_data)" );
dialog.hideDialog( );
eval(dialog._callback_function + "(dialog._callback_data)");
dialog.hideDialog();
},
/*--------------------------------------------
@ -86,10 +86,10 @@ Dialog.prototype = {
} else if (!iPhone) {
$('.dialog_container').hide();
}
setInnerHTML( this._heading[0], dialog_heading );
setInnerHTML( this._message[0], dialog_message );
setInnerHTML( this._cancel_button[0], (cancel_button_label == null) ? 'Cancel' : cancel_button_label );
setInnerHTML( this._confirm_button[0], confirm_button_label );
setInnerHTML(this._heading[0], dialog_heading);
setInnerHTML(this._message[0], dialog_message);
setInnerHTML(this._cancel_button[0], (cancel_button_label == null) ? 'Cancel' : cancel_button_label);
setInnerHTML(this._confirm_button[0], confirm_button_label);
this._confirm_button.show();
this._callback_function = callback_function;
this._callback_data = callback_data;
@ -115,11 +115,11 @@ Dialog.prototype = {
} else if (!iPhone) {
$('.dialog_container').hide();
}
setInnerHTML( this._heading[0], dialog_heading );
setInnerHTML( this._message[0], dialog_message );
setInnerHTML(this._heading[0], dialog_heading);
setInnerHTML(this._message[0], dialog_message);
// jquery::hide() doesn't work here in Safari for some odd reason
this._confirm_button.css('display', 'none');
setInnerHTML( this._cancel_button[0], cancel_button_label );
setInnerHTML(this._cancel_button[0], cancel_button_label);
// Just in case
if (!iPhone && Safari3) {
$('div#upload_container div.dialog_window').css('top', '-205px');

View File

@ -4,48 +4,48 @@
* <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
*/
function FileRow( controller, torrent, i )
function FileRow(torrent, i)
{
this.initialize( controller, torrent, i );
this.initialize(torrent, i);
}
FileRow.prototype =
{
initialize: function( controller, torrent, i )
initialize: function(torrent, i)
{
this._torrent = torrent;
this._index = i;
this.createRow( torrent, i );
this.createRow(torrent, i);
},
getTorrent: function( )
getTorrent: function()
{
return this._torrent;
},
getIndex: function( )
getIndex: function()
{
return this._index;
},
readAttributes: function(file)
{
if( file.index !== undefined && file.index !== this._index ) {
if (file.index !== undefined && file.index !== this._index) {
this._index = file.index;
this._dirty = true;
}
if( file.bytesCompleted !== undefined && file.bytesCompleted !== this._done ) {
if (file.bytesCompleted !== undefined && file.bytesCompleted !== this._done) {
this._done = file.bytesCompleted;
this._dirty = true;
}
if( file.length !== undefined && file.length !== this._size ) {
if (file.length !== undefined && file.length !== this._size) {
this._size = file.length;
this._dirty = true;
}
if( file.priority !== undefined && file.priority !== this._prio ) {
if (file.priority !== undefined && file.priority !== this._prio) {
this._prio = file.priority;
this._dirty = true;
}
if( file.wanted !== undefined && file.wanted !== this._wanted ) {
if (file.wanted !== undefined && file.wanted !== this._wanted) {
this._wanted = file.wanted;
this._dirty = true;
}
@ -54,22 +54,22 @@ FileRow.prototype =
refreshWantedHTML: function() {
var e = this.getElement();
var c = [ e.classNameConst ];
if(!this._wanted) { c.push( 'skip' ); }
if(this.isDone()) { c.push( 'complete' ); }
if (!this._wanted) { c.push('skip'); }
if (this.isDone()) { c.push('complete'); }
e.className = c.join(' ');
},
refreshPriorityHTML: function() {
var e = this._priority_control;
var c = [ e.classNameConst ];
switch( this._prio ) {
case 1 : c.push( 'high' ); break;
case -1 : c.push( 'low' ); break;
default : c.push( 'normal' ); break;
switch(this._prio) {
case -1 : c.push('low'); break;
case 1 : c.push('high'); break;
default : c.push('normal'); break;
}
e.className = c.join(' ');
},
refreshProgressHTML: function() {
var pct = 100 * (this._size ? ( this._done / this._size ) : 1.0);
var pct = 100 * (this._size ? (this._done / this._size) : 1.0);
var c = [ Transmission.fmt.size(this._done),
' of ',
Transmission.fmt.size(this._size),
@ -79,18 +79,18 @@ FileRow.prototype =
setInnerHTML(this._progress[0], c);
},
refreshHTML: function() {
if( this._dirty ) {
if (this._dirty) {
this._dirty = false;
this.refreshProgressHTML();
this.refreshWantedHTML();
this.refreshPriorityHTML();
}
},
refresh: function( )
refresh: function()
{
var i = this.getIndex( );
var t = this.getTorrent( );
this.readAttributes( t._files[i] );
var i = this.getIndex();
var t = this.getTorrent();
this.readAttributes(t._files[i]);
this.refreshHTML();
},
@ -101,7 +101,7 @@ FileRow.prototype =
return (this.getTorrent()._files.length>1) && !this.isDone();
},
createRow: function( torrent, i )
createRow: function(torrent, i)
{
var me = this;
var file = torrent._files[i];
@ -114,7 +114,7 @@ FileRow.prototype =
var wanted_div = document.createElement('div');
wanted_div.className = "file_wanted_control";
$(wanted_div).bind('click',function(e){ me.fireWantedChanged( !me._wanted ); });
$(wanted_div).bind('click',function(){ me.fireWantedChanged(!me._wanted); });
var pri_div = document.createElement('div');
pri_div.classNameConst = "file_priority_control";
@ -122,21 +122,21 @@ FileRow.prototype =
$(pri_div).bind('click',function(ev){
var x = ev.pageX;
var e = ev.target;
while (e !== null) {
while (e) {
x -= e.offsetLeft;
e = e.offsetParent;
}
var prio;
if(iPhone) {
if( x < 8 ) prio = -1;
else if( x < 27 ) prio = 0;
if (iPhone) {
if (x < 8) prio = -1;
else if (x < 27) prio = 0;
else prio = 1;
} else {
if( x < 12 ) prio = -1;
else if( x < 23 ) prio = 0;
if (x < 12) prio = -1;
else if (x < 23) prio = 0;
else prio = 1;
}
me.firePriorityChanged( prio );
me.firePriorityChanged(prio);
});
var file_div = document.createElement('div');
@ -159,16 +159,16 @@ FileRow.prototype =
return root;
},
getElement: function( )
getElement: function()
{
return this._element;
},
fireWantedChanged: function( do_want )
fireWantedChanged: function(do_want)
{
$(this).trigger('wantedToggled',[ this, do_want ]);
},
firePriorityChanged: function( priority )
firePriorityChanged: function(priority)
{
$(this).trigger('priorityToggled',[ this, priority ]);
}

View File

@ -30,8 +30,9 @@ Transmission.fmt = (function()
return {
updateUnits: function( u )
updateUnits: function(u)
{
/*
speed_K = u['speed-bytes'];
speed_K_str = u['speed-units'][0];
speed_M_str = u['speed-units'][1];
@ -49,30 +50,31 @@ Transmission.fmt = (function()
mem_M_str = u['memory-units'][1];
mem_G_str = u['memory-units'][2];
mem_T_str = u['memory-units'][3];
*/
},
/*
* Format a percentage to a string
*/
percentString: function( x ) {
if( x < 10.0 )
return x.toTruncFixed( 2 );
else if( x < 100.0 )
return x.toTruncFixed( 1 );
percentString: function(x) {
if (x < 10.0)
return x.toTruncFixed(2);
else if (x < 100.0)
return x.toTruncFixed(1);
else
return x.toTruncFixed( 0 );
return x.toTruncFixed(0);
},
/*
* Format a ratio to a string
*/
ratioString: function( x ) {
if( x == -1 )
ratioString: function(x) {
if (x == -1)
return "None";
else if( x == -2 )
else if (x == -2)
return '&infin;';
else
return this.percentString( x );
return this.percentString(x);
},
/**
@ -80,32 +82,32 @@ Transmission.fmt = (function()
* @param {Number} bytes the filesize in bytes
* @return {String} human-readable string
*/
mem: function( bytes )
mem: function(bytes)
{
if( bytes < mem_K )
if (bytes < mem_K)
return [ bytes, mem_B_str ].join(' ');
var convertedSize;
var unit;
if( bytes < Math.pow( mem_K, 2 ) )
if (bytes < Math.pow(mem_K, 2))
{
convertedSize = bytes / mem_K;
unit = mem_K_str;
}
else if( bytes < Math.pow( mem_K, 3 ) )
else if (bytes < Math.pow(mem_K, 3))
{
convertedSize = bytes / Math.pow( mem_K, 2 );
convertedSize = bytes / Math.pow(mem_K, 2);
unit = mem_M_str;
}
else if( bytes < Math.pow( mem_K, 4 ) )
else if (bytes < Math.pow(mem_K, 4))
{
convertedSize = bytes / Math.pow( mem_K, 3 );
convertedSize = bytes / Math.pow(mem_K, 3);
unit = mem_G_str;
}
else
{
convertedSize = bytes / Math.pow( mem_K, 4 );
convertedSize = bytes / Math.pow(mem_K, 4);
unit = mem_T_str;
}
@ -119,32 +121,32 @@ Transmission.fmt = (function()
* @param {Number} bytes the filesize in bytes
* @return {String} human-readable string
*/
size: function( bytes )
size: function(bytes)
{
if( bytes < size_K )
if (bytes < size_K)
return [ bytes, size_B_str ].join(' ');
var convertedSize;
var unit;
if( bytes < Math.pow( size_K, 2 ) )
if (bytes < Math.pow(size_K, 2))
{
convertedSize = bytes / size_K;
unit = size_K_str;
}
else if( bytes < Math.pow( size_K, 3 ) )
else if (bytes < Math.pow(size_K, 3))
{
convertedSize = bytes / Math.pow( size_K, 2 );
convertedSize = bytes / Math.pow(size_K, 2);
unit = size_M_str;
}
else if( bytes < Math.pow( size_K, 4 ) )
else if (bytes < Math.pow(size_K, 4))
{
convertedSize = bytes / Math.pow( size_K, 3 );
convertedSize = bytes / Math.pow(size_K, 3);
unit = size_G_str;
}
else
{
convertedSize = bytes / Math.pow( size_K, 4 );
convertedSize = bytes / Math.pow(size_K, 4);
unit = size_T_str;
}
@ -153,22 +155,22 @@ Transmission.fmt = (function()
: [ convertedSize.toTruncFixed(1), unit ].join(' ');
},
speedBps: function( Bps )
speedBps: function(Bps)
{
return this.speed( this.toKBps( Bps ) );
return this.speed(this.toKBps(Bps));
},
toKBps: function( Bps )
toKBps: function(Bps)
{
return Math.floor( Bps / speed_K );
return Math.floor(Bps / speed_K);
},
speed: function( KBps )
speed: function(KBps)
{
var speed = KBps;
if (speed <= 999.95) // 0 KBps to 999.9 K
return [ speed.toTruncFixed(1), speed_K_str ].join(' ');
if (speed <= 999.95) // 0 KBps to 999 K
return [ speed.toTruncFixed(0), speed_K_str ].join(' ');
speed /= speed_K;
@ -182,7 +184,7 @@ Transmission.fmt = (function()
return [ speed.toTruncFixed(2), speed_G_str ].join(' ');
},
timeInterval: function( seconds )
timeInterval: function(seconds)
{
var result;
var days = Math.floor(seconds / 86400);
@ -208,9 +210,9 @@ Transmission.fmt = (function()
return result.join(' ');
},
timestamp: function( seconds )
timestamp: function(seconds)
{
if( !seconds )
if (!seconds)
return 'N/A';
var myDate = new Date(seconds*1000);
@ -223,11 +225,11 @@ Transmission.fmt = (function()
var sameMonth = now.getMonth() == myDate.getMonth();
var dateDiff = now.getDate() - myDate.getDate();
if(sameYear && sameMonth && Math.abs(dateDiff) <= 1){
if(dateDiff == 0){
if (sameYear && sameMonth && Math.abs(dateDiff) <= 1){
if (dateDiff == 0){
date = "Today";
}
else if(dateDiff == 1){
else if (dateDiff == 1){
date = "Yesterday";
}
else{
@ -240,22 +242,22 @@ Transmission.fmt = (function()
var hours = myDate.getHours();
var period = "AM";
if(hours > 12){
if (hours > 12){
hours = hours - 12;
period = "PM";
}
if(hours == 0){
if (hours == 0){
hours = 12;
}
if(hours < 10){
if (hours < 10){
hours = "0" + hours;
}
var minutes = myDate.getMinutes();
if(minutes < 10){
if (minutes < 10){
minutes = "0" + minutes;
}
var seconds = myDate.getSeconds();
if(seconds < 10){
if (seconds < 10){
seconds = "0" + seconds;
}
@ -264,7 +266,7 @@ Transmission.fmt = (function()
return [date, time, period].join(' ');
},
plural: function( i, word )
plural: function(i, word)
{
return [ i, ' ', word, (word==1?'':'s') ].join('');
}

View File

@ -13,26 +13,26 @@ function TorrentRendererHelper()
{
}
TorrentRendererHelper.getProgressInfo = function( controller, t )
TorrentRendererHelper.getProgressInfo = function(controller, t)
{
var seed_ratio_limit = t.seedRatioLimit( controller );
var seed_ratio_limit = t.seedRatioLimit(controller);
var pct = 0;
if( t.needsMetaData( ) )
if (t.needsMetaData())
pct = t.getMetadataPercentComplete() * 100;
else if( !t.isDone( ) )
pct = Math.round( t.getPercentDone() * 100 );
else if( seed_ratio_limit > 0 )
pct = Math.round( t.getUploadRatio() * 100 / seed_ratio_limit );
else if (!t.isDone())
pct = Math.round(t.getPercentDone() * 100);
else if (seed_ratio_limit > 0)
pct = Math.round(t.getUploadRatio() * 100 / seed_ratio_limit);
else
pct = 100;
var extra;
if( t.isStopped( ) )
if (t.isStopped())
extra = 'paused';
else if( t.isSeeding( ) )
else if (t.isSeeding())
extra = 'seeding';
else if( t.needsMetaData( ) )
else if (t.needsMetaData())
extra = 'magnet';
else
extra = 'leeching';
@ -42,24 +42,24 @@ TorrentRendererHelper.getProgressInfo = function( controller, t )
complete: [ 'torrent_progress_bar', 'complete', extra ].join(' '),
incomplete: [ 'torrent_progress_bar', 'incomplete', extra ].join(' ')
};
}
};
TorrentRendererHelper.createProgressbar = function( classes )
TorrentRendererHelper.createProgressbar = function(classes)
{
var complete = document.createElement( 'div' );
var complete = document.createElement('div');
complete.className = 'torrent_progress_bar complete';
var incomplete = document.createElement( 'div' );
var incomplete = document.createElement('div');
incomplete.className = 'torrent_progress_bar incomplete';
var progressbar = document.createElement( 'div' );
var progressbar = document.createElement('div');
progressbar.className = 'torrent_progress_bar_container ' + classes;
progressbar.appendChild( complete );
progressbar.appendChild( incomplete );
return { 'element': progressbar, 'complete': complete, 'incomplete': incomplete }
}
progressbar.appendChild(complete);
progressbar.appendChild(incomplete);
return { 'element': progressbar, 'complete': complete, 'incomplete': incomplete };
};
TorrentRendererHelper.renderProgressbar = function( controller, t, progressbar )
TorrentRendererHelper.renderProgressbar = function(controller, t, progressbar)
{
var info = TorrentRendererHelper.getProgressInfo( controller, t );
var info = TorrentRendererHelper.getProgressInfo(controller, t);
var e;
e = progressbar.complete;
e.style.width = '' + info.percent + "%";
@ -68,17 +68,17 @@ TorrentRendererHelper.renderProgressbar = function( controller, t, progressbar )
e = progressbar.incomplete;
e.className = info.incomplete;
e.style.display = info.percent>=100 ? 'none' : 'block';
}
};
TorrentRendererHelper.formatUL = function( t )
TorrentRendererHelper.formatUL = function(t)
{
return 'UL: ' + Transmission.fmt.speedBps( t.getUploadSpeed( ) );
}
return '&uarr; ' + Transmission.fmt.speedBps(t.getUploadSpeed());
};
TorrentRendererHelper.formatDL = function( t )
TorrentRendererHelper.formatDL = function(t)
{
return 'DL: ' + Transmission.fmt.speedBps( t.getDownloadSpeed( ) );
}
return '&darr; ' + Transmission.fmt.speedBps(t.getDownloadSpeed());
};
/****
*****
@ -90,31 +90,31 @@ function TorrentRendererFull()
}
TorrentRendererFull.prototype =
{
createRow: function( )
createRow: function()
{
var root = document.createElement( 'li' );
var root = document.createElement('li');
root.className = 'torrent';
var name = document.createElement( 'div' );
var name = document.createElement('div');
name.className = 'torrent_name';
var peers = document.createElement( 'div' );
var peers = document.createElement('div');
peers.className = 'torrent_peer_details';
var progressbar = TorrentRendererHelper.createProgressbar( 'full' );
var progressbar = TorrentRendererHelper.createProgressbar('full');
var details = document.createElement( 'div' );
var details = document.createElement('div');
details.className = 'torrent_progress_details';
var image = document.createElement( 'div' );
var button = document.createElement( 'a' );
button.appendChild( image );
var image = document.createElement('div');
var button = document.createElement('a');
button.appendChild(image);
root.appendChild( name );
root.appendChild( peers );
root.appendChild( button );
root.appendChild( progressbar.element );
root.appendChild( details );
root.appendChild(name);
root.appendChild(peers);
root.appendChild(button);
root.appendChild(progressbar.element);
root.appendChild(details);
root._name_container = name;
root._peer_details_container = peers;
@ -126,13 +126,13 @@ TorrentRendererFull.prototype =
return root;
},
getPeerDetails: function( t )
getPeerDetails: function(t)
{
var err;
if(( err = t.getErrorMessage()))
if ((err = t.getErrorMessage()))
return err;
if( t.isDownloading( ) )
if (t.isDownloading())
return [ 'Downloading from',
t.getPeersSendingToUs(),
'of',
@ -142,7 +142,7 @@ TorrentRendererFull.prototype =
TorrentRendererHelper.formatDL(t),
TorrentRendererHelper.formatUL(t) ].join(' ');
if( t.isSeeding( ) )
if (t.isSeeding())
return [ 'Seeding to',
t.getPeersGettingFromUs(),
'of',
@ -151,85 +151,85 @@ TorrentRendererFull.prototype =
'-',
TorrentRendererHelper.formatUL(t) ].join(' ');
if( t.isChecking( ) )
if (t.isChecking())
return [ 'Verifying local data (',
Transmission.fmt.percentString( 100.0 * t.getRecheckProgress() ),
Transmission.fmt.percentString(100.0 * t.getRecheckProgress()),
'% tested)' ].join('');
return t.getStateString( );
return t.getStateString();
},
getProgressDetails: function( controller, t )
getProgressDetails: function(controller, t)
{
if( t.needsMetaData() ) {
if (t.needsMetaData()) {
var percent = 100 * t.getMetadataPercentComplete();
return [ "Magnetized transfer - retrieving metadata (",
Transmission.fmt.percentString( percent ),
Transmission.fmt.percentString(percent),
"%)" ].join('');
}
var c;
var sizeWhenDone = t.getSizeWhenDone()
var totalSize = t.getTotalSize()
var is_done = ( t.isDone( ) ) || ( t.isSeeding() )
var sizeWhenDone = t.getSizeWhenDone();
var totalSize = t.getTotalSize();
var is_done = t.isDone() || t.isSeeding();
if( is_done ) {
if( totalSize == sizeWhenDone ) // seed: '698.05 MiB'
c = [ Transmission.fmt.size( totalSize ) ];
if (is_done) {
if (totalSize == sizeWhenDone) // seed: '698.05 MiB'
c = [ Transmission.fmt.size(totalSize) ];
else // partial seed: '127.21 MiB of 698.05 MiB (18.2%)'
c = [ Transmission.fmt.size( sizeWhenDone ),
c = [ Transmission.fmt.size(sizeWhenDone),
' of ',
Transmission.fmt.size( t.getTotalSize() ),
Transmission.fmt.size(t.getTotalSize()),
' (', t.getPercentDoneStr(), '%)' ];
// append UL stats: ', uploaded 8.59 GiB (Ratio: 12.3)'
c.push( ', uploaded ',
Transmission.fmt.size( t.getUploadedEver() ),
c.push(', uploaded ',
Transmission.fmt.size(t.getUploadedEver()),
' (Ratio ',
Transmission.fmt.ratioString( t.getUploadRatio() ),
')' );
Transmission.fmt.ratioString(t.getUploadRatio()),
')');
} else { // not done yet
c = [ Transmission.fmt.size( sizeWhenDone - t.getLeftUntilDone() ),
' of ', Transmission.fmt.size( sizeWhenDone ),
c = [ Transmission.fmt.size(sizeWhenDone - t.getLeftUntilDone()),
' of ', Transmission.fmt.size(sizeWhenDone),
' (', t.getPercentDoneStr(), '%)' ];
}
// maybe append eta
if( !t.isStopped() && ( !is_done || t.seedRatioLimit(controller)>0 ) ) {
if (!t.isStopped() && (!is_done || t.seedRatioLimit(controller)>0)) {
c.push(' - ');
var eta = t.getETA()
if (eta < 0 || eta >= (999*60*60) /* arbitrary */ )
c.push( 'remaining time unknown' );
var eta = t.getETA();
if (eta < 0 || eta >= (999*60*60) /* arbitrary */)
c.push('remaining time unknown');
else
c.push( Transmission.fmt.timeInterval(t.getETA()),
' remaining' );
c.push(Transmission.fmt.timeInterval(t.getETA()),
' remaining');
}
return c.join('');
},
render: function( controller, t, root )
render: function(controller, t, root)
{
// name
setInnerHTML( root._name_container, t.getName() );
setInnerHTML(root._name_container, t.getName());
// progressbar
TorrentRendererHelper.renderProgressbar( controller, t, root._progressbar );
TorrentRendererHelper.renderProgressbar(controller, t, root._progressbar);
// peer details
var has_error = t.getError() !== Torrent._ErrNone;
var e = root._peer_details_container;
$(e).toggleClass('error',has_error);
setInnerHTML( e, this.getPeerDetails( t ) );
setInnerHTML(e, this.getPeerDetails(t));
// progress details
e = root._progress_details_container;
setInnerHTML( e, this.getProgressDetails( controller, t ) );
setInnerHTML(e, this.getProgressDetails(controller, t));
// pause/resume button
var is_stopped = t.isStopped()
e = root._pause_resume_button_image
e.alt = is_stopped ? 'Resume' : 'Pause'
e.className = is_stopped ? 'torrent_resume' : 'torrent_pause'
var is_stopped = t.isStopped();
e = root._pause_resume_button_image;
e.alt = is_stopped ? 'Resume' : 'Pause';
e.className = is_stopped ? 'torrent_resume' : 'torrent_pause';
}
};
@ -243,20 +243,20 @@ function TorrentRendererCompact()
}
TorrentRendererCompact.prototype =
{
createRow: function( )
createRow: function()
{
var progressbar = TorrentRendererHelper.createProgressbar( 'compact' );
var progressbar = TorrentRendererHelper.createProgressbar('compact');
var details = document.createElement( 'div' );
var details = document.createElement('div');
details.className = 'torrent_peer_details compact';
var name = document.createElement( 'div' );
var name = document.createElement('div');
name.className = 'torrent_name compact';
var root = document.createElement( 'li' );
root.appendChild( progressbar.element );
root.appendChild( details );
root.appendChild( name );
var root = document.createElement('li');
root.appendChild(progressbar.element);
root.appendChild(details);
root.appendChild(name);
root.className = 'torrent compact';
root._progressbar = progressbar;
root._details_container = details;
@ -264,35 +264,35 @@ TorrentRendererCompact.prototype =
return root;
},
getPeerDetails: function( t )
getPeerDetails: function(t)
{
var c;
if(( c = t.getErrorMessage()))
if ((c = t.getErrorMessage()))
return c;
if( t.isDownloading( ) )
if (t.isDownloading())
return [ TorrentRendererHelper.formatDL(t),
TorrentRendererHelper.formatUL(t) ].join(' ');
if( t.isSeeding( ) )
if (t.isSeeding())
return TorrentRendererHelper.formatUL(t);
return t.getStateString( );
return t.getStateString();
},
render: function( controller, t, root )
render: function(controller, t, root)
{
// name
var is_stopped = t.isStopped()
var is_stopped = t.isStopped();
var e = root._name_container;
$(e).toggleClass( 'paused', is_stopped );
setInnerHTML( e, t.getName() );
$(e).toggleClass('paused', is_stopped);
setInnerHTML(e, t.getName());
// peer details
var has_error = t.getError() !== Torrent._ErrNone;
e = root._details_container;
$(e).toggleClass('error', has_error );
setInnerHTML( e, this.getPeerDetails( t ) );
$(e).toggleClass('error', has_error);
setInnerHTML(e, this.getPeerDetails(t));
// progressbar
TorrentRendererHelper.renderProgressbar( controller, t, root._progressbar );
TorrentRendererHelper.renderProgressbar(controller, t, root._progressbar);
}
};
@ -301,54 +301,48 @@ TorrentRendererCompact.prototype =
*****
****/
function TorrentRow( view )
function TorrentRow(view, controller, torrent, selected)
{
this.initialize( view );
this.initialize(view, controller, torrent, selected);
}
TorrentRow.prototype =
{
initialize: function( view ) {
initialize: function(view, controller, torrent, selected) {
this._view = view;
this._element = view.createRow( );
this._element = view.createRow();
this.setTorrent(controller, torrent);
if (selected)
this.setSelected(selected);
this.render(controller);
},
getElement: function( ) {
getElement: function() {
return this._element;
},
render: function( controller ) {
var tor = this.getTorrent( );
if( tor !== null )
this._view.render( controller, tor, this.getElement( ) );
render: function(controller) {
var tor = this.getTorrent();
if (tor)
this._view.render(controller, tor, this.getElement());
},
isSelected: function( ) {
return this.getElement().className.indexOf('selected') != -1;
isSelected: function() {
return this.getElement().className.indexOf('selected') !== -1;
},
setSelected: function( flag ) {
$(this.getElement()).toggleClass( 'selected', flag );
setSelected: function(flag) {
$(this.getElement()).toggleClass('selected', flag);
},
getToggleRunningButton: function( ) {
getToggleRunningButton: function() {
return this.getElement()._toggle_running_button;
},
setVisible: function( visible ) {
this.getElement().style.display = visible ? 'block' : 'none';
if( !visible )
this.setSelected( false );
},
isVisible: function( visible ) {
return this.getElement().style.display === 'block';
},
setTorrent: function( controller, t ) {
if( this._torrent !== t ) {
var row = this
setTorrent: function(controller, t) {
if (this._torrent !== t) {
var row = this;
var key = 'dataChanged.torrentRowListener';
if(this._torrent)
if (this._torrent)
$(this._torrent).unbind(key);
if((this._torrent = t))
$(this._torrent).bind(key,function(){row.render(controller)})
if ((this._torrent = t))
$(this._torrent).bind(key,function(){row.render(controller);});
}
},
getTorrent: function() {
@ -357,8 +351,8 @@ TorrentRow.prototype =
isEven: function() {
return this.getElement().className.indexOf('even') != -1;
},
setEven: function( even ) {
if( this.isEven() != even )
setEven: function(even) {
if (this.isEven() != even)
$(this.getElement()).toggleClass('even', even);
}
};

View File

@ -7,9 +7,9 @@
*/
function Torrent(controller, data)
function Torrent(data)
{
this.initialize(controller, data)
this.initialize(data);
}
/***
@ -19,41 +19,41 @@ function Torrent(controller, data)
***/
// Torrent.fields.status
Torrent._StatusStopped = 0
Torrent._StatusCheckWait = 1
Torrent._StatusCheck = 2
Torrent._StatusDownloadWait = 3
Torrent._StatusDownload = 4
Torrent._StatusSeedWait = 5
Torrent._StatusSeed = 6
Torrent._StatusStopped = 0;
Torrent._StatusCheckWait = 1;
Torrent._StatusCheck = 2;
Torrent._StatusDownloadWait = 3;
Torrent._StatusDownload = 4;
Torrent._StatusSeedWait = 5;
Torrent._StatusSeed = 6;
// Torrent.fields.seedRatioMode
Torrent._RatioUseGlobal = 0
Torrent._RatioUseLocal = 1
Torrent._RatioUnlimited = 2
Torrent._RatioUseGlobal = 0;
Torrent._RatioUseLocal = 1;
Torrent._RatioUnlimited = 2;
// Torrent.fields.error
Torrent._ErrNone = 0
Torrent._ErrTrackerWarning = 1
Torrent._ErrTrackerError = 2
Torrent._ErrLocalError = 3
Torrent._ErrNone = 0;
Torrent._ErrTrackerWarning = 1;
Torrent._ErrTrackerError = 2;
Torrent._ErrLocalError = 3;
// TrackerStats' announceState
Torrent._TrackerInactive = 0
Torrent._TrackerWaiting = 1
Torrent._TrackerQueued = 2
Torrent._TrackerActive = 3
Torrent._TrackerInactive = 0;
Torrent._TrackerWaiting = 1;
Torrent._TrackerQueued = 2;
Torrent._TrackerActive = 3;
// fields whose values never change and are always known
Torrent._StaticFields = [
'hashString', 'id' ]
'hashString', 'id' ];
// fields whose values never change and are known upon constructon OR
// when a magnet torrent finishes downloading its metadata
Torrent._MetaDataFields = [
'addedDate', 'comment', 'creator', 'dateCreated',
'isPrivate', 'name', 'totalSize', 'pieceCount', 'pieceSize' ]
'isPrivate', 'name', 'totalSize', 'pieceCount', 'pieceSize' ];
// torrent fields whose values change all the time
Torrent._DynamicFields = [
@ -63,7 +63,7 @@ Torrent._DynamicFields = [
'peersGettingFromUs', 'peersSendingToUs', 'queuePosition',
'rateDownload', 'rateUpload', 'recheckProgress', 'seedRatioLimit',
'seedRatioMode', 'sizeWhenDone', 'status', 'trackerStats',
'uploadedEver', 'uploadRatio', 'webseedsSendingToUs' ]
'uploadedEver', 'uploadRatio', 'webseedsSendingToUs' ];
/***
****
@ -73,99 +73,133 @@ Torrent._DynamicFields = [
Torrent.prototype =
{
initialize: function(controller, data)
initialize: function(data)
{
this.fields = {}
this._files = []
this.fields = {};
this._files = [];
// these fields are set in the ctor and never change
for(var i=0, key; key=Torrent._StaticFields[i]; ++i)
if(key in data)
this.fields[key] = data[key]
for (var i=0, key; key=Torrent._StaticFields[i]; ++i) {
if (key in data) {
this.fields[key] = data[key];
}
}
this.initMetaData(data)
this._trackerStats = this.buildTrackerStats(data.trackerStats)
this.refresh(data)
this.initMetaData(data);
this._trackerStats = this.buildTrackerStats(data.trackerStats);
this.refresh(data);
},
buildTrackerStats: function(trackerStats) {
result = []
for(var i=0, tracker; tracker=trackerStats[i]; ++i) {
tier = result[tracker.tier] || []
tier.push(tracker)
result[tracker.tier] = tier
var announce = [];
var result = [];
for (var i=0, tracker; tracker=trackerStats[i]; ++i) {
var tier = result[tracker.tier] || [];
tier.push(tracker);
result[tracker.tier] = tier;
announce.push(tracker.announce);
}
return result
this.fields.collatedTrackers = announce.join('\t');
return result;
},
initMetaData: function(data) {
var f = this.fields
var f = this.fields;
var changed = false;
// populate the metadata fields
for(var i=0, key; key=Torrent._MetaDataFields[i]; ++i) {
if(key in data) {
f[key] = data[key]
if(key === 'name')
f.collatedName = data.name.toLowerCase()
for (var i=0, key; key=Torrent._MetaDataFields[i]; ++i) {
if (key in data) {
if (f[key] !== data[key]) {
f[key] = data[key];
if (key === 'name')
f.collatedName = data.name.toLowerCase();
changed = true;
}
}
}
// populate the files array
if(data.files) {
for(var i=0, row; row=data.files[i]; ++i) {
if (data.files) {
for (var i=0, row; row=data.files[i]; ++i) {
this._files[i] = {
'index': i,
'torrent': this,
'length': row.length,
'name': row.name
}
};
}
}
return changed;
},
refreshMetaData: function(data)
{
this.initMetaData(data)
this.fireDataChanged()
var changed = this.initMetaData(data);
if (changed)
this.fireDataChanged();
return changed;
},
refresh: function(data)
{
// FIXME: unnecessary coupling... this should be handled by transmission.js
if(this.needsMetaData() && (data.metadataPercentComplete >= 1))
transmission.refreshMetaData([ this.getId() ])
var changed = false;
var f = this.fields
// FIXME: unnecessary coupling... this should be handled by transmission.js
if (this.needsMetaData() && (data.metadataPercentComplete >= 1))
changed |= transmission.refreshMetaData([ this.getId() ]);
var f = this.fields;
// refresh the dynamic fields
for(var i=0, key; key=Torrent._DynamicFields[i]; ++i)
if(key in data)
f[key] = data[key]
for (var i=0, key; key=Torrent._DynamicFields[i]; ++i) {
if (key in data) {
if (f[key] !== data[key]) {
f[key] = data[key];
changed = true;
}
}
}
this._trackerStats = this.buildTrackerStats(data.trackerStats)
this._trackerStats = this.buildTrackerStats(data.trackerStats);
if (data.fileStats)
this.refreshFiles(data)
changed |= this.refreshFiles(data);
this.fireDataChanged()
if (changed)
this.fireDataChanged();
},
refreshFiles: function(data) {
for(var i=0; i<data.fileStats.length; ++i) {
var src = data.fileStats[i]
var tgt = this._files[i]
if(!tgt)
tgt = this._files[i] = { }
tgt.wanted = src.wanted
tgt.priority = src.priority
tgt.bytesCompleted = src.bytesCompleted
var changed = false;
for (var i=0; i<data.fileStats.length; ++i) {
var src = data.fileStats[i];
var tgt = this._files[i];
if (!tgt) {
changed = true;
tgt = this._files[i] = { };
}
if (tgt.wanted !== src.wanted) {
tgt.wanted = src.wanted;
changed = true;
}
if (tgt.priority !== src.priority) {
tgt.priority = src.priority;
changed = true;
}
if (tgt.bytesCompleted !== src.bytesCompleted) {
tgt.bytesCompleted = src.bytesCompleted;
changed = true;
}
}
return changed;
},
fireDataChanged: function()
{
$(this).trigger('dataChanged',[])
$(this).trigger('dataChanged');
},
/****
@ -173,93 +207,94 @@ Torrent.prototype =
****/
// simple accessors
getCollatedName: function() { return this.fields.collatedName },
getComment: function() { return this.fields.comment },
getCreator: function() { return this.fields.creator },
getDateAdded: function() { return this.fields.addedDate },
getDateCreated: function() { return this.fields.dateCreated },
getDesiredAvailable: function() { return this.fields.desiredAvailable },
getDownloadDir: function() { return this.fields.downloadDir },
getDownloadSpeed: function() { return this.fields.rateDownload },
getDownloadedEver: function() { return this.fields.downloadedEver },
getError: function() { return this.fields.error },
getErrorString: function() { return this.fields.errorString },
getETA: function() { return this.fields.eta },
getHashString: function() { return this.fields.hashString },
getHaveValid: function() { return this.fields.haveValid },
getHave: function() { return this.getHaveValid() + this.fields.haveUnchecked },
getId: function() { return this.fields.id },
getLeftUntilDone: function() { return this.fields.leftUntilDone },
getMetadataPercentComplete: function() { return this.fields.metadataPercentComplete },
getName: function() { return this.fields.name },
getPeers: function() { return this.fields.peers },
getPeersConnected: function() { return this.fields.peersConnected },
getPeersGettingFromUs: function() { return this.fields.peersGettingFromUs },
getPeersSendingToUs: function() { return this.fields.peersSendingToUs },
getPieceCount: function() { return this.fields.pieceCount },
getPieceCount: function() { return this.fields.pieceCount },
getPieceSize: function() { return this.fields.pieceSize },
getPrivateFlag: function() { return this.fields.isPrivate },
getQueuePosition: function() { return this.fields.queuePosition },
getRecheckProgress: function() { return this.fields.recheckProgress },
getSeedRatioLimit: function() { return this.fields.seedRatioLimit },
getSeedRatioMode: function() { return this.fields.seedRatioMode },
getSizeWhenDone: function() { return this.fields.sizeWhenDone },
getStatus: function() { return this.fields.status },
getTotalSize: function() { return this.fields.totalSize },
getUploadSpeed: function() { return this.fields.rateUpload },
getUploadRatio: function() { return this.fields.uploadRatio },
getUploadedEver: function() { return this.fields.uploadedEver },
getWebseedsSendingToUs: function() { return this.fields.webseedsSendingToUs },
isFinished: function() { return this.fields.isFinished },
getCollatedName: function() { return this.fields.collatedName; },
getCollatedTrackers: function() { return this.fields.collatedTrackers; },
getComment: function() { return this.fields.comment; },
getCreator: function() { return this.fields.creator; },
getDateAdded: function() { return this.fields.addedDate; },
getDateCreated: function() { return this.fields.dateCreated; },
getDesiredAvailable: function() { return this.fields.desiredAvailable; },
getDownloadDir: function() { return this.fields.downloadDir; },
getDownloadSpeed: function() { return this.fields.rateDownload; },
getDownloadedEver: function() { return this.fields.downloadedEver; },
getError: function() { return this.fields.error; },
getErrorString: function() { return this.fields.errorString; },
getETA: function() { return this.fields.eta; },
getHashString: function() { return this.fields.hashString; },
getHaveValid: function() { return this.fields.haveValid; },
getHave: function() { return this.getHaveValid() + this.fields.haveUnchecked; },
getId: function() { return this.fields.id; },
getLeftUntilDone: function() { return this.fields.leftUntilDone; },
getMetadataPercentComplete: function() { return this.fields.metadataPercentComplete; },
getName: function() { return this.fields.name; },
getPeers: function() { return this.fields.peers; },
getPeersConnected: function() { return this.fields.peersConnected; },
getPeersGettingFromUs: function() { return this.fields.peersGettingFromUs; },
getPeersSendingToUs: function() { return this.fields.peersSendingToUs; },
getPieceCount: function() { return this.fields.pieceCount; },
getPieceCount: function() { return this.fields.pieceCount; },
getPieceSize: function() { return this.fields.pieceSize; },
getPrivateFlag: function() { return this.fields.isPrivate; },
getQueuePosition: function() { return this.fields.queuePosition; },
getRecheckProgress: function() { return this.fields.recheckProgress; },
getSeedRatioLimit: function() { return this.fields.seedRatioLimit; },
getSeedRatioMode: function() { return this.fields.seedRatioMode; },
getSizeWhenDone: function() { return this.fields.sizeWhenDone; },
getStatus: function() { return this.fields.status; },
getTotalSize: function() { return this.fields.totalSize; },
getUploadSpeed: function() { return this.fields.rateUpload; },
getUploadRatio: function() { return this.fields.uploadRatio; },
getUploadedEver: function() { return this.fields.uploadedEver; },
getWebseedsSendingToUs: function() { return this.fields.webseedsSendingToUs; },
isFinished: function() { return this.fields.isFinished; },
// derived accessors
isSeeding: function() { return this.getStatus() === Torrent._StatusSeed },
isStopped: function() { return this.getStatus() === Torrent._StatusStopped },
isChecking: function() { return this.getStatus() === Torrent._StatusCheck },
isDownloading: function() { return this.getStatus() === Torrent._StatusDownload },
isDone: function() { return this.getLeftUntilDone() < 1 },
needsMetaData: function(){ return this.getMetadataPercentComplete() < 1 },
getActivity: function() { return this.getDownloadSpeed() + this.getUploadSpeed() },
getPercentDoneStr: function() { return Transmission.fmt.percentString(100*this.getPercentDone()) },
isSeeding: function() { return this.getStatus() === Torrent._StatusSeed; },
isStopped: function() { return this.getStatus() === Torrent._StatusStopped; },
isChecking: function() { return this.getStatus() === Torrent._StatusCheck; },
isDownloading: function() { return this.getStatus() === Torrent._StatusDownload; },
isDone: function() { return this.getLeftUntilDone() < 1; },
needsMetaData: function(){ return this.getMetadataPercentComplete() < 1; },
getActivity: function() { return this.getDownloadSpeed() + this.getUploadSpeed(); },
getPercentDoneStr: function() { return Transmission.fmt.percentString(100*this.getPercentDone()); },
getPercentDone: function() {
var finalSize = this.getSizeWhenDone()
if(!finalSize) return 1.0
var left = this.getLeftUntilDone()
if(!left) return 1.0
return (finalSize - left) / finalSize
var finalSize = this.getSizeWhenDone();
if (!finalSize) return 1.0;
var left = this.getLeftUntilDone();
if (!left) return 1.0;
return (finalSize - left) / finalSize;
},
getStateString: function() {
switch(this.getStatus()) {
case Torrent._StatusStopped: return this.isFinished() ? 'Seeding complete' : 'Paused'
case Torrent._StatusCheckWait: return 'Queued for verification'
case Torrent._StatusCheck: return 'Verifying local data'
case Torrent._StatusDownloadWait: return 'Queued for download'
case Torrent._StatusDownload: return 'Downloading'
case Torrent._StatusSeedWait: return 'Queued for seeding'
case Torrent._StatusSeed: return 'Seeding'
default: return 'error'
case Torrent._StatusStopped: return this.isFinished() ? 'Seeding complete' : 'Paused';
case Torrent._StatusCheckWait: return 'Queued for verification';
case Torrent._StatusCheck: return 'Verifying local data';
case Torrent._StatusDownloadWait: return 'Queued for download';
case Torrent._StatusDownload: return 'Downloading';
case Torrent._StatusSeedWait: return 'Queued for seeding';
case Torrent._StatusSeed: return 'Seeding';
default: return 'error';
}
},
trackerStats: function() { return this._trackerStats },
trackerStats: function() { return this._trackerStats; },
seedRatioLimit: function(controller){
switch(this.getSeedRatioMode()) {
case Torrent._RatioUseGlobal: return controller.seedRatioLimit()
case Torrent._RatioUseLocal: return this.getSeedRatioLimit()
default: return -1
case Torrent._RatioUseGlobal: return controller.seedRatioLimit();
case Torrent._RatioUseLocal: return this.getSeedRatioLimit();
default: return -1;
}
},
getErrorMessage: function() {
var str = this.getErrorString()
var str = this.getErrorString();
switch(this.getError()) {
case Torrent._ErrTrackerWarning:
return 'Tracker returned a warning: ' + str
return 'Tracker returned a warning: ' + str;
case Torrent._ErrTrackerError:
return 'Tracker returned an error: ' + str
return 'Tracker returned an error: ' + str;
case Torrent._ErrLocalError:
return 'Error: ' + str
return 'Error: ' + str;
default:
return null
return null;
}
},
@ -267,50 +302,53 @@ Torrent.prototype =
*****
****/
testState: function(state)
{
var s = this.getStatus();
switch(state)
{
case Prefs._FilterActive:
return this.getPeersGettingFromUs() > 0
|| this.getPeersSendingToUs() > 0
|| this.getWebseedsSendingToUs() > 0
|| this.isChecking();
case Prefs._FilterSeeding:
return (s === Torrent._StatusSeed)
|| (s === Torrent._StatusSeedWait);
case Prefs._FilterDownloading:
return (s === Torrent._StatusDownload)
|| (s === Torrent._StatusDownloadWait);
case Prefs._FilterPaused:
return this.isStopped();
case Prefs._FilterFinished:
return this.isFinished();
default:
return true;
}
},
/**
* @param filter one of Prefs._Filter*
* @param search substring to look for, or null
* @return true if it passes the test, false if it fails
*/
test: function(filter, search)
test: function(state, search, tracker)
{
var pass = false
var s = this.getStatus()
// flter by state...
var pass = this.testState(state);
switch(filter)
{
case Prefs._FilterActive:
pass = this.getPeersGettingFromUs() > 0
|| this.getPeersSendingToUs() > 0
|| this.getWebseedsSendingToUs() > 0
|| this.isChecking()
break
case Prefs._FilterSeeding:
pass = (s === Torrent._StatusSeed) || (s === Torrent._StatusSeedWait)
break
case Prefs._FilterDownloading:
pass = (s === Torrent._StatusDownload) || (s === Torrent._StatusDownloadWait)
break
case Prefs._FilterPaused:
pass = this.isStopped()
break
case Prefs._FilterFinished:
pass = this.isFinished()
break
default:
pass = true
break
}
// maybe filter by text...
if (pass && search && search.length)
pass = this.getCollatedName().indexOf(search.toLowerCase()) !== -1;
if(!pass)
return false
// maybe filter by tracker...
if (pass && tracker && tracker.length)
pass = this.getCollatedTrackers().indexOf(tracker) !== -1;
if(!search || !search.length)
return pass
return this.getCollatedName().indexOf(search.toLowerCase()) !== -1
return pass;
}
}
};
/***
@ -321,47 +359,47 @@ Torrent.prototype =
Torrent.compareById = function(ta, tb)
{
return ta.getId() - tb.getId()
}
return ta.getId() - tb.getId();
};
Torrent.compareByName = function(ta, tb)
{
return ta.getCollatedName().compareTo(tb.getCollatedName())
|| Torrent.compareById(ta, tb)
}
|| Torrent.compareById(ta, tb);
};
Torrent.compareByQueue = function(ta, tb)
{
return ta.getQueuePosition() - tb.getQueuePosition()
}
return ta.getQueuePosition() - tb.getQueuePosition();
};
Torrent.compareByAge = function(ta, tb)
{
var a = ta.getDateAdded()
var b = tb.getDateAdded()
return (b - a) || Torrent.compareByQueue(ta, tb)
}
var a = ta.getDateAdded();
var b = tb.getDateAdded();
return (b - a) || Torrent.compareByQueue(ta, tb);
};
Torrent.compareByState = function(ta, tb)
{
var a = ta.getStatus()
var b = tb.getStatus()
return (b - a) || Torrent.compareByQueue(ta, tb)
}
var a = ta.getStatus();
var b = tb.getStatus();
return (b - a) || Torrent.compareByQueue(ta, tb);
};
Torrent.compareByActivity = function(ta, tb)
{
var a = ta.getActivity()
var b = tb.getActivity()
return (a - b) || Torrent.compareByState(ta, tb)
}
Torrent.compareByRatio = function(a, b)
var a = ta.getActivity();
var b = tb.getActivity();
return (b - a) || Torrent.compareByState(ta, tb);
};
Torrent.compareByRatio = function(ta, tb)
{
var a = Math.ratio(ta.getUploadedEver(), ta.getDownloadedEver())
var b = Math.ratio(tb.getUploadedEver(), tb.getDownloadedEver())
return (a - b) || Torrent.compareByState(ta, tb)
}
var a = Math.ratio(ta.getUploadedEver(), ta.getDownloadedEver());
var b = Math.ratio(tb.getUploadedEver(), tb.getDownloadedEver());
return (a - b) || Torrent.compareByState(ta, tb);
};
Torrent.compareByProgress = function(ta, tb)
{
var a = ta.getPercentDone()
var b = tb.getPercentDone()
return (a - b) || Torrent.compareByRatio(ta, tb)
}
var a = ta.getPercentDone();
var b = tb.getPercentDone();
return (a - b) || Torrent.compareByRatio(ta, tb);
};
/**
* @param torrents an array of Torrent objects
@ -373,33 +411,30 @@ Torrent.sortTorrents = function(torrents, sortMethod, sortDirection)
switch(sortMethod)
{
case Prefs._SortByActivity:
torrents.sort(this.compareByActivity)
break
torrents.sort(this.compareByActivity);
break;
case Prefs._SortByAge:
torrents.sort(this.compareByAge)
break
torrents.sort(this.compareByAge);
break;
case Prefs._SortByQueue:
torrents.sort(this.compareByQueue)
break
torrents.sort(this.compareByQueue);
break;
case Prefs._SortByProgress:
torrents.sort(this.compareByProgress)
break
torrents.sort(this.compareByProgress);
break;
case Prefs._SortByState:
torrents.sort(this.compareByState)
break
case Prefs._SortByName:
torrents.sort(this.compareByName)
break
torrents.sort(this.compareByState);
break;
case Prefs._SortByRatio:
torrents.sort(this.compareByRatio)
break
torrents.sort(this.compareByRatio);
break;
default:
console.warn("unknown sort method: " + sortMethod)
break
torrents.sort(this.compareByName);
break;
}
if(sortDirection === Prefs._SortDescending)
torrents.reverse()
if (sortDirection === Prefs._SortDescending)
torrents.reverse();
return torrents
}
return torrents;
};

File diff suppressed because it is too large Load Diff

View File

@ -45,9 +45,9 @@ RPC._QueueMoveBottom = 'queue-move-bottom';
RPC._QueueMoveUp = 'queue-move-up';
RPC._QueueMoveDown = 'queue-move-down';
function TransmissionRemote( controller )
function TransmissionRemote(controller)
{
this.initialize( controller );
this.initialize(controller);
return this;
}
@ -71,7 +71,7 @@ TransmissionRemote.prototype =
remote = this;
// set the Transmission-Session-Id on a 409
if(request.status == 409 && (token = request.getResponseHeader('X-Transmission-Session-Id'))){
if (request.status == 409 && (token = request.getResponseHeader('X-Transmission-Session-Id'))){
remote._token = token;
$.ajax(ajaxObject);
return;
@ -80,7 +80,7 @@ TransmissionRemote.prototype =
remote._error = request.responseText
? request.responseText.trim().replace(/(<([^>]+)>)/ig,"")
: "";
if( !remote._error.length )
if (!remote._error.length)
remote._error = 'Server not responding';
dialog.confirm('Connection Failed',
@ -97,9 +97,9 @@ TransmissionRemote.prototype =
XHR.setRequestHeader('X-Transmission-Session-Id', this._token);
},
sendRequest: function( data, success, async ) {
sendRequest: function(data, success, async) {
remote = this;
if( typeof async != 'boolean' )
if (typeof async != 'boolean')
async = true;
var ajaxSettings = {
@ -109,62 +109,59 @@ TransmissionRemote.prototype =
dataType: 'json',
cache: false,
data: $.toJSON(data),
beforeSend: function(XHR){ remote.appendSessionId(XHR) },
error: function(request, error_string, exception){ remote.ajaxError(request, error_string, exception, ajaxSettings) },
beforeSend: function(XHR){ remote.appendSessionId(XHR); },
error: function(request, error_string, exception){ remote.ajaxError(request, error_string, exception, ajaxSettings); },
success: success,
async: async
};
$.ajax( ajaxSettings );
$.ajax(ajaxSettings);
},
loadDaemonPrefs: function( callback, async ) {
var tr = this._controller;
loadDaemonPrefs: function(callback, async) {
var o = { method: 'session-get' };
this.sendRequest( o, callback, async );
this.sendRequest(o, callback, async);
},
checkPort: function( callback, async ) {
var tr = this._controller;
checkPort: function(callback, async) {
var o = { method: 'port-test' };
this.sendRequest( o, callback, async );
this.sendRequest(o, callback, async);
},
loadDaemonStats: function( callback, async ) {
var tr = this._controller;
loadDaemonStats: function(callback, async) {
var o = { method: 'session-stats' };
this.sendRequest( o, callback, async );
this.sendRequest(o, callback, async);
},
getInitialDataFor: function(torrent_ids, callback) {
var o = {
method: 'torrent-get',
arguments: {
fields: Torrent._StaticFields.concat( Torrent._MetaDataFields,
Torrent._DynamicFields,
[ 'files', 'fileStats' ] )
fields: Torrent._StaticFields.concat(Torrent._MetaDataFields,
Torrent._DynamicFields,
[ 'files', 'fileStats' ])
}
};
if(torrent_ids)
if (torrent_ids)
o.arguments.ids = torrent_ids;
this.sendRequest( o, function(data){ callback(data.arguments.torrents)} );
this.sendRequest(o, function(data){ callback(data.arguments.torrents);});
},
getMetaDataFor: function(torrent_ids, callback) {
var o = {
method: 'torrent-get',
arguments: {
fields: Torrent._StaticFields.concat( Torrent._MetaDataFields,
[ 'files', 'fileStats' ] )
fields: Torrent._StaticFields.concat(Torrent._MetaDataFields,
['files', 'fileStats'])
}
};
if(torrent_ids)
if (torrent_ids)
o.arguments.ids = torrent_ids;
this.sendRequest( o, function(data){ callback(data.arguments.torrents)} );
this.sendRequest(o, function(data) {callback(data.arguments.torrents)});
},
getUpdatedDataFor: function(torrent_ids, callback) {
@ -176,36 +173,36 @@ TransmissionRemote.prototype =
}
};
this.sendRequest( o, function(data){ callback(data.arguments.torrents, data.arguments.removed)} );
this.sendRequest(o, function(data) {callback(data.arguments.torrents, data.arguments.removed);});
},
loadTorrentFiles: function( torrent_ids ) {
loadTorrentFiles: function(torrent_ids) {
var tr = this._controller;
this.sendRequest( {
this.sendRequest({
method: 'torrent-get',
arguments: { fields: [ 'id', 'fileStats'], ids: torrent_ids }
}, function(data) {
tr.updateTorrentsFileData( data.arguments.torrents );
} );
tr.updateTorrentsFileData(data.arguments.torrents);
});
},
changeFileCommand: function( command, rows ) {
changeFileCommand: function(command, rows) {
var remote = this;
var torrent_ids = [ rows[0].getTorrent().getId() ];
var files = [ ];
for( var i=0, row; row=rows[i]; ++i )
files.push( row.getIndex( ) );
var files = [];
for (var i=0, row; row=rows[i]; ++i)
files.push(row.getIndex());
var o = {
method: 'torrent-set',
arguments: { ids: torrent_ids }
};
o.arguments[command] = files;
this.sendRequest( o, function( ) {
remote._controller.refreshTorrents( torrent_ids );
this.sendRequest(o, function() {
remote._controller.refreshTorrents(torrent_ids);
});
},
sendTorrentSetRequests: function( method, torrent_ids, args, callback ) {
sendTorrentSetRequests: function(method, torrent_ids, args, callback) {
if (!args) args = { };
args['ids'] = torrent_ids;
var o = {
@ -213,26 +210,26 @@ TransmissionRemote.prototype =
arguments: args
};
this.sendRequest( o, function( data ) {
this.sendRequest(o, function(data) {
callback();
});
},
sendTorrentActionRequests: function( method, torrent_ids, callback ) {
this.sendTorrentSetRequests( method, torrent_ids, null, callback );
sendTorrentActionRequests: function(method, torrent_ids, callback) {
this.sendTorrentSetRequests(method, torrent_ids, null, callback);
},
startTorrents: function( torrent_ids, noqueue, callback ) {
startTorrents: function(torrent_ids, noqueue, callback) {
var name = noqueue ? 'torrent-start-now' : 'torrent-start';
this.sendTorrentActionRequests( name, torrent_ids, callback );
this.sendTorrentActionRequests(name, torrent_ids, callback);
},
stopTorrents: function( torrent_ids, callback ) {
this.sendTorrentActionRequests( 'torrent-stop', torrent_ids, callback );
stopTorrents: function(torrent_ids, callback) {
this.sendTorrentActionRequests('torrent-stop', torrent_ids, callback);
},
removeTorrents: function( torrent_ids, callback ) {
this.sendTorrentActionRequests( 'torrent-remove', torrent_ids, callback );
removeTorrents: function(torrent_ids, callback) {
this.sendTorrentActionRequests('torrent-remove', torrent_ids, callback);
},
removeTorrentsAndData: function( torrents ) {
removeTorrentsAndData: function(torrents) {
var remote = this;
var o = {
method: 'torrent-remove',
@ -242,22 +239,24 @@ TransmissionRemote.prototype =
}
};
if( torrents != null )
for( var i=0, len=torrents.length; i<len; ++i )
o.arguments.ids.push( torrents[i].getId() );
this.sendRequest( o, function( ) {
if (torrents) {
for (var i=0, len=torrents.length; i<len; ++i) {
o.arguments.ids.push(torrents[i].getId());
}
}
this.sendRequest(o, function() {
remote._controller.refreshTorrents();
} );
});
},
verifyTorrents: function( torrent_ids, callback ) {
this.sendTorrentActionRequests( 'torrent-verify', torrent_ids, callback );
verifyTorrents: function(torrent_ids, callback) {
this.sendTorrentActionRequests('torrent-verify', torrent_ids, callback);
},
reannounceTorrents: function( torrent_ids, callback ) {
this.sendTorrentActionRequests( 'torrent-reannounce', torrent_ids, callback );
reannounceTorrents: function(torrent_ids, callback) {
this.sendTorrentActionRequests('torrent-reannounce', torrent_ids, callback);
},
addTorrentByUrl: function( url, options ) {
addTorrentByUrl: function(url, options) {
var remote = this;
if(url.match(/^[0-9a-f]{40}$/i)) {
if (url.match(/^[0-9a-f]{40}$/i)) {
url = 'magnet:?xt=urn:btih:'+url;
}
var o = {
@ -269,47 +268,39 @@ TransmissionRemote.prototype =
};
this.sendRequest(o, function() {
remote._controller.refreshTorrents();
} );
});
},
savePrefs: function( args ) {
savePrefs: function(args) {
var remote = this;
var o = {
method: 'session-set',
arguments: args
};
this.sendRequest( o, function() {
this.sendRequest(o, function() {
remote._controller.loadDaemonPrefs();
} );
});
},
updateBlocklist: function() {
var remote = this;
var o = {
method: 'blocklist-update',
method: 'blocklist-update'
};
this.sendRequest( o, function() {
this.sendRequest(o, function() {
remote._controller.loadDaemonPrefs();
} );
});
},
/*
filesSelectAll: function( torrent_ids, files, callback ) {
this.sendTorrentSetRequests( 'torrent-set', torrent_ids, { 'files-wanted': files }, callback );
},
filesDeselectAll: function( torrent_ids, files, callback ) {
this.sendTorrentSetRequests( 'torrent-set', torrent_ids, { 'files-unwanted': files }, callback );
},
*/
// Added queue calls
moveTorrentsToTop: function( torrent_ids, callback ) {
this.sendTorrentActionRequests( RPC._QueueMoveTop, torrent_ids, callback );
moveTorrentsToTop: function(torrent_ids, callback) {
this.sendTorrentActionRequests(RPC._QueueMoveTop, torrent_ids, callback);
},
moveTorrentsToBottom: function( torrent_ids, callback ) {
this.sendTorrentActionRequests( RPC._QueueMoveBottom, torrent_ids, callback );
moveTorrentsToBottom: function(torrent_ids, callback) {
this.sendTorrentActionRequests(RPC._QueueMoveBottom, torrent_ids, callback);
},
moveTorrentsUp: function( torrent_ids, callback ) {
this.sendTorrentActionRequests( RPC._QueueMoveUp, torrent_ids, callback );
moveTorrentsUp: function(torrent_ids, callback) {
this.sendTorrentActionRequests(RPC._QueueMoveUp, torrent_ids, callback);
},
moveTorrentsDown: function( torrent_ids, callback ) {
this.sendTorrentActionRequests( RPC._QueueMoveDown, torrent_ids, callback );
moveTorrentsDown: function(torrent_ids, callback) {
this.sendTorrentActionRequests(RPC._QueueMoveDown, torrent_ids, callback);
}
};

View File

@ -2,6 +2,5 @@ datadir = ${datarootdir}/${PACKAGE_NAME}/${subdir}
dist_data_DATA = \
common.css \
ie6.css \
ie7.css \
iphone.css

View File

@ -18,7 +18,6 @@ body {
text-align: center;
margin: 0 0 30px;
overflow: hidden;
z-index: 1;
}
img {
@ -27,32 +26,27 @@ img {
a {
outline: 0;
-moz-outline: none;
}
/*--------------------------------------
*
* T O P M E N U
*
*--------------------------------------*/
div.torrent_global_menu {
/***
****
**** TOOLBAR
****
***/
#toolbar {
width: 100%;
height: 75px;
margin: 0;
background: transparent url('../images/graphics/chrome.png') left top repeat-x;
position: fixed;
left: 0;
right: 0;
top: 0;
border-bottom: 1px solid #888;
z-index: 3;
border: 1px outset #AEBBCB;
overflow: hidden;
-moz-user-select: none;
-webkit-user-select: none;
}
div.torrent_global_menu h1 {
#toolbar h1 {
height: inherit;
width: 205px;
text-indent: -9000px !important;
@ -60,14 +54,14 @@ div.torrent_global_menu h1 {
margin: 0 0 0 5px;
}
div.torrent_global_menu ul {
#toolbar ul {
height: 50px;
margin: 0;
padding: 0 7px;
text-align: center;
}
div.torrent_global_menu ul li {
#toolbar ul li {
list-style-type: none;
list-style-image: none;
float: left;
@ -77,12 +71,11 @@ div.torrent_global_menu ul li {
height: 50px;
}
div.torrent_global_menu ul li#filter,
div.torrent_global_menu ul li#inspector {
#toolbar #inspector {
float: right;
}
div.torrent_global_menu ul li > div {
#toolbar ul li > div {
color: #000;
font-size: 1.1em;
text-decoration: none;
@ -94,84 +87,38 @@ div.torrent_global_menu ul li > div {
cursor: pointer;
}
div.torrent_global_menu ul li div.toolbar_image {
#toolbar ul li div.toolbar_image {
width: 32px;
height: 32px;
margin: 0 auto 5px;
background-image: url('../images/buttons/toolbar_buttons.png');
}
li#open div div.toolbar_image, li#open.disabled div:active div.toolbar_image {
background-position: left 0;
}
/* toolbar images */
li#open div div.toolbar_image { background-position: left 0px; }
li#open div:active div.toolbar_image { background-position: right 0px; }
li#remove div div.toolbar_image { background-position: left -32px; }
li#remove div:active div.toolbar_image { background-position: right -32px; }
li#resume_selected div div.toolbar_image { background-position: left -96px; }
li#resume_selected div:active div.toolbar_image { background-position: right -96px; }
li#pause_selected div div.toolbar_image { background-position: left -64px; }
li#pause_selected div:active div.toolbar_image { background-position: right -64px; }
li#pause_all div div.toolbar_image { background-position: left -128px; }
li#pause_all div:active div.toolbar_image { background-position: right -128px; }
li#resume_all div div.toolbar_image { background-position: left -160px; }
li#resume_all div:active div.toolbar_image { background-position: right -160px; }
li#filter div div.toolbar_image { background-position: left -192px; }
li#filter div:active div.toolbar_image { background-position: right -192px; }
li#inspector div div.toolbar_image { background-position: left -224px; }
li#inspector div:active div.toolbar_image { background-position: right -224px; }
li#open div:active div.toolbar_image {
background-position: right 0;
}
li#remove div div.toolbar_image, li#remove.disabled div:active div.toolbar_image {
background-position: left -32px;
}
li#remove div:active div.toolbar_image {
background-position: right -32px;
}
li#resume_selected div div.toolbar_image, li#resume_selected.disabled div:active div.toolbar_image {
background-position: left -96px;
}
li#resume_selected div:active div.toolbar_image {
background-position: right -96px;
}
li#pause_selected div div.toolbar_image, li#pause_selected.disabled div:active div.toolbar_image {
background-position: left -64px;
}
li#pause_selected div:active div.toolbar_image {
background-position: right -64px;
}
li#pause_all div div.toolbar_image, li#pause_all.disabled div:active div.toolbar_image {
background-position: left -128px;
}
li#pause_all div:active div.toolbar_image {
background-position: right -128px;
}
li#resume_all div div.toolbar_image, li#resume_all.disabled div:active div.toolbar_image {
background-position: left -160px;
}
li#resume_all div:active div.toolbar_image {
background-position: right -160px;
}
li#filter div div.toolbar_image, li#filter.disabled div:active div.toolbar_image {
background-position: left -192px;
}
li#filter div:active div.toolbar_image {
background-position: right -192px;
}
li#inspector div div.toolbar_image, li#inspector.disabled div:active div.toolbar_image {
background-position: left -224px;
}
li#inspector div:active div.toolbar_image {
background-position: right -224px;
}
div.torrent_global_menu ul li.disabled > div {
#toolbar ul li.disabled > div {
text-shadow: 0 1px 0 #fff;
opacity: 0.25;
cursor: default;
}
div.torrent_global_menu ul li.divider {
#toolbar ul li.divider {
width: 0;
border-right: 1px dotted black;
opacity: 0.2;
@ -179,149 +126,58 @@ div.torrent_global_menu ul li.divider {
height: 49px;
}
/*--------------------------------------
*
* G L O B A L D E T A I L S
*
*--------------------------------------*/
/***
****
**** STATUSBAR
****
***/
div.torrent_global_details {
width: 100%;
height: 20px;
margin: 0;
background: #ddd url('../images/graphics/filter_bar.png') repeat-x left -51px;
font-size: 1.1em;
font-weight: normal;
border-bottom: 1px solid #888;
position: fixed;
left: 0;
right: 0;
top: 76px;
z-index: 2;
color: #000;
text-shadow: 0 1px 0 #f4f4f4;
}
div.torrent_global_details div {
padding: 0 10px 1px 10px;
margin: 3px 0 0 0;
}
div.torrent_global_details div#torrent_global_transfer {
clear: left;
float: left;
}
div.torrent_global_details div#torrent_global_upload,
div.torrent_global_details div#torrent_global_download {
float: right;
padding-left: 13px;
}
div.torrent_global_details div#torrent_global_upload {
background: url('../images/graphics/transfer_arrows.png') left -12px no-repeat;
}
div.torrent_global_details div#torrent_global_download {
background: url('../images/graphics/transfer_arrows.png') left 2px no-repeat;
}
/*--------------------------------------
*
* T O R R E N T F I L T E R B A R
*
*--------------------------------------*/
div#torrent_filter_bar {
margin: 0;
#statusbar {
background: #ACACAC;
border: 1px outset #AEBBCB;
height: 24px;
background: #ddd url('../images/graphics/filter_bar.png') repeat-x bottom left;
border-bottom: 1px solid #888;
position: fixed;
left: 0;
right: 0px;
top: 97px;
z-index: 2;
display: none;
width: 100%;
overflow: hidden;
position: relative;
}
div#torrent_filter_bar ul {
height: 17px;
margin: 0;
padding: 0;
#statusbar #speed-info {
margin-top: 5px;
margin-left: 45%;
text-align: left;
display: inline;
}
div#torrent_filter_bar ul li {
list-style-type: none;
list-style-image: none;
#statusbar #filter-button {
float: left;
padding: 0;
margin: 4px 0 0 5px;
vertical-align: middle;
height: 17px;
}
div#torrent_filter_bar ul li a {
border: none;
padding: 1px 5px;
text-shadow: 0 1px 0 #ccc;
border-radius: 2px;*/
font-size: 1.2em;
color: #222;
text-shadow: 0 1px 0 #fff;
text-decoration: none;
font-weight: bold;
padding: 0 7px 0 0;
margin: 0 0 0 7px;
height: 17px;
display: block;
cursor: default;
margin: 5px 4px 0px 4px;
-moz-user-select: none;
-webkit-user-select: none;
}
#statusbar #filter-button:hover {
cursor: pointer;
}
#statusbar #filter-button .filter-selection {
text-decoration: underline;
}
div#torrent_filter_bar ul li.selected, div#torrent_filter_bar ul li.selected a, div#torrent_filter_bar ul li:hover, div#torrent_filter_bar ul li:hover a, div#torrent_filter_bar ul li:active, div#torrent_filter_bar ul li:active a {
background-image: url('../images/graphics/filter_bar.png');
background-repeat: no-repeat;
text-shadow: 0 1px 0 #444;
color: #fff !important;
}
div#torrent_filter_bar ul li:hover {
background-position: left -17px;
}
div#torrent_filter_bar ul li:hover a {
background-position: right -17px;
}
div#torrent_filter_bar ul li:active {
background-position: left -34px;
}
div#torrent_filter_bar ul li:active a {
background-position: right -34px;
}
div#torrent_filter_bar ul li.selected {
background-position: left top;
}
div#torrent_filter_bar ul li.selected a {
background-position: right top;
}
div#torrent_filter_bar input#torrent_search {
#statusbar input#torrent_search {
float: right;
height: 15px;
width: 100px;
border: solid 0 #fff;
padding: 0 2px;
padding: 2px;
margin: 4px 5px 0 0;
position:absolute;
right: 0px;
top: 0px;
border-radius: 10px;
}
/* Safari-look filter input for Firefox */
@-moz-document url-prefix() {
div#torrent_filter_bar input#torrent_search {
div#statusbar input#torrent_search {
background: #FFF url('../images/graphics/filter_icon.png') top left no-repeat;
border: 1px solid #5D80A1;
margin-top: 3px;
@ -334,19 +190,85 @@ div#torrent_filter_bar input#torrent_search {
}
}
div#torrent_filter_bar input#torrent_search.blur {
#statusbar input#torrent_search.blur {
color: #999;
}
/*--------------------------------------
*
* T O R R E N T C O N T A I N E R
*
*--------------------------------------*/
/***
****
**** FILTER POPUP
****
***/
#filter-popup .count {
padding-left: 3px;
}
#filter-popup {
color: #222;/* !important; */
background: #FFF;
z-index: 100;
}
#filter-popup #filter-by-state .row .filter-img {
display: none;
}
div#filter-popup #filter-by-state .row .filter-name {
left: 0px;
}
#filter-popup .row {
font-size: 1.2em;
text-align: left;
cursor: pointer;
margin: 8px 2px;
position: relative;
height: 18px;
-moz-user-select: none;
-webkit-user-select: none;
}
div#filter-popup .row .filter-img {
border: none;
width: 16px;
height: 16px;
position: absolute;
left: 0px;
}
#filter-popup .row .filter-name {
position: absolute;
left: 20px;
}
#filter-popup .row .count {
float: right;
color: #aaa;
}
#filter-popup li {
text-align: left
}
#filter-popup .row:hover,
#filter-popup .row.selected {
font-weight: bold;
}
#filter-popup #filter-by-state {
float: left;
width: 120px;
overflow: hidden;
text-overflow: ellipsis;
}
#filter-popup #filter-by-tracker {
float: right;
width: 130px;
overflow: hidden;
text-overflow: ellipsis;
}
/***
****
**** TORRENT CONTAINER
****
***/
div#torrent_container {
position: fixed;
top: 97px;
top: 102px;
bottom: 22px;
right: 0px;
left: 0px;
@ -405,9 +327,14 @@ ul.torrent_list li.torrent div.torrent_name {
text-overflow: ellipsis;
white-space: nowrap;
color: #222;
margin-top: 2px;
margin-bottom: 2px;
}
ul.torrent_list li.torrent div.torrent_name.compact {
font-weight: normal;
}
ul.torrent_list li.torrent div.torrent_name.paused {
font-size: 1.3em;
font-weight: normal;
@ -461,9 +388,6 @@ ul.torrent_list div.torrent_progress_bar_container {
position: relative;
margin-top: 2px;
}
ul.torrent_list div.torrent_status_and_progress_bar {
/* float: right;*/
}
ul.torrent_list div.torrent_progress_bar_container.compact {
width: 50px;
position: absolute;
@ -571,13 +495,13 @@ li.torrent a:active div.torrent_resume {
div#torrent_inspector {
position: fixed;
top: 97px;
top: 102px;
bottom: 22px;
right: 0px;
width: 570px;
background-color: #ddd;
border-left: 1px solid #888;
z-index: 2;
z-index: 5;
text-align: left;
overflow: auto;
}
@ -587,7 +511,7 @@ div#torrent_inspector #torrent_inspector_name {
}
div#torrent_inspector #torrent_inspector_size {
font-size: 1.2em;
margin: 3;
margin: 3px;
display: block;
padding-top: 2px;
}
@ -957,7 +881,7 @@ div.torrent_footer {
margin: 0;
padding: 0;
border-top: 1px solid #555;
background: #aaa url('../images/graphics/chrome.png') left bottom repeat-x;
background: #aaa url('../images/graphics/chrome.png') left -142px repeat-x;
position: fixed;
left: 0px;
right: 0px;
@ -980,11 +904,11 @@ div.torrent_footer ul#settings_menu li#button {
}
div.torrent_footer ul#settings_menu li#button:active {
/background: transparent url('../images/graphics/chrome.png') -32px -75px no-repeat;
background: transparent url('../images/graphics/chrome.png') -32px -75px no-repeat;
}
div.torrent_footer ul#settings_menu li#button:hover {
/background: transparent url('../images/graphics/chrome.png') -32px -75px no-repeat;
background: transparent url('../images/graphics/chrome.png') -32px -75px no-repeat;
}
div.torrent_footer div#disk_space_container {
@ -1018,6 +942,31 @@ div.torrent_footer div#turtle_button {
background: transparent url('../images/graphics/chrome.png') -32px -97px no-repeat;
}
div.torrent_footer #compact-button {
height: 22px;
width: 32px !important;
visibility: visible;
padding: 0;
float: left;
margin-left: 38px;
position: relative;
-moz-user-select: none;
-webkit-user-select: none;
}
div.torrent_footer #compact-button {
background: transparent url('../images/graphics/chrome.png') left -185px no-repeat;
}
div.torrent_footer #compact-button:active {
background: transparent url('../images/graphics/chrome.png') -32px -185px no-repeat;
}
div.torrent_footer #compact-button.enabled {
background: transparent url('../images/graphics/chrome.png') left -163px no-repeat;
}
div.torrent_footer #compact-button.enabled:active {
background: transparent url('../images/graphics/chrome.png') -32px -163px no-repeat;
}
/*--------------------------------------
*
@ -1040,8 +989,6 @@ div.dialog_container {
div.dialog_container div.dialog_window {
background-color: #eee;
margin: 0 auto;
filter: alpha(opacity=95);
-moz-opacity: .95;
opacity: .95;
border-top: none;
text-align: left;
@ -1371,8 +1318,6 @@ div#prefs_container div#pref_error {
.trans_menu ul {
min-width: 210px;
background-color: #fff;
filter: alpha(opacity=98);
-moz-opacity: .98;
opacity: .98;
padding: 5px 0;
text-align: left;

View File

@ -1,89 +0,0 @@
div.torrent_global_menu ul li {
width: 60px;
}
div#torrent_filter_bar ul li {
width: 100px;
}
div.torrent_footer {
position: static;
}
div#torrent_container {
position: static;
top: 97px;
}
div#torrent_inspector {
position: absolute;
}
ul.torrent_list {
width: 98%;
}
ul.torrent_list li.even {
background-color: #EDF3FE !important;
zoom: 1.0;
}
ul.torrent_list li.selected {
background-color: #3879D7 !important;
color: #FFF;
zoom: 1.0;
}
div.torrent_footer ul#settings_menu li#button:active,
div.torrent_footer ul#settings_menu li#button:hover {
background-position: -32px -75px;
}
.trans_menu li.main li {
width: 100%;
}
.trans_menu li.active {
background-image: none !important;
}
.trans_menu li.hover {
z-index: 1 !important; /* the hover z-index has to be below the normal one the hovering items may be drawn over a submenu */
background-color: #24e;
color: #fff;
text-shadow: none;
margin-bottom: 0px;
margin-top: 0px;
}
div.torrent_footer ul#settings_menu li#button:active,
div.torrent_footer ul#settings_menu li#button:hover {
background-position: -32px -75px;
}
.trans_menu li.main li {
width: auto;
}
.trans_menu li.active {
background-image: none !important;
}
.trans_menu .innerBox li.hover {
z-index: 1 !important; /* the hover z-index has to be below the normal one the hovering items may be drawn over a submenu */
background-color: #24e !important;
color: #fff !important;
text-shadow: none;
}
.trans_menu ul {
width: 210px;
}
.trans_menu li.separator {
line-height: 0px;
height: 1px !important;
font-size: 0px;
width: auto;
}
.trans_menu li, .trans_menu li.active {
position: relative;
width: auto;
zoom: 1.0;
}
.trans_menu li span.arrow {
position: absolute;
right: 3px; top: 0px;
}
.trans_menu ul ul {
margin-left: 0px !important;
}
.trans_menu li .innerBox .outerbox {
top: auto !important;
bottom: 0px !important;
}

View File

@ -23,15 +23,15 @@ body {
}
body div#torrent_container {
min-height: 295px;
min-height: 328px;
}
body div.dialog_container {
min-height: 291px;
min-height: 326px;
}
body div#torrent_inspector {
min-height: 323px;
min-height: 329px;
}
body.landscape div#torrent_container {
@ -53,30 +53,29 @@ body.open_showing #torrent_filter_bar, body.open_showing #torrent_container {
display: none;
}
/*--------------------------------------
*
* T O P M E N U
*
*--------------------------------------*/
/***
****
**** TOOLBAR
****
***/
div.torrent_global_menu {
#toolbar {
width: 100%;
height: 55px;
margin: 0;
background: #6685a1 url('../images/graphics/iphone_chrome.png') top left repeat-x;
border-top: 1px solid #2d3642;
border-bottom: 1px solid #2d3642;
border: 1px outset #AEBBCB;
position: relative;
text-shadow: 0 -1px 0 #446;
}
div.torrent_global_menu ul {
#toolbar ul {
margin: 0;
padding: 0 3px;
text-align: left;
}
div.torrent_global_menu ul li {
#toolbar ul li {
list-style-type: none;
list-style-image: none;
padding: 0;
@ -84,15 +83,14 @@ div.torrent_global_menu ul li {
display: inline-block;
}
li#remove, li#open {
#toolbar li#remove, li#open {
float: left;
}
li#resume_all, li#pause_all {
#toolbar li#resume_all, li#pause_all {
float: right;
}
div.torrent_global_menu ul li > div {
#toolbar ul li > div {
color: #fff;
font-size: 9px;
text-decoration: none;
@ -105,172 +103,157 @@ div.torrent_global_menu ul li > div {
font-weight: bold;
}
div.torrent_global_menu ul li.disabled {
#toolbar ul li.disabled {
opacity: 0.25;
}
div.torrent_global_menu ul li div div.toolbar_image {
#toolbar ul li div div.toolbar_image {
width: 32px;
height: 32px;
margin: 0 auto 2px;
background-image: url('../images/buttons/toolbar_buttons.png');
}
div.torrent_global_menu ul li#remove div div.toolbar_image {
background-position: left -32px;
}
/* toolbar images */
li#open div div.toolbar_image { background-position: left 0px; }
li#open div:active div.toolbar_image { background-position: right 0px; }
li#remove div div.toolbar_image { background-position: left -32px; }
li#remove div:active div.toolbar_image { background-position: right -32px; }
li#resume_selected div div.toolbar_image { background-position: left -96px; }
li#resume_selected div:active div.toolbar_image { background-position: right -96px; }
li#pause_selected div div.toolbar_image { background-position: left -64px; }
li#pause_selected div:active div.toolbar_image { background-position: right -64px; }
li#pause_all div div.toolbar_image { background-position: left -128px; }
li#pause_all div:active div.toolbar_image { background-position: right -128px; }
li#resume_all div div.toolbar_image { background-position: left -160px; }
li#resume_all div:active div.toolbar_image { background-position: right -160px; }
li#filter div div.toolbar_image { background-position: left -192px; }
li#filter div:active div.toolbar_image { background-position: right -192px; }
li#inspector div div.toolbar_image { background-position: left -224px; }
li#inspector div:active div.toolbar_image { background-position: right -224px; }
div.torrent_global_menu ul li#resume_selected div div.toolbar_image {
background-position: left -96px;
}
div.torrent_global_menu ul li#pause_selected div div.toolbar_image {
background-position: left -64px;
}
div.torrent_global_menu ul li#pause_all div div.toolbar_image {
background-position: left -128px;
}
div.torrent_global_menu ul li#resume_all div div.toolbar_image {
background-position: left -160px;
}
div.torrent_global_menu ul li#filter, div.torrent_global_menu ul li#inspector {
#toolbar ul li#filter,
#toolbar ul li#inspector,
#toolbar ul li.divider {
display: none;
}
div.torrent_global_menu ul li.divider {
display: none;
}
/***
****
**** STATUSBAR
****
***/
/*--------------------------------------
*
* G L O B A L D E T A I L S
*
*--------------------------------------*/
div.torrent_global_details {
width: 100%;
height: 18px;
#statusbar {
margin: 0;
background: #6685a1 url('../images/graphics/iphone_chrome.png') bottom left repeat-x;
font-size: 12px;
border-bottom: 1px solid #2d3642;
position: relative;
left: 0;
right: 0;
top: 0;
z-index: 2;
color: #fff;
text-shadow: 0 -1px 0 #446;
background: #6B83A1;
border: 1px outset #AEBBCB;
width: 100%;
overflow: hidden;
position: relative;
text-align: left;
}
div.torrent_global_details div {
padding: 2px 5px;
margin: 1px 0 0 0;
}
div.torrent_global_details div#torrent_global_transfer {
clear: left;
float: left;
}
div.torrent_global_details div#torrent_global_upload,
div.torrent_global_details div#torrent_global_download {
#statusbar #speed-info {
margin-top: 3px;
float: right;
margin-right: 6px;
}
/*--------------------------------------
*
* T O R R E N T F I L T E R B A R
*
*--------------------------------------*/
div#torrent_filter_bar {
margin: 0;
height: 25px;
background: #ddd url('../images/graphics/filter_bar.png') repeat-x bottom left;
border-bottom: 1px solid #777;
position: relative;
width: 100%;
z-index: 2;
text-align: center;
#statusbar #filter-button {
float: left;
border: none;
font-size: 1.2em;
padding: 1px 6px;
margin-top: 1px;
overflow: hidden;
text-overflow: ellipsis;
-moz-user-select: none;
-webkit-user-select: none;
}
#statusbar #filter-button:hover {
cursor: pointer;
}
#statusbar #filter-button .filter-selection {
text-decoration: underline;
}
div#torrent_filter_bar ul {
margin: 0 !important;
padding: 5px 0 0;
text-align: center !important;
display: block;
width: 100%;
height: 15px;
list-style-type: none;
}
div#torrent_filter_bar ul li {
list-style-type: none;
list-style-image: none;
padding: 2px 0;
vertical-align: middle;
height: 17px;
display: inline;
}
div#torrent_filter_bar ul li a {
font-size: 12px !important;
color: #222;
text-shadow: 0 1px 1px #fff;
text-decoration: none;
font-weight: bold;
padding: 1px 7px 2px 0;
margin: 0 0 0 7px;
}
div#torrent_filter_bar ul li.selected, div#torrent_filter_bar ul li.selected a {
background-image: url('../images/graphics/filter_bar.png');
background-repeat: no-repeat;
text-shadow: 0 1px 1px #444;
color: #fff !important;
}
div#torrent_filter_bar ul li.selected {
background-position: left top;
}
div#torrent_filter_bar ul li.selected a {
background-position: right top;
}
div#torrent_filter_bar ul li a.finished {
#statusbar #torrent_search {
display: none;
}
div#torrent_filter_bar input#torrent_search {
position: absolute;
height: 20px;
left: 5px;
right: 5px;
bottom: 6px;
display: none;
/***
****
**** FILTER POPUP
****
***/
#filter-popup .count {
padding-left: 3px;
}
#filter-popup {
color: #222;/* !important; */
background: #FFF;
z-index: 100;
}
/*--------------------------------------
*
* T O R R E N T C O N T A I N E R
*
*--------------------------------------*/
div#torrent_container {
#filter-popup #filter-by-state .row .filter-img {
display: none;
}
div#filter-popup #filter-by-state .row .filter-name {
left: 0px;
}
#filter-popup .row {
font-size: 1.2em;
text-align: left;
cursor: pointer;
margin: 15px 2px;
position: relative;
top: 0 !important;
right: 0px;
left: 0px;
padding: 0px;
margin: 0px;
height: 18px;
}
div#filter-popup .row .filter-img {
border: none;
width: 16px;
height: 16px;
position: absolute;
left: 0px;
}
#filter-popup .row .filter-name {
position: absolute;
left: 20px;
}
#filter-popup .row .count {
float: right;
color: #aaa;
}
#filter-popup li {
text-align: left
}
#filter-popup .row:hover,
#filter-popup .row.selected {
font-weight: bold;
}
#filter-popup #filter-by-state {
float: left;
width: 120px;
overflow: hidden;
text-overflow: ellipsis;
}
#filter-popup #filter-by-tracker {
float: right;
width: 130px;
overflow: hidden;
text-overflow: ellipsis;
}
/***
****
**** TORRENT CONTAINER
****
***/
ul.torrent_list {
width: 100%;
@ -298,6 +281,10 @@ ul.torrent_list li.torrent {
background: white;
}
ul.torrent_list li.torrent.compact {
padding: 4px;
}
.torrent div.torrent_progress_details, .torrent div.torrent_peer_details {
clear: both;
white-space: nowrap;
@ -316,11 +303,22 @@ ul.torrent_list li.torrent.selected {
ul.torrent_list li.torrent div.torrent_name {
font-size: 13px;
margin-bottom: 2px;
font-weight: bold;
word-wrap: break-word;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #222;
margin-bottom: 2px;
}
ul.torrent_list li.torrent div.torrent_name.compact {
font-weight: normal;
}
ul.torrent_list li.torrent div.torrent_name.paused {
font-size: 1.3em;
font-weight: normal;
color: #777;
}
ul.torrent_list li.torrent.selected div.torrent_name {
@ -331,33 +329,58 @@ div.torrent_peer_details {
font-size: 10px;
}
/***
**** Progressbar
***/
/**
* Progressbar
*
* Each progressbar has three elemens: a parent container and two children,
* complete and incomplete.
*
* The only thing needed to set the progressbar percentage is to set
* the complete child's width as a percentage. This is because incomplete
* is pinned to the full width and height of the parent, and complete
* is pinned to the left side of the parent and has a higher z-index.
*
* The progressbar has different colors depending on its state, so there
* are four 'decorator' classNames: magnet, seeding, leeching, and paused.
*/
ul.torrent_list div.torrent_progress_bar_container {
height: 10px;
position: relative;
margin-top: 2px;
height: 10px;
position: relative;
margin-top: 2px;
}
ul.torrent_list div.torrent_progress_bar_container.compact {
width: 50px;
position: absolute;
right: 10px;
margin-top: 2px;
/*float: right;*/
}
ul.torrent_list div.torrent_peer_details.compact {
font-size: 12px; /* matching the progressbar height (10px) + progressbar border (1px top, 1px bottom) */
margin-top: 2px;
margin-left: 10px;
margin-right: 65px; /* leave room on the right for the progressbar */
float: right; /* pins it next to progressbar & forces torrent_name to ellipsize when it bumps up against this div */
}
ul.torrent_list div.torrent_progress_bar_container.full {
margin-bottom: 5px;
margin-bottom: 5px;
}
ul.torrent_list div.torrent_progress_bar {
height: 100%;
position: absolute;
top: 0px;
left: 0px;
background-image: url('../images/progress/progress.png');
background-repeat: repeat-x;
border: 1px solid #888;
height: 100%;
position: absolute;
top: 0px;
left: 0px;
background-image: url('../images/progress/progress.png');
background-repeat: repeat-x;
border: 1px solid #888;
}
ul.torrent_list div.torrent_progress_bar.complete {
z-index: 2;
z-index: 2;
}
ul.torrent_list div.torrent_progress_bar.incomplete {
z-index: 1;
width: 100%;
z-index: 1;
width: 100%;
}
ul.torrent_list div.torrent_progress_bar.complete.paused {
background-position: left -30px;
@ -382,7 +405,7 @@ ul.torrent_list div.torrent_progress_bar.complete.leeching {
ul.torrent_list div.torrent_progress_bar.incomplete.leeching {
background-position: left -20px;
border-color: #CFCFCF;
}
}
ul.torrent_list div.torrent_progress_bar.complete.seeding {
background-position: left -10px;
border-color: #35CA53;
@ -870,11 +893,34 @@ iframe#torrent_upload_frame {
margin: 0;
}
div.torrent_footer div#turtle_button {
div.torrent_footer #compact-button {
position: absolute;
top: 0px;
right: 0px;
margin: 2px;
height: 18px;
width: 32px !important;
}
div.torrent_footer #compact-button {
background: transparent url('../images/graphics/chrome.png') left -31px no-repeat;
}
div.torrent_footer #compact-button.active {
background: transparent url('../images/graphics/chrome.png') -32px -31px no-repeat;
}
div.torrent_footer #compact-button.enabled {
background: transparent url('../images/graphics/chrome.png') left -53px no-repeat;
}
div.torrent_footer #compact-button.enabled.active {
background: transparent url('../images/graphics/chrome.png') -32px -53px no-repeat;
}
div.torrent_footer div#turtle_button {
position: absolute;
top: 0px;
left: 0px;
margin: 2px;
height: 18px;
width: 32px !important;
margin: 1px 0 0 3px;
padding: 0;
}
.turtleEnabled {
@ -890,6 +936,28 @@ div.torrent_footer div#turtle_button {
background: transparent url('../images/graphics/chrome.png') -32px -99px no-repeat;
}
div.torrent_footer #compact-button {
position: absolute;
top: 0px;
right: 0px;
margin: 2px;
height: 18px;
width: 32px !important;
visibility: visible;
}
div.torrent_footer #compact-button {
background: transparent url('../images/graphics/chrome.png') left -187px no-repeat;
}
div.torrent_footer #compact-button:active {
background: transparent url('../images/graphics/chrome.png') -32px -187px no-repeat;
}
div.torrent_footer #compact-button.enabled {
background: transparent url('../images/graphics/chrome.png') left -165px no-repeat;
}
div.torrent_footer #compact-button.enabled:active {
background: transparent url('../images/graphics/chrome.png') -32px -165px no-repeat;
}
/*--------------------------------------
*
* Hide remnants of stuff we don't need, like