Documentation/Source/eric5.Helpviewer.AdBlock.AdBlockRule.html

changeset 1960
d8c45fe8a1b9
parent 1229
a8207dc73672
child 1963
9c5b3235abf9
equal deleted inserted replaced
1957:2fed7bc4ad83 1960:d8c45fe8a1b9
35 <td>Class implementing the AdBlock rule.</td> 35 <td>Class implementing the AdBlock rule.</td>
36 </tr> 36 </tr>
37 </table> 37 </table>
38 <h3>Functions</h3> 38 <h3>Functions</h3>
39 <table> 39 <table>
40 <tr><td>None</td></tr> 40 <tr>
41 <td><a href="#toSecondLevelDomain">toSecondLevelDomain</a></td>
42 <td>Module function to get a second level domain from the given URL.</td>
43 </tr>
41 </table> 44 </table>
42 <hr /><hr /> 45 <hr /><hr />
43 <a NAME="AdBlockRule" ID="AdBlockRule"></a> 46 <a NAME="AdBlockRule" ID="AdBlockRule"></a>
44 <h2>AdBlockRule</h2> 47 <h2>AdBlockRule</h2>
45 <p> 48 <p>
62 <td>Constructor</td> 65 <td>Constructor</td>
63 </tr><tr> 66 </tr><tr>
64 <td><a href="#AdBlockRule.__convertPatternToRegExp">__convertPatternToRegExp</a></td> 67 <td><a href="#AdBlockRule.__convertPatternToRegExp">__convertPatternToRegExp</a></td>
65 <td>Private method to convert a wildcard pattern to a regular expression.</td> 68 <td>Private method to convert a wildcard pattern to a regular expression.</td>
66 </tr><tr> 69 </tr><tr>
70 <td><a href="#AdBlockRule.__parseDomains">__parseDomains</a></td>
71 <td>Private method to parse a string with a domain list.</td>
72 </tr><tr>
73 <td><a href="#AdBlockRule.__parseFilter">__parseFilter</a></td>
74 <td>Private method to parse the filter pattern.</td>
75 </tr><tr>
76 <td><a href="#AdBlockRule.cssSelector">cssSelector</a></td>
77 <td>Public method to get the CSS selector of the rule.</td>
78 </tr><tr>
67 <td><a href="#AdBlockRule.filter">filter</a></td> 79 <td><a href="#AdBlockRule.filter">filter</a></td>
68 <td>Public method to get the rule filter string.</td> 80 <td>Public method to get the rule filter string.</td>
69 </tr><tr> 81 </tr><tr>
70 <td><a href="#AdBlockRule.isCSSRule">isCSSRule</a></td> 82 <td><a href="#AdBlockRule.isCSSRule">isCSSRule</a></td>
71 <td>Public method to check, if the rule is a CSS rule.</td> 83 <td>Public method to check, if the rule is a CSS rule.</td>
72 </tr><tr> 84 </tr><tr>
85 <td><a href="#AdBlockRule.isComment">isComment</a></td>
86 <td>Public method to check, if this is a comment.</td>
87 </tr><tr>
88 <td><a href="#AdBlockRule.isDocument">isDocument</a></td>
89 <td>Public method to check, if this is a document rule.</td>
90 </tr><tr>
91 <td><a href="#AdBlockRule.isDomainRestricted">isDomainRestricted</a></td>
92 <td>Public method to check, if this rule is restricted by domain.</td>
93 </tr><tr>
94 <td><a href="#AdBlockRule.isElementHiding">isElementHiding</a></td>
95 <td>Public method to check, if this is an element hiding rule.</td>
96 </tr><tr>
73 <td><a href="#AdBlockRule.isEnabled">isEnabled</a></td> 97 <td><a href="#AdBlockRule.isEnabled">isEnabled</a></td>
74 <td>Public method to check, if the rule is enabled.</td> 98 <td>Public method to check, if the rule is enabled.</td>
75 </tr><tr> 99 </tr><tr>
76 <td><a href="#AdBlockRule.isException">isException</a></td> 100 <td><a href="#AdBlockRule.isException">isException</a></td>
77 <td>Public method to check, if the rule defines an exception.</td> 101 <td>Public method to check, if the rule defines an exception.</td>
78 </tr><tr> 102 </tr><tr>
103 <td><a href="#AdBlockRule.isInternalDisabled">isInternalDisabled</a></td>
104 <td>Public method to check, if this rule was disabled internally.</td>
105 </tr><tr>
106 <td><a href="#AdBlockRule.isSlow">isSlow</a></td>
107 <td>Public method to check, if this is a slow rule.</td>
108 </tr><tr>
109 <td><a href="#AdBlockRule.matchDomain">matchDomain</a></td>
110 <td>Public method to match a domain.</td>
111 </tr><tr>
112 <td><a href="#AdBlockRule.matchObject">matchObject</a></td>
113 <td>Public slot to match an object rule.</td>
114 </tr><tr>
115 <td><a href="#AdBlockRule.matchSubdocument">matchSubdocument</a></td>
116 <td>Public slot to match a sub-document rule.</td>
117 </tr><tr>
118 <td><a href="#AdBlockRule.matchThirdParty">matchThirdParty</a></td>
119 <td>Public slot to match a third-party rule.</td>
120 </tr><tr>
121 <td><a href="#AdBlockRule.matchXmlHttpRequest">matchXmlHttpRequest</a></td>
122 <td>Public slot to match a XmlHttpRequest rule.</td>
123 </tr><tr>
79 <td><a href="#AdBlockRule.networkMatch">networkMatch</a></td> 124 <td><a href="#AdBlockRule.networkMatch">networkMatch</a></td>
80 <td>Public method to check the rule for a match.</td> 125 <td>Public method to check the rule for a match.</td>
81 </tr><tr> 126 </tr><tr>
82 <td><a href="#AdBlockRule.regExpPattern">regExpPattern</a></td>
83 <td>Public method to get the regexp pattern of the rule.</td>
84 </tr><tr>
85 <td><a href="#AdBlockRule.setEnabled">setEnabled</a></td> 127 <td><a href="#AdBlockRule.setEnabled">setEnabled</a></td>
86 <td>Public method to set the rule's enabled state.</td> 128 <td>Public method to set the rule's enabled state.</td>
87 </tr><tr> 129 </tr><tr>
88 <td><a href="#AdBlockRule.setException">setException</a></td> 130 <td><a href="#AdBlockRule.setException">setException</a></td>
89 <td>Public method to set the rule's exception flag.</td> 131 <td>Public method to set the rule's exception flag.</td>
90 </tr><tr> 132 </tr><tr>
91 <td><a href="#AdBlockRule.setFilter">setFilter</a></td> 133 <td><a href="#AdBlockRule.setFilter">setFilter</a></td>
92 <td>Public method to set the rule filter string.</td> 134 <td>Public method to set the rule filter string.</td>
93 </tr><tr> 135 </tr><tr>
94 <td><a href="#AdBlockRule.setPattern">setPattern</a></td> 136 <td><a href="#AdBlockRule.urlMatch">urlMatch</a></td>
95 <td>Public method to set the rule pattern.</td> 137 <td>Public method to check an URL against the rule.</td>
96 </tr> 138 </tr>
97 </table> 139 </table>
98 <h3>Static Methods</h3> 140 <h3>Static Methods</h3>
99 <table> 141 <table>
100 <tr><td>None</td></tr> 142 <tr><td>None</td></tr>
117 </dl><dl> 159 </dl><dl>
118 <dt>Returns:</dt> 160 <dt>Returns:</dt>
119 <dd> 161 <dd>
120 string containing a regular expression (string) 162 string containing a regular expression (string)
121 </dd> 163 </dd>
164 </dl><a NAME="AdBlockRule.__parseDomains" ID="AdBlockRule.__parseDomains"></a>
165 <h4>AdBlockRule.__parseDomains</h4>
166 <b>__parseDomains</b>(<i>domains, separator</i>)
167 <p>
168 Private method to parse a string with a domain list.
169 </p><dl>
170 <dt><i>domains</i></dt>
171 <dd>
172 list of domains (string)
173 </dd><dt><i>separator</i></dt>
174 <dd>
175 separator character used by the list (string)
176 </dd>
177 </dl><a NAME="AdBlockRule.__parseFilter" ID="AdBlockRule.__parseFilter"></a>
178 <h4>AdBlockRule.__parseFilter</h4>
179 <b>__parseFilter</b>(<i></i>)
180 <p>
181 Private method to parse the filter pattern.
182 </p><a NAME="AdBlockRule.cssSelector" ID="AdBlockRule.cssSelector"></a>
183 <h4>AdBlockRule.cssSelector</h4>
184 <b>cssSelector</b>(<i></i>)
185 <p>
186 Public method to get the CSS selector of the rule.
187 </p><dl>
188 <dt>Returns:</dt>
189 <dd>
190 CSS selector (string)
191 </dd>
122 </dl><a NAME="AdBlockRule.filter" ID="AdBlockRule.filter"></a> 192 </dl><a NAME="AdBlockRule.filter" ID="AdBlockRule.filter"></a>
123 <h4>AdBlockRule.filter</h4> 193 <h4>AdBlockRule.filter</h4>
124 <b>filter</b>(<i></i>) 194 <b>filter</b>(<i></i>)
125 <p> 195 <p>
126 Public method to get the rule filter string. 196 Public method to get the rule filter string.
137 </p><dl> 207 </p><dl>
138 <dt>Returns:</dt> 208 <dt>Returns:</dt>
139 <dd> 209 <dd>
140 flag indicating a CSS rule (boolean) 210 flag indicating a CSS rule (boolean)
141 </dd> 211 </dd>
212 </dl><a NAME="AdBlockRule.isComment" ID="AdBlockRule.isComment"></a>
213 <h4>AdBlockRule.isComment</h4>
214 <b>isComment</b>(<i></i>)
215 <p>
216 Public method to check, if this is a comment.
217 </p><dl>
218 <dt>Returns:</dt>
219 <dd>
220 flag indicating a comment (boolean)
221 </dd>
222 </dl><a NAME="AdBlockRule.isDocument" ID="AdBlockRule.isDocument"></a>
223 <h4>AdBlockRule.isDocument</h4>
224 <b>isDocument</b>(<i></i>)
225 <p>
226 Public method to check, if this is a document rule.
227 </p><dl>
228 <dt>Returns:</dt>
229 <dd>
230 flag indicating a document rule (boolean)
231 </dd>
232 </dl><a NAME="AdBlockRule.isDomainRestricted" ID="AdBlockRule.isDomainRestricted"></a>
233 <h4>AdBlockRule.isDomainRestricted</h4>
234 <b>isDomainRestricted</b>(<i></i>)
235 <p>
236 Public method to check, if this rule is restricted by domain.
237 </p><dl>
238 <dt>Returns:</dt>
239 <dd>
240 flag indicating a domain restriction (boolean)
241 </dd>
242 </dl><a NAME="AdBlockRule.isElementHiding" ID="AdBlockRule.isElementHiding"></a>
243 <h4>AdBlockRule.isElementHiding</h4>
244 <b>isElementHiding</b>(<i></i>)
245 <p>
246 Public method to check, if this is an element hiding rule.
247 </p><dl>
248 <dt>Returns:</dt>
249 <dd>
250 flag indicating an element hiding rule (boolean)
251 </dd>
142 </dl><a NAME="AdBlockRule.isEnabled" ID="AdBlockRule.isEnabled"></a> 252 </dl><a NAME="AdBlockRule.isEnabled" ID="AdBlockRule.isEnabled"></a>
143 <h4>AdBlockRule.isEnabled</h4> 253 <h4>AdBlockRule.isEnabled</h4>
144 <b>isEnabled</b>(<i></i>) 254 <b>isEnabled</b>(<i></i>)
145 <p> 255 <p>
146 Public method to check, if the rule is enabled. 256 Public method to check, if the rule is enabled.
157 </p><dl> 267 </p><dl>
158 <dt>Returns:</dt> 268 <dt>Returns:</dt>
159 <dd> 269 <dd>
160 flag indicating an exception (boolean) 270 flag indicating an exception (boolean)
161 </dd> 271 </dd>
272 </dl><a NAME="AdBlockRule.isInternalDisabled" ID="AdBlockRule.isInternalDisabled"></a>
273 <h4>AdBlockRule.isInternalDisabled</h4>
274 <b>isInternalDisabled</b>(<i></i>)
275 <p>
276 Public method to check, if this rule was disabled internally.
277 </p><dl>
278 <dt>Returns:</dt>
279 <dd>
280 flag indicating an internally disabled rule (boolean)
281 </dd>
282 </dl><a NAME="AdBlockRule.isSlow" ID="AdBlockRule.isSlow"></a>
283 <h4>AdBlockRule.isSlow</h4>
284 <b>isSlow</b>(<i></i>)
285 <p>
286 Public method to check, if this is a slow rule.
287 </p><dl>
288 <dt>Returns:</dt>
289 <dd>
290 flag indicating a slow rule (boolean)
291 </dd>
292 </dl><a NAME="AdBlockRule.matchDomain" ID="AdBlockRule.matchDomain"></a>
293 <h4>AdBlockRule.matchDomain</h4>
294 <b>matchDomain</b>(<i>domain</i>)
295 <p>
296 Public method to match a domain.
297 </p><dl>
298 <dt><i>domain</i></dt>
299 <dd>
300 domain name to check (string)
301 </dd>
302 </dl><dl>
303 <dt>Returns:</dt>
304 <dd>
305 flag indicating a match (boolean)
306 </dd>
307 </dl><a NAME="AdBlockRule.matchObject" ID="AdBlockRule.matchObject"></a>
308 <h4>AdBlockRule.matchObject</h4>
309 <b>matchObject</b>(<i>req</i>)
310 <p>
311 Public slot to match an object rule.
312 </p><dl>
313 <dt><i>req</i></dt>
314 <dd>
315 request object to check (QNetworkRequest)
316 </dd>
317 </dl><dl>
318 <dt>Returns:</dt>
319 <dd>
320 flag indicating a match (boolean)
321 </dd>
322 </dl><a NAME="AdBlockRule.matchSubdocument" ID="AdBlockRule.matchSubdocument"></a>
323 <h4>AdBlockRule.matchSubdocument</h4>
324 <b>matchSubdocument</b>(<i>req</i>)
325 <p>
326 Public slot to match a sub-document rule.
327 </p><dl>
328 <dt><i>req</i></dt>
329 <dd>
330 request object to check (QNetworkRequest)
331 </dd>
332 </dl><dl>
333 <dt>Returns:</dt>
334 <dd>
335 flag indicating a match (boolean)
336 </dd>
337 </dl><a NAME="AdBlockRule.matchThirdParty" ID="AdBlockRule.matchThirdParty"></a>
338 <h4>AdBlockRule.matchThirdParty</h4>
339 <b>matchThirdParty</b>(<i>req</i>)
340 <p>
341 Public slot to match a third-party rule.
342 </p><dl>
343 <dt><i>req</i></dt>
344 <dd>
345 request object to check (QNetworkRequest)
346 </dd>
347 </dl><dl>
348 <dt>Returns:</dt>
349 <dd>
350 flag indicating a match (boolean)
351 </dd>
352 </dl><a NAME="AdBlockRule.matchXmlHttpRequest" ID="AdBlockRule.matchXmlHttpRequest"></a>
353 <h4>AdBlockRule.matchXmlHttpRequest</h4>
354 <b>matchXmlHttpRequest</b>(<i>req</i>)
355 <p>
356 Public slot to match a XmlHttpRequest rule.
357 </p><dl>
358 <dt><i>req</i></dt>
359 <dd>
360 request object to check (QNetworkRequest)
361 </dd>
362 </dl><dl>
363 <dt>Returns:</dt>
364 <dd>
365 flag indicating a match (boolean)
366 </dd>
162 </dl><a NAME="AdBlockRule.networkMatch" ID="AdBlockRule.networkMatch"></a> 367 </dl><a NAME="AdBlockRule.networkMatch" ID="AdBlockRule.networkMatch"></a>
163 <h4>AdBlockRule.networkMatch</h4> 368 <h4>AdBlockRule.networkMatch</h4>
164 <b>networkMatch</b>(<i>encodedUrl</i>) 369 <b>networkMatch</b>(<i>request, domain, encodedUrl</i>)
165 <p> 370 <p>
166 Public method to check the rule for a match. 371 Public method to check the rule for a match.
167 </p><dl> 372 </p><dl>
168 <dt><i>encodedUrl</i></dt> 373 <dt><i>request</i></dt>
374 <dd>
375 reference to the network request (QNetworkRequest)
376 </dd><dt><i>domain</i></dt>
377 <dd>
378 domain name (string)
379 </dd><dt><i>encodedUrl</i></dt>
169 <dd> 380 <dd>
170 string encoded URL to be checked (string) 381 string encoded URL to be checked (string)
171 </dd> 382 </dd>
172 </dl><dl> 383 </dl><dl>
173 <dt>Returns:</dt> 384 <dt>Returns:</dt>
174 <dd> 385 <dd>
175 flag indicating a match (boolean) 386 flag indicating a match (boolean)
176 </dd>
177 </dl><a NAME="AdBlockRule.regExpPattern" ID="AdBlockRule.regExpPattern"></a>
178 <h4>AdBlockRule.regExpPattern</h4>
179 <b>regExpPattern</b>(<i></i>)
180 <p>
181 Public method to get the regexp pattern of the rule.
182 </p><dl>
183 <dt>Returns:</dt>
184 <dd>
185 regexp pattern (QRegExp)
186 </dd> 387 </dd>
187 </dl><a NAME="AdBlockRule.setEnabled" ID="AdBlockRule.setEnabled"></a> 388 </dl><a NAME="AdBlockRule.setEnabled" ID="AdBlockRule.setEnabled"></a>
188 <h4>AdBlockRule.setEnabled</h4> 389 <h4>AdBlockRule.setEnabled</h4>
189 <b>setEnabled</b>(<i>enabled</i>) 390 <b>setEnabled</b>(<i>enabled</i>)
190 <p> 391 <p>
212 </p><dl> 413 </p><dl>
213 <dt><i>filter</i></dt> 414 <dt><i>filter</i></dt>
214 <dd> 415 <dd>
215 rule filter string (string) 416 rule filter string (string)
216 </dd> 417 </dd>
217 </dl><a NAME="AdBlockRule.setPattern" ID="AdBlockRule.setPattern"></a> 418 </dl><a NAME="AdBlockRule.urlMatch" ID="AdBlockRule.urlMatch"></a>
218 <h4>AdBlockRule.setPattern</h4> 419 <h4>AdBlockRule.urlMatch</h4>
219 <b>setPattern</b>(<i>pattern, isRegExp</i>) 420 <b>urlMatch</b>(<i>url</i>)
220 <p> 421 <p>
221 Public method to set the rule pattern. 422 Public method to check an URL against the rule.
222 </p><dl> 423 </p><dl>
223 <dt><i>pattern</i></dt> 424 <dt><i>url</i></dt>
224 <dd> 425 <dd>
225 string containing the pattern (string) 426 URL to check (QUrl)
226 </dd><dt><i>isRegExp</i></dt> 427 </dd>
227 <dd> 428 </dl><dl>
228 flag indicating a reg exp pattern (boolean) 429 <dt>Returns:</dt>
430 <dd>
431 flag indicating a match (boolean)
432 </dd>
433 </dl>
434 <div align="right"><a href="#top">Up</a></div>
435 <hr /><hr />
436 <a NAME="toSecondLevelDomain" ID="toSecondLevelDomain"></a>
437 <h2>toSecondLevelDomain</h2>
438 <b>toSecondLevelDomain</b>(<i>url</i>)
439 <p>
440 Module function to get a second level domain from the given URL.
441 </p><dl>
442 <dt><i>url</i></dt>
443 <dd>
444 URL to extract domain from (QUrl)
445 </dd>
446 </dl><dl>
447 <dt>Returns:</dt>
448 <dd>
449 name of second level domain (string)
229 </dd> 450 </dd>
230 </dl> 451 </dl>
231 <div align="right"><a href="#top">Up</a></div> 452 <div align="right"><a href="#top">Up</a></div>
232 <hr /> 453 <hr />
233 </body></html> 454 </body></html>

eric ide

mercurial