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 |
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 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 with(require("filterClasses")) | 18 with(require("filterClasses")) |
19 { | 19 { |
20 this.Filter = Filter; | 20 this.Filter = Filter; |
21 this.BlockingFilter = BlockingFilter; | 21 this.BlockingFilter = BlockingFilter; |
22 this.WhitelistFilter = WhitelistFilter; | 22 this.WhitelistFilter = WhitelistFilter; |
| 23 this.ElemHideFilter = ElemHideFilter; |
23 } | 24 } |
24 with(require("subscriptionClasses")) | 25 with(require("subscriptionClasses")) |
25 { | 26 { |
26 this.Subscription = Subscription; | 27 this.Subscription = Subscription; |
27 this.DownloadableSubscription = DownloadableSubscription; | 28 this.DownloadableSubscription = DownloadableSubscription; |
28 this.SpecialSubscription = SpecialSubscription; | 29 this.SpecialSubscription = SpecialSubscription; |
29 } | 30 } |
30 with(require("whitelisting")) | 31 with(require("whitelisting")) |
31 { | 32 { |
32 this.isPageWhitelisted = isPageWhitelisted; | 33 this.isPageWhitelisted = isPageWhitelisted; |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 try | 528 try |
528 { | 529 { |
529 filters = parseFilters(msg.text); | 530 filters = parseFilters(msg.text); |
530 } | 531 } |
531 catch (error) | 532 catch (error) |
532 { | 533 { |
533 sendResponse({status: "invalid", error: error}); | 534 sendResponse({status: "invalid", error: error}); |
534 break; | 535 break; |
535 } | 536 } |
536 | 537 |
| 538 var selectors = []; |
537 for (var i = 0; i < filters.length; i++) | 539 for (var i = 0; i < filters.length; i++) |
538 FilterStorage.addFilter(filters[i]); | 540 { |
| 541 var filter = filters[i]; |
| 542 FilterStorage.addFilter(filter); |
539 | 543 |
540 sendResponse({status: "ok"}); | 544 if (filter instanceof ElemHideFilter) |
| 545 selectors.push(filter.selector); |
| 546 } |
| 547 |
| 548 sendResponse({status: "ok", selectors: selectors}); |
541 break; | 549 break; |
542 case "add-subscription": | 550 case "add-subscription": |
543 ext.showOptions(function(page) | 551 ext.showOptions(function(page) |
544 { | 552 { |
545 page.sendMessage(msg); | 553 page.sendMessage(msg); |
546 }); | 554 }); |
547 break; | 555 break; |
548 case "add-sitekey": | 556 case "add-sitekey": |
549 processKey(msg.token, sender.page, sender.frame); | 557 processKey(msg.token, sender.page, sender.frame); |
550 break; | 558 break; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 page.sendMessage({type: "clickhide-deactivate"}); | 595 page.sendMessage({type: "clickhide-deactivate"}); |
588 refreshIconAndContextMenu(page); | 596 refreshIconAndContextMenu(page); |
589 }); | 597 }); |
590 | 598 |
591 setTimeout(function() | 599 setTimeout(function() |
592 { | 600 { |
593 var notificationToShow = NotificationStorage.getNextToShow(); | 601 var notificationToShow = NotificationStorage.getNextToShow(); |
594 if (notificationToShow) | 602 if (notificationToShow) |
595 showNotification(notificationToShow); | 603 showNotification(notificationToShow); |
596 }, 3 * 60 * 1000); | 604 }, 3 * 60 * 1000); |
OLD | NEW |