Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2016 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
(...skipping 26 matching lines...) Expand all Loading... | |
40 | 40 |
41 function convertObject(keys, obj) | 41 function convertObject(keys, obj) |
42 { | 42 { |
43 var result = {}; | 43 var result = {}; |
44 for (var i = 0; i < keys.length; i++) | 44 for (var i = 0; i < keys.length; i++) |
45 result[keys[i]] = obj[keys[i]]; | 45 result[keys[i]] = obj[keys[i]]; |
46 return result; | 46 return result; |
47 } | 47 } |
48 | 48 |
49 var convertSubscription = convertObject.bind(null, ["disabled", | 49 var convertSubscription = convertObject.bind(null, ["disabled", |
50 "downloadStatus", "lastDownload", "homepage", "lastSuccess", "title", "url"] ); | 50 "downloadStatus", "homepage", "lastDownload", "title", "url"]); |
Thomas Greiner
2016/01/19 11:27:27
Do we want "lastDownload", "lastSuccess" or both?
Thomas Greiner
2016/01/19 11:27:27
Detail: What about keeping it alphabetically order
saroyanm
2016/01/22 09:55:05
Done.
saroyanm
2016/01/22 09:55:06
In current option page, seems like we are using la
Thomas Greiner
2016/01/25 15:40:27
There's already a ticket requesting for this infor
saroyanm
2016/01/26 18:36:14
Acknowledged.
| |
51 var convertFilter = convertObject.bind(null, ["text"]); | 51 var convertFilter = convertObject.bind(null, ["text"]); |
52 | 52 |
53 var changeListeners = null; | 53 var changeListeners = null; |
54 var messageTypes = { | 54 var messageTypes = { |
55 "app": "app.listen", | 55 "app": "app.listen", |
56 "filter": "filters.listen", | 56 "filter": "filters.listen", |
57 "subscription": "subscriptions.listen" | 57 "subscription": "subscriptions.listen" |
58 }; | 58 }; |
59 | 59 |
60 function sendMessage(type, action, args, page) | 60 function sendMessage(type, action, args, page) |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
328 break; | 328 break; |
329 case "subscriptions.remove": | 329 case "subscriptions.remove": |
330 var subscription = Subscription.fromURL(message.url); | 330 var subscription = Subscription.fromURL(message.url); |
331 if (subscription.url in FilterStorage.knownSubscriptions) | 331 if (subscription.url in FilterStorage.knownSubscriptions) |
332 FilterStorage.removeSubscription(subscription); | 332 FilterStorage.removeSubscription(subscription); |
333 break; | 333 break; |
334 case "subscriptions.toggle": | 334 case "subscriptions.toggle": |
335 var subscription = Subscription.fromURL(message.url); | 335 var subscription = Subscription.fromURL(message.url); |
336 if (subscription.url in FilterStorage.knownSubscriptions) | 336 if (subscription.url in FilterStorage.knownSubscriptions) |
337 { | 337 { |
338 if (subscription.disabled) | 338 if (subscription.disabled || message.keepInstalled) |
339 { | 339 { |
340 subscription.disabled = !subscription.disabled; | 340 subscription.disabled = !subscription.disabled; |
341 FilterNotifier.triggerListeners("subscription.disabled", | 341 FilterNotifier.triggerListeners("subscription.disabled", |
342 subscription); | 342 subscription); |
343 } | 343 } |
344 else | 344 else |
345 FilterStorage.removeSubscription(subscription); | 345 FilterStorage.removeSubscription(subscription); |
346 } | 346 } |
347 else | 347 else |
348 { | 348 { |
349 subscription.disabled = false; | 349 subscription.disabled = false; |
350 subscription.title = message.title; | 350 subscription.title = message.title; |
351 subscription.homepage = message.homepage; | 351 subscription.homepage = message.homepage; |
352 FilterStorage.addSubscription(subscription); | 352 FilterStorage.addSubscription(subscription); |
353 if (!subscription.lastDownload) | 353 if (!subscription.lastDownload) |
354 Synchronizer.execute(subscription); | 354 Synchronizer.execute(subscription); |
355 } | 355 } |
356 break; | 356 break; |
357 case "subscriptions.toggleState": | 357 case "subscriptions.update": |
Thomas Greiner
2016/01/19 11:27:27
I'd rather add this to "subscriptions.toggle" to a
saroyanm
2016/01/22 09:55:06
Done.
| |
358 var subscription = Subscription.fromURL(message.url); | 358 var subscriptions = message.url ? [Subscription.fromURL(message.url)] : |
359 if (subscription.url in FilterStorage.knownSubscriptions) | 359 FilterStorage.subscriptions; |
360 { | 360 for (var i = 0; i < subscriptions.length; i++) |
361 subscription.disabled = !subscription.disabled; | 361 { |
362 FilterNotifier.triggerListeners("subscription.disabled", | 362 var subscription = subscriptions[i]; |
363 subscription); | |
364 } | |
365 break; | |
366 case "subscriptions.updateAll": | |
Thomas Greiner
2016/01/19 11:27:27
Why not add this to "subscriptions.update"? If `me
saroyanm
2016/01/22 09:55:06
Done.
| |
367 for (var i = 0; i < FilterStorage.subscriptions.length; i++) | |
368 { | |
369 var subscription = FilterStorage.subscriptions[i]; | |
370 if (subscription instanceof DownloadableSubscription) | 363 if (subscription instanceof DownloadableSubscription) |
371 Synchronizer.execute(subscription, true); | 364 Synchronizer.execute(subscription, true); |
372 } | 365 } |
373 break; | 366 break; |
374 case "subscriptions.update": | 367 case "subscriptions.isDownloading": |
375 var subscription = Subscription.fromURL(message.url); | 368 callback(Synchronizer.isExecuting(message.url)); |
376 if (subscription instanceof DownloadableSubscription) | |
377 Synchronizer.execute(subscription, true); | |
378 break; | |
379 case "subscriptions.website": | |
Thomas Greiner
2016/01/19 11:27:27
This belongs into "app.open".
However, I'd sugges
saroyanm
2016/01/22 09:55:05
Done.
| |
380 var subscription = Subscription.fromURL(message.url); | |
381 if(subscription.homepage) | |
382 window.open(subscription.homepage); | |
383 break; | 369 break; |
384 } | 370 } |
385 }); | 371 }); |
386 })(this); | 372 })(this); |
LEFT | RIGHT |