LEFT | RIGHT |
(no file at all) | |
| 1 #include "bindings.ipp" |
| 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 .subclass_differentiator(&Filter::mType, { |
| 21 {Filter::Type::INVALID, "InvalidFilter"}, |
| 22 {Filter::Type::COMMENT, "CommentFilter"}, |
| 23 {Filter::Type::BLOCKING, "BlockingFilter"}, |
| 24 {Filter::Type::WHITELIST, "WhitelistFilter"}, |
| 25 {Filter::Type::ELEMHIDE, "ElemHideFilter"}, |
| 26 {Filter::Type::ELEMHIDEEXCEPTION, "ElemHideException"}, |
| 27 {Filter::Type::CSSPROPERTY, "CSSPropertyFilter"}, |
| 28 }); |
| 29 |
| 30 class_<InvalidFilter,Filter>("InvalidFilter") |
| 31 .class_property("type", "'invalid'") |
| 32 .property("reason", &InvalidFilter::GetReason); |
| 33 |
| 34 class_<CommentFilter,Filter>("CommentFilter") |
| 35 .class_property("type", "'comment'"); |
| 36 |
| 37 class_<ActiveFilter,Filter>("ActiveFilter") |
| 38 .property("disabled", &ActiveFilter::GetDisabled, &ActiveFilter::SetDisabl
ed) |
| 39 .property("hitCount", &ActiveFilter::GetHitCount, &ActiveFilter::SetHitCou
nt) |
| 40 .property("lastHit", &ActiveFilter::GetLastHit, &ActiveFilter::SetLastHit) |
| 41 .function("isActiveOnDomain", &ActiveFilter::IsActiveOnDomain) |
| 42 .function("isActiveOnlyOnDomain", &ActiveFilter::IsActiveOnlyOnDomain) |
| 43 .function("isGeneric", &ActiveFilter::IsGeneric) |
| 44 .function("serialize", &ActiveFilter::Serialize); |
| 45 |
| 46 class_<RegExpFilter,ActiveFilter>("RegExpFilter") |
| 47 .function("matches", &RegExpFilter::Matches) |
| 48 .class_initializer(&RegExpFilter::InitJSTypes); |
| 49 |
| 50 class_<BlockingFilter,RegExpFilter>("BlockingFilter") |
| 51 .class_property("type", "'blocking'"); |
| 52 |
| 53 class_<WhitelistFilter,RegExpFilter>("WhitelistFilter") |
| 54 .class_property("type", "'whitelist'"); |
| 55 |
| 56 class_<ElemHideBase,ActiveFilter>("ElemHideBase") |
| 57 .property("selector", &ElemHideBase::GetSelector) |
| 58 .property("selectorDomain", &ElemHideBase::GetSelectorDomain); |
| 59 |
| 60 class_<ElemHideFilter,ElemHideBase>("ElemHideFilter") |
| 61 .class_property("type", "'elemhide'"); |
| 62 |
| 63 class_<ElemHideException,ElemHideBase>("ElemHideException") |
| 64 .class_property("type", "'elemhideexception'"); |
| 65 |
| 66 class_<CSSPropertyFilter,ElemHideBase>("CSSPropertyFilter") |
| 67 .class_property("type", "'cssproperty'") |
| 68 .property("regexpString", &CSSPropertyFilter::GetRegExpString) |
| 69 .property("selectorPrefix", &CSSPropertyFilter::GetSelectorPrefix) |
| 70 .property("selectorSuffix", &CSSPropertyFilter::GetSelectorSuffix); |
| 71 } |
LEFT | RIGHT |