| 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-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 16 matching lines...) Expand all Loading... |
| 27 #include "../filter/BlockingFilter.h" | 27 #include "../filter/BlockingFilter.h" |
| 28 #include "../filter/WhitelistFilter.h" | 28 #include "../filter/WhitelistFilter.h" |
| 29 #include "../filter/ElemHideBase.h" | 29 #include "../filter/ElemHideBase.h" |
| 30 #include "../filter/ElemHideFilter.h" | 30 #include "../filter/ElemHideFilter.h" |
| 31 #include "../filter/ElemHideException.h" | 31 #include "../filter/ElemHideException.h" |
| 32 #include "../filter/ElemHideEmulationFilter.h" | 32 #include "../filter/ElemHideEmulationFilter.h" |
| 33 #include "../subscription/Subscription.h" | 33 #include "../subscription/Subscription.h" |
| 34 #include "../subscription/DownloadableSubscription.h" | 34 #include "../subscription/DownloadableSubscription.h" |
| 35 #include "../subscription/UserDefinedSubscription.h" | 35 #include "../subscription/UserDefinedSubscription.h" |
| 36 #include "../storage/FilterStorage.h" | 36 #include "../storage/FilterStorage.h" |
| 37 #include "../ElemHide.h" |
| 38 #include "../ElemHideEmulation.h" |
| 37 #include "../FilterNotifier.h" | 39 #include "../FilterNotifier.h" |
| 38 | 40 |
| 39 ABP_NS_USING | 41 ABP_NS_USING |
| 40 | 42 |
| 41 int main() | 43 int main() |
| 42 { | 44 { |
| 43 try | 45 try |
| 44 { | 46 { |
| 45 class_<Filter>("Filter") | 47 class_<Filter>("Filter") |
| 46 .property("text", &Filter::GetText) | 48 .property("text", &Filter::GetText) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 69 .property("lastHit", &ActiveFilter::GetLastHit, &ActiveFilter::SetLastHi
t) | 71 .property("lastHit", &ActiveFilter::GetLastHit, &ActiveFilter::SetLastHi
t) |
| 70 .function("isActiveOnDomain", &ActiveFilter::IsActiveOnDomain) | 72 .function("isActiveOnDomain", &ActiveFilter::IsActiveOnDomain) |
| 71 .function("isActiveOnlyOnDomain", &ActiveFilter::IsActiveOnlyOnDomain) | 73 .function("isActiveOnlyOnDomain", &ActiveFilter::IsActiveOnlyOnDomain) |
| 72 .function("isGeneric", &ActiveFilter::IsGeneric) | 74 .function("isGeneric", &ActiveFilter::IsGeneric) |
| 73 .function("serialize", &ActiveFilter::Serialize); | 75 .function("serialize", &ActiveFilter::Serialize); |
| 74 | 76 |
| 75 class_<RegExpFilter,ActiveFilter>("RegExpFilter") | 77 class_<RegExpFilter,ActiveFilter>("RegExpFilter") |
| 76 .function("matches", &RegExpFilter::Matches); | 78 .function("matches", &RegExpFilter::Matches); |
| 77 | 79 |
| 78 class_<BlockingFilter,RegExpFilter>("BlockingFilter") | 80 class_<BlockingFilter,RegExpFilter>("BlockingFilter") |
| 79 .class_property("type", "'blocking'"); | 81 .class_property("type", "'blocking'") |
| 82 .property("collapse", &BlockingFilter::GetCollapse); |
| 83 |
| 80 | 84 |
| 81 class_<WhitelistFilter,RegExpFilter>("WhitelistFilter") | 85 class_<WhitelistFilter,RegExpFilter>("WhitelistFilter") |
| 82 .class_property("type", "'whitelist'"); | 86 .class_property("type", "'whitelist'"); |
| 83 | 87 |
| 84 class_<ElemHideBase,ActiveFilter>("ElemHideBase") | 88 class_<ElemHideBase,ActiveFilter>("ElemHideBase") |
| 85 .property("selector", &ElemHideBase::GetSelector) | 89 .property("selector", &ElemHideBase::GetSelector) |
| 86 .property("selectorDomain", &ElemHideBase::GetSelectorDomain); | 90 .property("selectorDomain", &ElemHideBase::GetSelectorDomain); |
| 87 | 91 |
| 88 class_<ElemHideFilter,ElemHideBase>("ElemHideFilter") | 92 class_<ElemHideFilter,ElemHideBase>("ElemHideFilter") |
| 89 .class_property("type", "'elemhide'"); | 93 .class_property("type", "'elemhide'"); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 139 |
| 136 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance) | 140 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance) |
| 137 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount) | 141 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount) |
| 138 .function("subscriptionAt", &FilterStorage::SubscriptionAt) | 142 .function("subscriptionAt", &FilterStorage::SubscriptionAt) |
| 139 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription) | 143 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription) |
| 140 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor
Filter) | 144 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor
Filter) |
| 141 .function("addSubscription", &FilterStorage::AddSubscription) | 145 .function("addSubscription", &FilterStorage::AddSubscription) |
| 142 .function("removeSubscription", &FilterStorage::RemoveSubscription) | 146 .function("removeSubscription", &FilterStorage::RemoveSubscription) |
| 143 .function("moveSubscription", &FilterStorage::MoveSubscription); | 147 .function("moveSubscription", &FilterStorage::MoveSubscription); |
| 144 | 148 |
| 149 class_<ElemHide_SelectorList>("ElemHide_SelectorList") |
| 150 .property("selectorCount", &ElemHide_SelectorList::GetSelectorCount) |
| 151 .function("selectorAt", &ElemHide_SelectorList::SelectorAt) |
| 152 .function("filterKeyAt", &ElemHide_SelectorList::FilterKeyAt); |
| 153 |
| 154 class_<ElemHide>("ElemHide") |
| 155 .class_function("create", &ElemHide::Create) |
| 156 .function("add", &ElemHide::Add) |
| 157 .function("remove", &ElemHide::Remove) |
| 158 .function("clear", &ElemHide::Clear) |
| 159 .function("getSelectorsForDomain", &ElemHide::GetSelectorsForDomain) |
| 160 .function("getUnconditionalSelectors", &ElemHide::GetUnconditionalSelect
ors); |
| 161 |
| 162 class_<ElemHideEmulation_FilterList>("ElemHideEmulation_FilterList") |
| 163 .property("filterCount", &ElemHideEmulation_FilterList::GetFilterCount) |
| 164 .function("filterAt", &ElemHideEmulation_FilterList::FilterAt); |
| 165 |
| 166 class_<ElemHideEmulation>("ElemHideEmulation") |
| 167 .class_function("create", &ElemHideEmulation::Create) |
| 168 .function("add", &ElemHideEmulation::Add) |
| 169 .function("remove", &ElemHideEmulation::Remove) |
| 170 .function("clear", &ElemHideEmulation::Clear) |
| 171 .function("getRulesForDomain", &ElemHideEmulation::GetRulesForDomain); |
| 172 |
| 145 printBindings(); | 173 printBindings(); |
| 146 RegExpFilter::GenerateCustomBindings(); | 174 RegExpFilter::GenerateCustomBindings(); |
| 147 FilterNotifier::GenerateCustomBindings(); | 175 FilterNotifier::GenerateCustomBindings(); |
| 148 | 176 |
| 149 return 0; | 177 return 0; |
| 150 } | 178 } |
| 151 catch (const std::exception& e) | 179 catch (const std::exception& e) |
| 152 { | 180 { |
| 153 EM_ASM_ARGS( | 181 EM_ASM_ARGS( |
| 154 console.error("Error occurred generating JavaScript bindings: " + | 182 console.error("Error occurred generating JavaScript bindings: " + |
| 155 Module.AsciiToString($0)), e.what() | 183 Module.AsciiToString($0)), e.what() |
| 156 ); | 184 ); |
| 157 return 1; | 185 return 1; |
| 158 } | 186 } |
| 159 } | 187 } |
| LEFT | RIGHT |