| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 23 matching lines...) Expand all Loading... |
| 34 FILTER_REMOVED, | 34 FILTER_REMOVED, |
| 35 FILTER_DISABLED, | 35 FILTER_DISABLED, |
| 36 FILTER_HITCOUNT, | 36 FILTER_HITCOUNT, |
| 37 FILTER_LASTHIT, | 37 FILTER_LASTHIT, |
| 38 SUBSCRIPTION_ADDED, | 38 SUBSCRIPTION_ADDED, |
| 39 SUBSCRIPTION_REMOVED, | 39 SUBSCRIPTION_REMOVED, |
| 40 SUBSCRIPTION_MOVED, | 40 SUBSCRIPTION_MOVED, |
| 41 SUBSCRIPTION_TITLE, | 41 SUBSCRIPTION_TITLE, |
| 42 SUBSCRIPTION_DISABLED, | 42 SUBSCRIPTION_DISABLED, |
| 43 SUBSCRIPTION_FIXEDTITLE, | 43 SUBSCRIPTION_FIXEDTITLE, |
| 44 SUBSCRIPTION_BEFORE_FILTERS_REPLACED, |
| 45 SUBSCRIPTION_FILTERS_REPLACED, |
| 44 SUBSCRIPTION_HOMEPAGE, | 46 SUBSCRIPTION_HOMEPAGE, |
| 45 SUBSCRIPTION_LASTCHECK, | 47 SUBSCRIPTION_LASTCHECK, |
| 46 SUBSCRIPTION_LASTDOWNLOAD, | 48 SUBSCRIPTION_LASTDOWNLOAD, |
| 47 SUBSCRIPTION_DOWNLOADSTATUS, | 49 SUBSCRIPTION_DOWNLOADSTATUS, |
| 48 SUBSCRIPTION_ERRORS, | 50 SUBSCRIPTION_ERRORS, |
| 49 }; | 51 }; |
| 50 | 52 |
| 51 inline void GenerateCustomBindings() | 53 inline void GenerateCustomBindings() |
| 52 { | 54 { |
| 53 printf("var FilterNotifier = require('filterNotifier').FilterNotifier;\n"); | 55 printf("var FilterNotifier = require('filterNotifier').FilterNotifier;\n"); |
| 54 printf("var notifierTopics = new Map([\n"); | 56 printf("var notifierTopics = new Map([\n"); |
| 55 printf(" [%i, 'filter.added'],\n", Topic::FILTER_ADDED); | 57 printf(" [%i, 'filter.added'],\n", Topic::FILTER_ADDED); |
| 56 printf(" [%i, 'filter.removed'],\n", Topic::FILTER_REMOVED); | 58 printf(" [%i, 'filter.removed'],\n", Topic::FILTER_REMOVED); |
| 57 printf(" [%i, 'filter.disabled'],\n", Topic::FILTER_DISABLED); | 59 printf(" [%i, 'filter.disabled'],\n", Topic::FILTER_DISABLED); |
| 58 printf(" [%i, 'filter.hitCount'],\n", Topic::FILTER_HITCOUNT); | 60 printf(" [%i, 'filter.hitCount'],\n", Topic::FILTER_HITCOUNT); |
| 59 printf(" [%i, 'filter.lastHit'],\n", Topic::FILTER_LASTHIT); | 61 printf(" [%i, 'filter.lastHit'],\n", Topic::FILTER_LASTHIT); |
| 60 printf(" [%i, 'subscription.added'],\n", Topic::SUBSCRIPTION_ADDED); | 62 printf(" [%i, 'subscription.added'],\n", Topic::SUBSCRIPTION_ADDED); |
| 61 printf(" [%i, 'subscription.removed'],\n", Topic::SUBSCRIPTION_REMOVED); | 63 printf(" [%i, 'subscription.removed'],\n", Topic::SUBSCRIPTION_REMOVED); |
| 62 printf(" [%i, 'subscription.moved'],\n", Topic::SUBSCRIPTION_MOVED); | 64 printf(" [%i, 'subscription.moved'],\n", Topic::SUBSCRIPTION_MOVED); |
| 63 printf(" [%i, 'subscription.title'],\n", Topic::SUBSCRIPTION_TITLE); | 65 printf(" [%i, 'subscription.title'],\n", Topic::SUBSCRIPTION_TITLE); |
| 64 printf(" [%i, 'subscription.disabled'],\n", Topic::SUBSCRIPTION_DISABLED); | 66 printf(" [%i, 'subscription.disabled'],\n", Topic::SUBSCRIPTION_DISABLED); |
| 65 printf(" [%i, 'subscription.fixedTitle'],\n", Topic::SUBSCRIPTION_FIXEDTITL
E); | 67 printf(" [%i, 'subscription.fixedTitle'],\n", Topic::SUBSCRIPTION_FIXEDTITL
E); |
| 68 printf(" [%i, 'subscription.beforefiltersreplaced'],\n", |
| 69 Topic::SUBSCRIPTION_BEFORE_FILTERS_REPLACED); |
| 70 printf(" [%i, 'subscription.filtersreplaced'],\n", |
| 71 Topic::SUBSCRIPTION_FILTERS_REPLACED); |
| 66 printf(" [%i, 'subscription.homepage'],\n", Topic::SUBSCRIPTION_HOMEPAGE); | 72 printf(" [%i, 'subscription.homepage'],\n", Topic::SUBSCRIPTION_HOMEPAGE); |
| 67 printf(" [%i, 'subscription.lastCheck'],\n", Topic::SUBSCRIPTION_LASTCHECK)
; | 73 printf(" [%i, 'subscription.lastCheck'],\n", Topic::SUBSCRIPTION_LASTCHECK)
; |
| 68 printf(" [%i, 'subscription.lastDownload'],\n", Topic::SUBSCRIPTION_LASTDOW
NLOAD); | 74 printf(" [%i, 'subscription.lastDownload'],\n", Topic::SUBSCRIPTION_LASTDOW
NLOAD); |
| 69 printf(" [%i, 'subscription.downloadStatus'],\n", Topic::SUBSCRIPTION_DOWNL
OADSTATUS); | 75 printf(" [%i, 'subscription.downloadStatus'],\n", Topic::SUBSCRIPTION_DOWNL
OADSTATUS); |
| 70 printf(" [%i, 'subscription.errors'],\n", Topic::SUBSCRIPTION_ERRORS); | 76 printf(" [%i, 'subscription.errors'],\n", Topic::SUBSCRIPTION_ERRORS); |
| 71 printf("]);"); | 77 printf("]);"); |
| 72 } | 78 } |
| 73 | 79 |
| 74 inline void FilterChange(Topic topic, Filter& filter, | 80 inline void FilterChange(Topic topic, Filter& filter, |
| 75 Subscription* subscription = nullptr, unsigned int position = 0) | 81 Subscription* subscription = nullptr, unsigned int position = 0) |
| 76 { | 82 { |
| 77 JSNotifyFilterChange(topic, filter, subscription, position); | 83 JSNotifyFilterChange(topic, filter, subscription, position); |
| 78 } | 84 } |
| 79 | 85 |
| 80 inline void SubscriptionChange(Topic topic, Subscription& subscription) | 86 inline void SubscriptionChange(Topic topic, Subscription& subscription) |
| 81 { | 87 { |
| 82 JSNotifySubscriptionChange(topic, subscription); | 88 JSNotifySubscriptionChange(topic, subscription); |
| 83 } | 89 } |
| 84 } | 90 } |
| OLD | NEW |