@@ -18,7 +18,7 @@ var recentChannels = [];
18
18
function escapeShellArg ( arg ) {
19
19
let ret = '' ;
20
20
21
- if ( prefs [ ' use_double_quotes' ] ) {
21
+ if ( prefs . use_double_quotes ) {
22
22
ret = arg . replace ( / [ " \\ ] / g, function ( m , i , s ) {
23
23
return '\\' + m . slice ( 0 , 1 ) ;
24
24
} ) ;
@@ -48,7 +48,7 @@ function getDownloadCommands(httpChannel, filename) {
48
48
49
49
let inputStream = httpChannel . QueryInterface ( Ci . nsIUploadChannel ) . uploadStream ;
50
50
if ( inputStream ) {
51
- let streamPos = inputStream . tell ( )
51
+ let streamPos = inputStream . tell ( ) ;
52
52
inputStream . seek ( 0 , 0 ) ;
53
53
let body = NetUtil . readInputStreamToString ( inputStream , inputStream . available ( ) , { } ) ;
54
54
let i = body . indexOf ( "\r\n\r\n" ) ;
@@ -59,7 +59,7 @@ function getDownloadCommands(httpChannel, filename) {
59
59
60
60
let bodyHeaders = bodyHeader . split ( "\r\n" ) ;
61
61
62
- for ( h in bodyHeaders ) {
62
+ for ( let h in bodyHeaders ) {
63
63
headerVisitor . headers . push ( bodyHeaders [ h ] ) ;
64
64
}
65
65
inputStream . seek ( 0 , streamPos ) ; // back to its original position
@@ -68,12 +68,12 @@ function getDownloadCommands(httpChannel, filename) {
68
68
let ret = { } ;
69
69
70
70
// Generating wget command
71
- if ( prefs [ ' wget' ] && ( ( requestMethod == 'GET' && ! payload ) || ( requestMethod == 'POST' && payload ) ) ) {
71
+ if ( prefs . wget && ( ( requestMethod == 'GET' && ! payload ) || ( requestMethod == 'POST' && payload ) ) ) {
72
72
ret . wget = 'wget' ;
73
73
74
74
for ( let i in headerVisitor . headers ) {
75
75
let h = headerVisitor . headers [ i ] ;
76
- if ( h . substring ( 0 , 15 ) . toLowerCase ( ) == 'accept-encoding' && prefs [ ' remove_accept_encoding' ] )
76
+ if ( h . substring ( 0 , 15 ) . toLowerCase ( ) == 'accept-encoding' && prefs . remove_accept_encoding )
77
77
continue ;
78
78
ret . wget += ' --header=' + escapeShellArg ( h ) ;
79
79
}
@@ -92,12 +92,12 @@ function getDownloadCommands(httpChannel, filename) {
92
92
}
93
93
94
94
// Generating curl command
95
- if ( prefs [ ' curl' ] ) {
95
+ if ( prefs . curl ) {
96
96
ret . curl = 'curl' ;
97
97
98
98
for ( let i in headerVisitor . headers ) {
99
99
let h = headerVisitor . headers [ i ] ;
100
- if ( h . substring ( 0 , 15 ) . toLowerCase ( ) == 'accept-encoding' && prefs [ ' remove_accept_encoding' ] )
100
+ if ( h . substring ( 0 , 15 ) . toLowerCase ( ) == 'accept-encoding' && prefs . remove_accept_encoding )
101
101
continue ;
102
102
ret . curl += ' --header ' + escapeShellArg ( h ) ;
103
103
}
@@ -121,12 +121,12 @@ function getDownloadCommands(httpChannel, filename) {
121
121
}
122
122
123
123
// Generating aria2 command
124
- if ( prefs [ ' aria2' ] && ( requestMethod == 'GET' && ! payload ) ) {
124
+ if ( prefs . aria2 && ( requestMethod == 'GET' && ! payload ) ) {
125
125
ret . aria2 = 'aria2c' ;
126
126
127
127
for ( let i in headerVisitor . headers ) {
128
128
let h = headerVisitor . headers [ i ] ;
129
- if ( h . substring ( 0 , 15 ) . toLowerCase ( ) == 'accept-encoding' && prefs [ ' remove_accept_encoding' ] )
129
+ if ( h . substring ( 0 , 15 ) . toLowerCase ( ) == 'accept-encoding' && prefs . remove_accept_encoding )
130
130
continue ;
131
131
ret . aria2 += ' --header ' + escapeShellArg ( h ) ;
132
132
}
@@ -167,7 +167,7 @@ function createDownloadElement(window, cmdtype, cmd) {
167
167
button . onclick = function ( ) {
168
168
clipboard . set ( cmd ) ;
169
169
window . close ( ) ;
170
- }
170
+ } ;
171
171
172
172
return vbox ;
173
173
}
@@ -182,7 +182,7 @@ function copyCommandForUri(uri, type) {
182
182
event . subject . QueryInterface ( Ci . nsIRequest ) . cancel ( 0 ) ;
183
183
events . off ( 'http-on-modify-request' , listener ) ;
184
184
}
185
- } ;
185
+ }
186
186
187
187
events . on ( 'http-on-modify-request' , listener ) ;
188
188
@@ -204,17 +204,17 @@ exports.main = function() {
204
204
else {
205
205
menuItems = [ ] ;
206
206
for ( var t in arg ) {
207
- if ( prefs [ ' curl' ] )
207
+ if ( prefs . curl )
208
208
menuItems . push ( contextMenu . Item ( {
209
209
label : 'Copy curl for ' + t ,
210
210
data : JSON . stringify ( { uri : arg [ t ] , type : 'curl' } )
211
211
} ) ) ;
212
- if ( prefs [ ' wget' ] )
212
+ if ( prefs . wget )
213
213
menuItems . push ( contextMenu . Item ( {
214
214
label : 'Copy wget for ' + t ,
215
215
data : JSON . stringify ( { uri : arg [ t ] , type : 'wget' } )
216
216
} ) ) ;
217
- if ( prefs [ ' aria2' ] )
217
+ if ( prefs . aria2 )
218
218
menuItems . push ( contextMenu . Item ( {
219
219
label : 'Copy aria2 for ' + t ,
220
220
data : JSON . stringify ( { uri : arg [ t ] , type : 'aria2' } )
@@ -281,11 +281,13 @@ var DownloadHelper = Class({
281
281
282
282
QueryInterface : function ( interface ) {
283
283
var srv = this . originalService . QueryInterface ( interface ) ;
284
- for ( let i in srv )
285
- if ( ! ( i in this ) )
284
+ for ( let i in srv ) {
285
+ if ( ! ( i in this ) ) {
286
286
this [ i ] = function ( ) {
287
287
return srv [ i ] . apply ( srv , arguments ) ;
288
- } ;
288
+ } ; /* TODO: fix this. */ // jshint ignore:line
289
+ }
290
+ }
289
291
return this ;
290
292
} ,
291
293
0 commit comments