Changeset 400
- Timestamp:
- 07/01/08 23:06:07 (2 months ago)
- Files:
-
- branches/rpc/web/javascript/common.js (modified) (12 diffs)
- branches/rpc/web/javascript/torrent.js (modified) (5 diffs)
- branches/rpc/web/javascript/transmission.js (modified) (7 diffs)
- branches/rpc/web/javascript/transmission.remote.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/rpc/web/javascript/common.js
r395 r400 106 106 Array.prototype.clone = function () { 107 107 return this.concat(); 108 } 108 }; 109 109 110 110 /** … … 117 117 if( e.innerHTML != html ) 118 118 e.innerHTML = html; 119 } 119 }; 120 120 121 121 /* … … 169 169 170 170 return size + unit; 171 } 171 }; 172 172 173 173 … … 202 202 203 203 return result; 204 } 204 }; 205 205 206 206 … … 214 214 var myDate = new Date(seconds*1000); 215 215 return myDate.toGMTString(); 216 } 216 }; 217 217 218 218 /* … … 226 226 Math.roundWithPrecision = function(floatnum, precision) { 227 227 return Math.round ( floatnum * Math.pow ( 10, precision ) ) / Math.pow ( 10, precision ); 228 } 228 }; 229 229 230 230 … … 245 245 246 246 return result; 247 } 247 }; 248 248 249 249 /* … … 254 254 } 255 255 256 257 258 256 /*** 259 257 **** Preferences … … 261 259 262 260 function Prefs() { } 263 Prefs.prototype = { } 261 Prefs.prototype = { }; 264 262 265 263 Prefs._AutoStart = 'auto-start-torrents'; … … 314 312 date.setTime(date.getTime()+(days*24*60*60*1000)); 315 313 document.cookie = key+"="+val+"; expires="+date.toGMTString()+"; path=/"; 316 } 314 }; 317 315 318 316 /** … … 342 340 else if( val == 'false' ) val = false; 343 341 return val; 344 } 342 }; 345 343 346 344 /** … … 351 349 Prefs.getClutchPrefs = function( o ) 352 350 { 353 if( o == null)354 o = new Object( );351 if( !o ) 352 o = { }; 355 353 for( var key in Prefs._Defaults ) 356 354 o[key] = Prefs.getValue( key, Prefs._Defaults[key] ); 357 355 return o; 358 } 356 }; branches/rpc/web/javascript/torrent.js
r399 r400 436 436 return pass; 437 437 } 438 } 438 }; 439 439 440 440 /** Helper function for Torrent.sortTorrents(). */ 441 441 Torrent.compareById = function( a, b ) { 442 442 return a.id() - b.id(); 443 } 443 }; 444 444 445 445 /** Helper function for sortTorrents(). */ 446 446 Torrent.compareByAge = function( a, b ) { 447 447 return a.dateAdded() - b.dateAdded(); 448 } 448 }; 449 449 450 450 /** Helper function for sortTorrents(). */ … … 454 454 if( a.name() > b.name() ) return 1; 455 455 return 0; 456 } 456 }; 457 457 458 458 /** Helper function for sortTorrents(). */ 459 459 Torrent.compareByActivity = function( a, b ) { 460 460 return a.activity() - b.activity(); 461 } ,461 }; 462 462 463 463 … … 498 498 499 499 return torrents; 500 } 500 }; 501 501 502 502 /** … … 521 521 return -1; // not found 522 522 } 523 } 523 }; 524 524 525 525 /** … … 532 532 var pos = Torrent.indexOf( torrents, id ); 533 533 return pos >= 0 ? torrents[pos] : null; 534 } 534 }; branches/rpc/web/javascript/transmission.js
r398 r400 33 33 // Initialize the implementation fields 34 34 this._current_search = ''; 35 this._torrents = new Array();36 this._rows = new Array();35 this._torrents = [ ]; 36 this._rows = [ ]; 37 37 38 38 // Initialize the clutch preferences … … 513 513 514 514 // pass the new prefs upstream to the RPC server 515 var o = new Object( );515 var o = { }; 516 516 o[RPC._UpSpeedLimit] = parseInt( $('#prefs_form #upload_rate')[0].value ); 517 517 o[RPC._DownSpeedLimit] = parseInt( $('#prefs_form #download_rate')[0].value ); … … 715 715 // Limit the download rate 716 716 case 'footer_download_rate_menu': 717 var args = new Object( );717 var args = { }; 718 718 var rate = (this.innerHTML).replace(/[^0-9]/ig, ''); 719 719 if ($(this).is('#unlimited_download_rate')) { … … 733 733 // Limit the upload rate 734 734 case 'footer_upload_rate_menu': 735 var args = new Object( );735 var args = { }; 736 736 var rate = (this.innerHTML).replace(/[^0-9]/ig, ''); 737 737 if ($(this).is('#unlimited_upload_rate')) { … … 1102 1102 tr.togglePeriodicRefresh( true ); 1103 1103 }; 1104 console.log( $.toJSON(args) );1105 1104 this.togglePeriodicRefresh( false ); 1106 1105 $('#torrent_upload_form').ajaxSubmit( args ); … … 1232 1231 updateButtonStates: function() 1233 1232 { 1234 var showing_dialog = RegExp("(prefs_showing|dialog_showing|open_showing)").test(document.body.className);1233 var showing_dialog = new RegExp("(prefs_showing|dialog_showing|open_showing)").test(document.body.className); 1235 1234 if (showing_dialog) 1236 1235 { … … 1267 1266 } 1268 1267 } 1269 } 1268 }; branches/rpc/web/javascript/transmission.remote.js
r395 r400 88 88 o.method = 'torrent-get' 89 89 o.arguments = { }; 90 o.arguments.fields = 6197;90 o.arguments.fields = 1+2+4+16+32+64+128+1024+2048+4096; 91 91 $.post( RPC._Root, $.toJSON(o), function(data) { 92 92 tr.updateTorrents( data.arguments.torrents ); … … 125 125 }, 126 126 127 /*128 var form = $('#prefs_form #download_location');129 console.log( "form is " form );130 //download_location131 132 // Clear any errors133 $('div#prefs_container div#pref_error').hide();134 $('div#prefs_container h2.dialog_heading').show();135 136 // Set the form action with the appropriate params137 $('#prefs_form')[0].action = 'remote/index.php?action=savePrefs¶m=[]';138 $('#prefs_form').ajaxSubmit({dataType: 'script', type: 'POST'});139 $('body.prefs_showing').removeClass('prefs_showing');140 if (iPhone) {141 transmission.hideiPhoneAddressbar();142 $('#prefs_container').hide();143 } else if (Safari3) {144 $('div#prefs_container div.dialog_window').css('top', '-425px');145 setTimeout("$('#prefs_container').hide();",500);146 }147 */148 149 127 /* 150 128 * Upload Torrent by URL … … 154 132 $('#torrent_upload_form').ajaxSubmit({dataType: 'script', type: 'POST'}); 155 133 }, 156 } 134 };
