| OLD | NEW |
| 1 #ifndef _PLUGIN_FILTER_H_ | 1 #ifndef _PLUGIN_FILTER_H_ |
| 2 #define _PLUGIN_FILTER_H_ | 2 #define _PLUGIN_FILTER_H_ |
| 3 | 3 |
| 4 | 4 |
| 5 #include "PluginTypedef.h" | 5 #include "PluginTypedef.h" |
| 6 #include <memory> | 6 #include <memory> |
| 7 | 7 |
| 8 enum CFilterElementHideAttrPos | 8 enum CFilterElementHideAttrPos |
| 9 { | 9 { |
| 10 POS_NONE = 0, STARTING, ENDING, ANYWHERE, EXACT | 10 POS_NONE = 0, STARTING, ENDING, ANYWHERE, EXACT |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 enum EFilterType | 102 enum EFilterType |
| 103 { | 103 { |
| 104 filterTypeBlocking = 0, | 104 filterTypeBlocking = 0, |
| 105 filterTypeWhiteList = 1, | 105 filterTypeWhiteList = 1, |
| 106 filterTypeElementHide = 2, | 106 filterTypeElementHide = 2, |
| 107 filterTypeUnknown = 3 | 107 filterTypeUnknown = 3 |
| 108 } filterType; | 108 } filterType; |
| 109 | 109 |
| 110 int m_contentType; | 110 int m_contentType; |
| 111 enum EFilterType m_filterType; | 111 enum EFilterType m_filterType; |
| 112 std::vector<CString> m_stringElements; | |
| 113 bool m_isMatchCase; | 112 bool m_isMatchCase; |
| 114 bool m_isFirstParty; | 113 bool m_isFirstParty; |
| 115 bool m_isThirdParty; | 114 bool m_isThirdParty; |
| 116 bool m_isFromStart; | 115 bool m_isFromStart; |
| 117 bool m_isFromEnd; | 116 bool m_isFromEnd; |
| 118 int m_hitCount; | 117 int m_hitCount; |
| 119 CString m_filterText; | 118 CString m_filterText; |
| 120 | 119 |
| 121 CFilter(const CFilter&); | 120 CFilter(const CFilter&); |
| 122 CFilter(); | 121 CFilter(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 147 | 146 |
| 148 TFilterElementHideTagsNamed m_elementHideTagsId; | 147 TFilterElementHideTagsNamed m_elementHideTagsId; |
| 149 TFilterElementHideTagsNamed m_elementHideTagsClass; | 148 TFilterElementHideTagsNamed m_elementHideTagsClass; |
| 150 TFilterElementHideTags m_elementHideTags; | 149 TFilterElementHideTags m_elementHideTags; |
| 151 | 150 |
| 152 TFilterMap m_filterMap[2][2]; | 151 TFilterMap m_filterMap[2][2]; |
| 153 TFilterMapDefault m_filterMapDefault[2]; | 152 TFilterMapDefault m_filterMapDefault[2]; |
| 154 | 153 |
| 155 void ClearFilters(); | 154 void ClearFilters(); |
| 156 | 155 |
| 157 int FindMatch(const CString& src, CString filterPart, int startPos=0) const; | |
| 158 bool IsSpecialChar(TCHAR testChar) const; | |
| 159 bool IsSubdomain(const CString& subdomain, const CString& domain) const; | |
| 160 | |
| 161 public: | 156 public: |
| 162 | 157 |
| 163 CPluginFilter(const CString& dataPath = ""); | 158 CPluginFilter(const CString& dataPath = ""); |
| 164 | 159 |
| 165 bool LoadHideFilters(std::vector<std::wstring> filters); | 160 bool LoadHideFilters(std::vector<std::wstring> filters); |
| 166 | 161 |
| 167 bool AddFilterElementHide(CString filter); | 162 bool AddFilterElementHide(CString filter); |
| 168 | 163 |
| 169 | 164 |
| 170 bool IsElementHidden(const CString& tag, IHTMLElement* pEl, const CString& dom
ain, const CString& indent) const; | 165 bool IsElementHidden(const CString& tag, IHTMLElement* pEl, const CString& dom
ain, const CString& indent) const; |
| 171 | 166 |
| 172 | 167 |
| 173 bool ShouldBlock(CString src, int contentType, const CString& domain, bool add
Debug=false) const; | 168 bool ShouldBlock(CString src, int contentType, const CString& domain, bool add
Debug=false) const; |
| 174 | 169 |
| 175 HANDLE hideFiltersLoadedEvent; | 170 HANDLE hideFiltersLoadedEvent; |
| 176 }; | 171 }; |
| 177 | 172 |
| 178 | 173 |
| 179 #endif // _PLUGIN_FILTER_H_ | 174 #endif // _PLUGIN_FILTER_H_ |
| OLD | NEW |