Left: | ||
Right: |
OLD | NEW |
---|---|
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-2015 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 |
(...skipping 29 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", "homepage", "lastSuccess", "title", "url"]); | 50 "downloadStatus", "lastDownload", "homepage", "lastSuccess", "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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 else | 326 else |
327 delete listenerFilters.subscription; | 327 delete listenerFilters.subscription; |
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 && !subscriptio n.disabled) | 336 if (subscription.url in FilterStorage.knownSubscriptions) |
337 FilterStorage.removeSubscription(subscription); | 337 { |
338 if (subscription.disabled) | |
339 { | |
340 subscription.disabled = !subscription.disabled; | |
341 FilterNotifier.triggerListeners("subscription.disabled", | |
342 subscription); | |
343 } | |
344 else | |
345 FilterStorage.removeSubscription(subscription); | |
346 } | |
338 else | 347 else |
339 { | 348 { |
340 subscription.disabled = false; | 349 subscription.disabled = false; |
341 subscription.title = message.title; | 350 subscription.title = message.title; |
342 subscription.homepage = message.homepage; | 351 subscription.homepage = message.homepage; |
343 FilterStorage.addSubscription(subscription); | 352 FilterStorage.addSubscription(subscription); |
344 if (!subscription.lastDownload) | 353 if (!subscription.lastDownload) |
345 Synchronizer.execute(subscription); | 354 Synchronizer.execute(subscription); |
346 } | 355 } |
347 break; | 356 break; |
357 case "subscriptions.toggleState": | |
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); | |
359 if (subscription.url in FilterStorage.knownSubscriptions) | |
360 { | |
361 subscription.disabled = !subscription.disabled; | |
362 FilterNotifier.triggerListeners("subscription.disabled", | |
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) | |
371 Synchronizer.execute(subscription, true); | |
372 } | |
373 break; | |
374 case "subscriptions.update": | |
375 var subscription = Subscription.fromURL(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; | |
348 } | 384 } |
349 }); | 385 }); |
350 })(this); | 386 })(this); |
OLD | NEW |