Skip to content

Commit 96e8a26

Browse files
committed
Fix jshint errors.
One TODO left, I will probably break it if I try fix to fix it now.
1 parent a64507c commit 96e8a26

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

.jshintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"moz": true
3+
}

lib/main.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var recentChannels = [];
1818
function escapeShellArg(arg) {
1919
let ret = '';
2020

21-
if (prefs['use_double_quotes']) {
21+
if (prefs.use_double_quotes) {
2222
ret = arg.replace(/["\\]/g, function (m, i, s) {
2323
return '\\' + m.slice(0, 1);
2424
});
@@ -48,7 +48,7 @@ function getDownloadCommands(httpChannel, filename) {
4848

4949
let inputStream = httpChannel.QueryInterface(Ci.nsIUploadChannel).uploadStream;
5050
if (inputStream) {
51-
let streamPos = inputStream.tell()
51+
let streamPos = inputStream.tell();
5252
inputStream.seek(0, 0);
5353
let body = NetUtil.readInputStreamToString(inputStream, inputStream.available(), {});
5454
let i = body.indexOf("\r\n\r\n");
@@ -59,7 +59,7 @@ function getDownloadCommands(httpChannel, filename) {
5959

6060
let bodyHeaders = bodyHeader.split("\r\n");
6161

62-
for (h in bodyHeaders) {
62+
for (let h in bodyHeaders) {
6363
headerVisitor.headers.push(bodyHeaders[h]);
6464
}
6565
inputStream.seek(0, streamPos); // back to its original position
@@ -68,12 +68,12 @@ function getDownloadCommands(httpChannel, filename) {
6868
let ret = {};
6969

7070
// Generating wget command
71-
if (prefs['wget'] && ((requestMethod == 'GET' && !payload) || (requestMethod == 'POST' && payload))) {
71+
if (prefs.wget && ((requestMethod == 'GET' && !payload) || (requestMethod == 'POST' && payload))) {
7272
ret.wget = 'wget';
7373

7474
for (let i in headerVisitor.headers) {
7575
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)
7777
continue;
7878
ret.wget += ' --header=' + escapeShellArg(h);
7979
}
@@ -92,12 +92,12 @@ function getDownloadCommands(httpChannel, filename) {
9292
}
9393

9494
// Generating curl command
95-
if (prefs['curl']) {
95+
if (prefs.curl) {
9696
ret.curl = 'curl';
9797

9898
for (let i in headerVisitor.headers) {
9999
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)
101101
continue;
102102
ret.curl += ' --header ' + escapeShellArg(h);
103103
}
@@ -121,12 +121,12 @@ function getDownloadCommands(httpChannel, filename) {
121121
}
122122

123123
// Generating aria2 command
124-
if (prefs['aria2'] && (requestMethod == 'GET' && !payload)) {
124+
if (prefs.aria2 && (requestMethod == 'GET' && !payload)) {
125125
ret.aria2 = 'aria2c';
126126

127127
for (let i in headerVisitor.headers) {
128128
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)
130130
continue;
131131
ret.aria2 += ' --header ' + escapeShellArg(h);
132132
}
@@ -167,7 +167,7 @@ function createDownloadElement(window, cmdtype, cmd) {
167167
button.onclick = function () {
168168
clipboard.set(cmd);
169169
window.close();
170-
}
170+
};
171171

172172
return vbox;
173173
}
@@ -182,7 +182,7 @@ function copyCommandForUri(uri, type) {
182182
event.subject.QueryInterface(Ci.nsIRequest).cancel(0);
183183
events.off('http-on-modify-request', listener);
184184
}
185-
};
185+
}
186186

187187
events.on('http-on-modify-request', listener);
188188

@@ -204,17 +204,17 @@ exports.main = function() {
204204
else {
205205
menuItems = [];
206206
for (var t in arg) {
207-
if (prefs['curl'])
207+
if (prefs.curl)
208208
menuItems.push(contextMenu.Item({
209209
label: 'Copy curl for ' + t,
210210
data: JSON.stringify({uri: arg[t], type: 'curl'})
211211
}));
212-
if (prefs['wget'])
212+
if (prefs.wget)
213213
menuItems.push(contextMenu.Item({
214214
label: 'Copy wget for ' + t,
215215
data: JSON.stringify({uri: arg[t], type: 'wget'})
216216
}));
217-
if (prefs['aria2'])
217+
if (prefs.aria2)
218218
menuItems.push(contextMenu.Item({
219219
label: 'Copy aria2 for ' + t,
220220
data: JSON.stringify({uri: arg[t], type: 'aria2'})
@@ -281,11 +281,13 @@ var DownloadHelper = Class({
281281

282282
QueryInterface: function(interface) {
283283
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)) {
286286
this[i] = function() {
287287
return srv[i].apply(srv, arguments);
288-
};
288+
}; /* TODO: fix this. */ // jshint ignore:line
289+
}
290+
}
289291
return this;
290292
},
291293

0 commit comments

Comments
 (0)