OLD | NEW |
(Empty) | |
| 1 #include "bindings.h" |
| 2 #include "Filter.h" |
| 3 #include "InvalidFilter.h" |
| 4 #include "CommentFilter.h" |
| 5 #include "ActiveFilter.h" |
| 6 #include "RegExpFilter.h" |
| 7 #include "BlockingFilter.h" |
| 8 #include "WhitelistFilter.h" |
| 9 #include "ElemHideBase.h" |
| 10 #include "ElemHideFilter.h" |
| 11 #include "ElemHideException.h" |
| 12 #include "CSSPropertyFilter.h" |
| 13 |
| 14 EMSCRIPTEN_BINDINGS |
| 15 { |
| 16 class_<Filter>("Filter") |
| 17 .property("text", &Filter::GetText) |
| 18 .function("serialize", &Filter::Serialize) |
| 19 .class_function("fromText", &Filter::FromText) |
| 20 .class_function("getKnownFilter", &Filter::GetKnownFilter) |
| 21 .subclass_differentiator(&Filter::GetType, { |
| 22 {Filter::Type::INVALID, "InvalidFilter"}, |
| 23 {Filter::Type::COMMENT, "CommentFilter"}, |
| 24 {Filter::Type::BLOCKING, "BlockingFilter"}, |
| 25 {Filter::Type::WHITELIST, "WhitelistFilter"}, |
| 26 {Filter::Type::ELEMHIDE, "ElemHideFilter"}, |
| 27 {Filter::Type::ELEMHIDEEXCEPTION, "ElemHideException"}, |
| 28 {Filter::Type::CSSPROPERTY, "CSSPropertyFilter"}, |
| 29 }); |
| 30 |
| 31 class_<InvalidFilter,Filter>("InvalidFilter") |
| 32 .class_property("type", "'invalid'") |
| 33 .property("reason", &InvalidFilter::GetReason); |
| 34 |
| 35 class_<CommentFilter,Filter>("CommentFilter") |
| 36 .class_property("type", "'comment'"); |
| 37 |
| 38 class_<ActiveFilter,Filter>("ActiveFilter") |
| 39 .property("disabled", &ActiveFilter::GetDisabled, &ActiveFilter::SetDisabl
ed) |
| 40 .property("hitCount", &ActiveFilter::GetHitCount, &ActiveFilter::SetHitCou
nt) |
| 41 .property("lastHit", &ActiveFilter::GetLastHit, &ActiveFilter::SetLastHit) |
| 42 .function("isActiveOnDomain", &ActiveFilter::IsActiveOnDomain) |
| 43 .function("isActiveOnlyOnDomain", &ActiveFilter::IsActiveOnlyOnDomain) |
| 44 .function("isGeneric", &ActiveFilter::IsGeneric) |
| 45 .function("serialize", &ActiveFilter::Serialize); |
| 46 |
| 47 class_<RegExpFilter,ActiveFilter>("RegExpFilter") |
| 48 .function("matches", &RegExpFilter::Matches) |
| 49 .class_initializer(&RegExpFilter::InitJSTypes); |
| 50 |
| 51 class_<BlockingFilter,RegExpFilter>("BlockingFilter") |
| 52 .class_property("type", "'blocking'"); |
| 53 |
| 54 class_<WhitelistFilter,RegExpFilter>("WhitelistFilter") |
| 55 .class_property("type", "'whitelist'"); |
| 56 |
| 57 class_<ElemHideBase,ActiveFilter>("ElemHideBase") |
| 58 .property("selector", &ElemHideBase::GetSelector) |
| 59 .property("selectorDomain", &ElemHideBase::GetSelectorDomain); |
| 60 |
| 61 class_<ElemHideFilter,ElemHideBase>("ElemHideFilter") |
| 62 .class_property("type", "'elemhide'"); |
| 63 |
| 64 class_<ElemHideException,ElemHideBase>("ElemHideException") |
| 65 .class_property("type", "'elemhideexception'"); |
| 66 |
| 67 class_<CSSPropertyFilter,ElemHideBase>("CSSPropertyFilter") |
| 68 .class_property("type", "'cssproperty'") |
| 69 .property("regexpString", &CSSPropertyFilter::GetRegExpString) |
| 70 .property("selectorPrefix", &CSSPropertyFilter::GetSelectorPrefix) |
| 71 .property("selectorSuffix", &CSSPropertyFilter::GetSelectorSuffix); |
| 72 } |
OLD | NEW |