Changeset 402
- Timestamp:
- 07/02/08 09:05:00 (2 months ago)
- Files:
-
- branches/rpc/web/javascript/transmission.js (modified) (7 diffs)
- branches/rpc/web/javascript/transmission.remote.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/rpc/web/javascript/transmission.js
r401 r402 184 184 }, 185 185 186 contextStopSelected: function( ) { 187 transmission.stopSelectedTorrents( ); 188 }, 189 contextStartSelected: function( ) { 190 transmission.startSelectedTorrents( ); 191 }, 192 contextRemoveSelected: function( ) { 193 transmission.removeSelectedTorrents( ); 194 }, 195 contextToggleInspector: function( ) { 196 transmission.toggleInspector( ); 197 }, 186 198 contextSelectAll: function( ) { 187 199 transmission.selectAll( true ); 188 200 }, 189 190 201 contextDeselectAll: function( ) { 191 202 transmission.deselectAll( true ); … … 198 209 199 210 var bindings = { 200 context_pause_selected: this. stopSelectedTorrents,201 context_resume_selected: this. startSelectedTorrents,202 context_remove: this. removeSelectedTorrents,203 context_toggle_inspector: this. toggleInspector,211 context_pause_selected: this.contextStopSelected, 212 context_resume_selected: this.contextStartSelected, 213 context_remove: this.contextRemoveSelected, 214 context_toggle_inspector: this.contextToggleInspector, 204 215 context_select_all: this.contextSelectAll, 205 216 context_deselect_all: this.contextDeselectAll … … 897 908 */ 898 909 toggleInspector: function() { 899 if( t ransmission[Prefs._ShowInspector] )900 t ransmission.hideInspector( );910 if( this[Prefs._ShowInspector] ) 911 this.hideInspector( ); 901 912 else 902 t ransmission.showInspector( );913 this.showInspector( ); 903 914 }, 904 915 … … 944 955 */ 945 956 toggleFilter: function() { 946 if( t ransmission[Prefs._ShowFilter] )947 t ransmission.hideFilter();957 if( this[Prefs._ShowFilter] ) 958 this.hideFilter(); 948 959 else 949 t ransmission.showFilter();960 this.showFilter(); 950 961 }, 951 962 … … 1108 1119 1109 1120 removeSelectedTorrents: function() { 1110 var torrents = t ransmission.getSelectedTorrents( );1121 var torrents = this.getSelectedTorrents( ); 1111 1122 if( torrents.length ) 1112 t ransmission.promptToRemoveTorrents( torrents );1123 this.promptToRemoveTorrents( torrents ); 1113 1124 }, 1114 1125 … … 1137 1148 1138 1149 startSelectedTorrents: function( ) { 1139 var tr = transmission; 1140 tr.startTorrents( tr.getSelectedTorrents( ) ); 1150 this.startTorrents( this.getSelectedTorrents( ) ); 1141 1151 }, 1142 1152 startAllTorrents: function( ) { 1143 var tr = transmission; 1144 tr.startTorrents( tr.getAllTorrents( ) ); 1153 this.startTorrents( this.getAllTorrents( ) ); 1145 1154 }, 1146 1155 startTorrent: function( torrent ) { … … 1152 1161 1153 1162 stopSelectedTorrents: function( ) { 1154 var tr = transmission; 1155 tr.stopTorrents( tr.getSelectedTorrents( ) ); 1163 this.stopTorrents( this.getSelectedTorrents( ) ); 1156 1164 }, 1157 1165 stopAllTorrents: function( ) { 1158 var tr = transmission; 1159 tr.stopTorrents( tr.getAllTorrents( ) ); 1166 this.stopTorrents( this.getAllTorrents( ) ); 1160 1167 }, 1161 1168 stopTorrent: function( torrent ) { branches/rpc/web/javascript/transmission.remote.js
r401 r402 57 57 }, 58 58 59 sendRequest: function( url, data, success, contentType ) 60 { 61 var o = { }; 62 o.cache = false; 63 o.contentType = contentType; 64 o.data = data; 65 o.dataType = 'json'; 66 o.error = this.ajaxError; 67 o.success = success; 68 o.type = 'POST'; 69 o.url = url; 70 $.ajax( o ); 71 }, 72 59 73 loadDaemonPrefs: function() { 60 74 var tr = this._controller; 61 75 var o = { }; 62 76 o.method = 'session-get'; 63 $.post( RPC._Root, $.toJSON(o), function(data) {77 this.sendRequest( RPC._Root, $.toJSON(o), function(data) { 64 78 var o = data.arguments.session; 65 79 Prefs.getClutchPrefs( o ); … … 74 88 o.arguments = { }; 75 89 o.arguments.fields = 1+2+4+16+32+64+128+1024+2048+4096; 76 $.post( RPC._Root, $.toJSON(o), function(data) {90 this.sendRequest( RPC._Root, $.toJSON(o), function(data) { 77 91 tr.updateTorrents( data.arguments.torrents ); 78 92 }, "json" ); … … 88 102 for( var i=0, len=torrents.length; i<len; ++i ) 89 103 o.arguments.ids.push( torrents[i].id() ); 90 $.post( RPC._Root, $.toJSON(o), function( ) {104 this.sendRequest( RPC._Root, $.toJSON(o), function( ) { 91 105 remote.loadTorrents(); 92 106 }, "json" ); … … 107 121 o.method = 'session-set'; 108 122 o.arguments = args; 109 $.post( RPC._Root, $.toJSON(o), function(){123 this.sendRequest( RPC._Root, $.toJSON(o), function(){ 110 124 remote.loadDaemonPrefs(); 111 125 }, "json" );
