eric6/Documentation/Source/eric6.WebBrowser.AdBlock.AdBlockRule.html

changeset 6942
2602857055c5
parent 6080
436ac20f7639
child 7273
391d6b7b1eff
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.WebBrowser.AdBlock.AdBlockRule</title>
4 <meta charset="UTF-8">
5 <style>
6 body {
7 background: #EDECE6;
8 margin: 0em 1em 10em 1em;
9 color: black;
10 }
11
12 h1 { color: white; background: #85774A; }
13 h2 { color: white; background: #85774A; }
14 h3 { color: white; background: #9D936E; }
15 h4 { color: white; background: #9D936E; }
16
17 a { color: #BA6D36; }
18
19 </style>
20 </head>
21 <body><a NAME="top" ID="top"></a>
22 <h1>eric6.WebBrowser.AdBlock.AdBlockRule</h1>
23 <p>
24 Module implementing the AdBlock rule class.
25 </p>
26 <h3>Global Attributes</h3>
27 <table>
28 <tr><td>None</td></tr>
29 </table>
30 <h3>Classes</h3>
31 <table>
32 <tr>
33 <td><a href="#AdBlockRule">AdBlockRule</a></td>
34 <td>Class implementing the AdBlock rule.</td>
35 </tr><tr>
36 <td><a href="#AdBlockRuleOption">AdBlockRuleOption</a></td>
37 <td>Class implementing the rule option enum.</td>
38 </tr><tr>
39 <td><a href="#AdBlockRuleType">AdBlockRuleType</a></td>
40 <td>Class implementing the rule type enum.</td>
41 </tr>
42 </table>
43 <h3>Functions</h3>
44 <table>
45 <tr>
46 <td><a href="#toSecondLevelDomain">toSecondLevelDomain</a></td>
47 <td>Module function to get a second level domain from the given URL.</td>
48 </tr>
49 </table>
50 <hr /><hr />
51 <a NAME="AdBlockRule" ID="AdBlockRule"></a>
52 <h2>AdBlockRule</h2>
53 <p>
54 Class implementing the AdBlock rule.
55 </p>
56 <h3>Derived from</h3>
57 object
58 <h3>Class Attributes</h3>
59 <table>
60 <tr><td>None</td></tr>
61 </table>
62 <h3>Class Methods</h3>
63 <table>
64 <tr><td>None</td></tr>
65 </table>
66 <h3>Methods</h3>
67 <table>
68 <tr>
69 <td><a href="#AdBlockRule.__init__">AdBlockRule</a></td>
70 <td>Constructor</td>
71 </tr><tr>
72 <td><a href="#AdBlockRule.__convertPatternToRegExp">__convertPatternToRegExp</a></td>
73 <td>Private method to convert a wildcard pattern to a regular expression.</td>
74 </tr><tr>
75 <td><a href="#AdBlockRule.__filterIsOnlyDomain">__filterIsOnlyDomain</a></td>
76 <td>Private method to check, if the given filter is a domain only filter.</td>
77 </tr><tr>
78 <td><a href="#AdBlockRule.__filterIsOnlyEndsMatch">__filterIsOnlyEndsMatch</a></td>
79 <td>Private method to check, if the given filter is to match against the end of a string.</td>
80 </tr><tr>
81 <td><a href="#AdBlockRule.__hasException">__hasException</a></td>
82 <td>Private method to check, if the given option has been set as an exception.</td>
83 </tr><tr>
84 <td><a href="#AdBlockRule.__hasOption">__hasOption</a></td>
85 <td>Private method to check, if the given option has been set.</td>
86 </tr><tr>
87 <td><a href="#AdBlockRule.__isMatchingDomain">__isMatchingDomain</a></td>
88 <td>Private method to check, if a given domain matches the given filter string.</td>
89 </tr><tr>
90 <td><a href="#AdBlockRule.__isMatchingRegExpStrings">__isMatchingRegExpStrings</a></td>
91 <td>Private method to check the given URL against the fixed parts of the regexp.</td>
92 </tr><tr>
93 <td><a href="#AdBlockRule.__parseDomains">__parseDomains</a></td>
94 <td>Private method to parse a string with a domain list.</td>
95 </tr><tr>
96 <td><a href="#AdBlockRule.__parseFilter">__parseFilter</a></td>
97 <td>Private method to parse the filter pattern.</td>
98 </tr><tr>
99 <td><a href="#AdBlockRule.__parseRegExpFilter">__parseRegExpFilter</a></td>
100 <td>Private method to split the given regular expression into strings that can be used with 'in'.</td>
101 </tr><tr>
102 <td><a href="#AdBlockRule.__setException">__setException</a></td>
103 <td>Private method to set the given option as an exception.</td>
104 </tr><tr>
105 <td><a href="#AdBlockRule.__stringMatch">__stringMatch</a></td>
106 <td>Private method to match a domain string.</td>
107 </tr><tr>
108 <td><a href="#AdBlockRule.addBlockedDomains">addBlockedDomains</a></td>
109 <td>Public method to add to the list of blocked domains.</td>
110 </tr><tr>
111 <td><a href="#AdBlockRule.allowedDomains">allowedDomains</a></td>
112 <td>Public method to get a copy of the list of allowed domains.</td>
113 </tr><tr>
114 <td><a href="#AdBlockRule.blockedDomains">blockedDomains</a></td>
115 <td>Public method to get a copy of the list of blocked domains.</td>
116 </tr><tr>
117 <td><a href="#AdBlockRule.caseSensitivity">caseSensitivity</a></td>
118 <td>Public method to get the case sensitivity.</td>
119 </tr><tr>
120 <td><a href="#AdBlockRule.copyFrom">copyFrom</a></td>
121 <td>Public method to copy another AdBlock rule.</td>
122 </tr><tr>
123 <td><a href="#AdBlockRule.cssSelector">cssSelector</a></td>
124 <td>Public method to get the CSS selector of the rule.</td>
125 </tr><tr>
126 <td><a href="#AdBlockRule.filter">filter</a></td>
127 <td>Public method to get the rule filter string.</td>
128 </tr><tr>
129 <td><a href="#AdBlockRule.getRegExpAndMatchers">getRegExpAndMatchers</a></td>
130 <td>Public method to get the regular expression and associated string matchers.</td>
131 </tr><tr>
132 <td><a href="#AdBlockRule.isCSSRule">isCSSRule</a></td>
133 <td>Public method to check, if the rule is a CSS rule.</td>
134 </tr><tr>
135 <td><a href="#AdBlockRule.isComment">isComment</a></td>
136 <td>Public method to check, if this is a comment.</td>
137 </tr><tr>
138 <td><a href="#AdBlockRule.isDocument">isDocument</a></td>
139 <td>Public method to check, if this is a document rule.</td>
140 </tr><tr>
141 <td><a href="#AdBlockRule.isDomainRestricted">isDomainRestricted</a></td>
142 <td>Public method to check, if this rule is restricted by domain.</td>
143 </tr><tr>
144 <td><a href="#AdBlockRule.isElementHiding">isElementHiding</a></td>
145 <td>Public method to check, if this is an element hiding rule.</td>
146 </tr><tr>
147 <td><a href="#AdBlockRule.isEnabled">isEnabled</a></td>
148 <td>Public method to check, if the rule is enabled.</td>
149 </tr><tr>
150 <td><a href="#AdBlockRule.isException">isException</a></td>
151 <td>Public method to check, if the rule defines an exception.</td>
152 </tr><tr>
153 <td><a href="#AdBlockRule.isHeader">isHeader</a></td>
154 <td>Public method to check, if this is a header.</td>
155 </tr><tr>
156 <td><a href="#AdBlockRule.isInternalDisabled">isInternalDisabled</a></td>
157 <td>Public method to check, if this rule was disabled internally.</td>
158 </tr><tr>
159 <td><a href="#AdBlockRule.isSlow">isSlow</a></td>
160 <td>Public method to check, if this is a slow rule.</td>
161 </tr><tr>
162 <td><a href="#AdBlockRule.matchDomain">matchDomain</a></td>
163 <td>Public method to match a domain.</td>
164 </tr><tr>
165 <td><a href="#AdBlockRule.matchFont">matchFont</a></td>
166 <td>Public method to match a Font rule.</td>
167 </tr><tr>
168 <td><a href="#AdBlockRule.matchImage">matchImage</a></td>
169 <td>Public method to match an Image rule.</td>
170 </tr><tr>
171 <td><a href="#AdBlockRule.matchMedia">matchMedia</a></td>
172 <td>Public method to match a Media rule.</td>
173 </tr><tr>
174 <td><a href="#AdBlockRule.matchObject">matchObject</a></td>
175 <td>Public method to match an object rule.</td>
176 </tr><tr>
177 <td><a href="#AdBlockRule.matchObjectSubrequest">matchObjectSubrequest</a></td>
178 <td>Public method to match an Object Subrequest rule.</td>
179 </tr><tr>
180 <td><a href="#AdBlockRule.matchOther">matchOther</a></td>
181 <td>Public method to match any other rule.</td>
182 </tr><tr>
183 <td><a href="#AdBlockRule.matchPing">matchPing</a></td>
184 <td>Public method to match a Ping rule.</td>
185 </tr><tr>
186 <td><a href="#AdBlockRule.matchScript">matchScript</a></td>
187 <td>Public method to match a Script rule.</td>
188 </tr><tr>
189 <td><a href="#AdBlockRule.matchString">matchString</a></td>
190 <td>Public method to get the match string.</td>
191 </tr><tr>
192 <td><a href="#AdBlockRule.matchStyleSheet">matchStyleSheet</a></td>
193 <td>Public method to match a StyleSheet rule.</td>
194 </tr><tr>
195 <td><a href="#AdBlockRule.matchSubdocument">matchSubdocument</a></td>
196 <td>Public method to match a sub-document rule.</td>
197 </tr><tr>
198 <td><a href="#AdBlockRule.matchThirdParty">matchThirdParty</a></td>
199 <td>Public method to match a third-party rule.</td>
200 </tr><tr>
201 <td><a href="#AdBlockRule.matchXmlHttpRequest">matchXmlHttpRequest</a></td>
202 <td>Public method to match a XmlHttpRequest rule.</td>
203 </tr><tr>
204 <td><a href="#AdBlockRule.networkMatch">networkMatch</a></td>
205 <td>Public method to check the rule for a match.</td>
206 </tr><tr>
207 <td><a href="#AdBlockRule.ruleExceptions">ruleExceptions</a></td>
208 <td>Public method to get the rule exceptions.</td>
209 </tr><tr>
210 <td><a href="#AdBlockRule.ruleOptions">ruleOptions</a></td>
211 <td>Public method to get the rule options.</td>
212 </tr><tr>
213 <td><a href="#AdBlockRule.ruleType">ruleType</a></td>
214 <td>Public method to get the rule type.</td>
215 </tr><tr>
216 <td><a href="#AdBlockRule.setEnabled">setEnabled</a></td>
217 <td>Public method to set the rule's enabled state.</td>
218 </tr><tr>
219 <td><a href="#AdBlockRule.setException">setException</a></td>
220 <td>Public method to set the rule's exception flag.</td>
221 </tr><tr>
222 <td><a href="#AdBlockRule.setFilter">setFilter</a></td>
223 <td>Public method to set the rule filter string.</td>
224 </tr><tr>
225 <td><a href="#AdBlockRule.setOption">setOption</a></td>
226 <td>Public method to set the given option.</td>
227 </tr><tr>
228 <td><a href="#AdBlockRule.setSubscription">setSubscription</a></td>
229 <td>Public method to set the subscription this rule belongs to.</td>
230 </tr><tr>
231 <td><a href="#AdBlockRule.subscription">subscription</a></td>
232 <td>Public method to get the subscription this rule belongs to.</td>
233 </tr><tr>
234 <td><a href="#AdBlockRule.urlMatch">urlMatch</a></td>
235 <td>Public method to check an URL against the rule.</td>
236 </tr>
237 </table>
238 <h3>Static Methods</h3>
239 <table>
240 <tr><td>None</td></tr>
241 </table>
242 <a NAME="AdBlockRule.__init__" ID="AdBlockRule.__init__"></a>
243 <h4>AdBlockRule (Constructor)</h4>
244 <b>AdBlockRule</b>(<i>filterRule="", subscription=None</i>)
245 <p>
246 Constructor
247 </p><dl>
248 <dt><i>filterRule</i> (str)</dt>
249 <dd>
250 filter string of the rule
251 </dd><dt><i>subscription</i> (AdBlockSubscription)</dt>
252 <dd>
253 reference to the subscription object
254 </dd>
255 </dl><a NAME="AdBlockRule.__convertPatternToRegExp" ID="AdBlockRule.__convertPatternToRegExp"></a>
256 <h4>AdBlockRule.__convertPatternToRegExp</h4>
257 <b>__convertPatternToRegExp</b>(<i>wildcardPattern</i>)
258 <p>
259 Private method to convert a wildcard pattern to a regular expression.
260 </p><dl>
261 <dt><i>wildcardPattern</i> (str)</dt>
262 <dd>
263 string containing the wildcard pattern
264 </dd>
265 </dl><dl>
266 <dt>Returns:</dt>
267 <dd>
268 string containing a regular expression
269 </dd>
270 </dl><dl>
271 <dt>Return Type:</dt>
272 <dd>
273 string
274 </dd>
275 </dl><a NAME="AdBlockRule.__filterIsOnlyDomain" ID="AdBlockRule.__filterIsOnlyDomain"></a>
276 <h4>AdBlockRule.__filterIsOnlyDomain</h4>
277 <b>__filterIsOnlyDomain</b>(<i>filterString</i>)
278 <p>
279 Private method to check, if the given filter is a domain only filter.
280 </p><dl>
281 <dt><i>filterString</i> (str)</dt>
282 <dd>
283 filter string to be checked
284 </dd>
285 </dl><dl>
286 <dt>Returns:</dt>
287 <dd>
288 flag indicating a domain only filter
289 </dd>
290 </dl><dl>
291 <dt>Return Type:</dt>
292 <dd>
293 bool
294 </dd>
295 </dl><a NAME="AdBlockRule.__filterIsOnlyEndsMatch" ID="AdBlockRule.__filterIsOnlyEndsMatch"></a>
296 <h4>AdBlockRule.__filterIsOnlyEndsMatch</h4>
297 <b>__filterIsOnlyEndsMatch</b>(<i>filterString</i>)
298 <p>
299 Private method to check, if the given filter is to match against the
300 end of a string.
301 </p><dl>
302 <dt><i>filterString</i> (str)</dt>
303 <dd>
304 filter string to be checked
305 </dd>
306 </dl><dl>
307 <dt>Returns:</dt>
308 <dd>
309 flag indicating a end of string match filter
310 </dd>
311 </dl><dl>
312 <dt>Return Type:</dt>
313 <dd>
314 bool
315 </dd>
316 </dl><a NAME="AdBlockRule.__hasException" ID="AdBlockRule.__hasException"></a>
317 <h4>AdBlockRule.__hasException</h4>
318 <b>__hasException</b>(<i>opt</i>)
319 <p>
320 Private method to check, if the given option has been set as an
321 exception.
322 </p><dl>
323 <dt><i>opt</i> (AdBlockRuleOption)</dt>
324 <dd>
325 option to check for
326 </dd>
327 </dl><dl>
328 <dt>Returns:</dt>
329 <dd>
330 flag indicating the exception state of the option
331 </dd>
332 </dl><dl>
333 <dt>Return Type:</dt>
334 <dd>
335 bool
336 </dd>
337 </dl><a NAME="AdBlockRule.__hasOption" ID="AdBlockRule.__hasOption"></a>
338 <h4>AdBlockRule.__hasOption</h4>
339 <b>__hasOption</b>(<i>opt</i>)
340 <p>
341 Private method to check, if the given option has been set.
342 </p><dl>
343 <dt><i>opt</i> (AdBlockRuleOption)</dt>
344 <dd>
345 option to check for
346 </dd>
347 </dl><dl>
348 <dt>Returns:</dt>
349 <dd>
350 flag indicating the state of the option
351 </dd>
352 </dl><dl>
353 <dt>Return Type:</dt>
354 <dd>
355 bool
356 </dd>
357 </dl><a NAME="AdBlockRule.__isMatchingDomain" ID="AdBlockRule.__isMatchingDomain"></a>
358 <h4>AdBlockRule.__isMatchingDomain</h4>
359 <b>__isMatchingDomain</b>(<i>domain, filterString</i>)
360 <p>
361 Private method to check, if a given domain matches the given filter
362 string.
363 </p><dl>
364 <dt><i>domain</i> (str)</dt>
365 <dd>
366 domain to be checked
367 </dd><dt><i>filterString</i> (str)</dt>
368 <dd>
369 filter string to check against
370 </dd>
371 </dl><dl>
372 <dt>Returns:</dt>
373 <dd>
374 flag indicating a match
375 </dd>
376 </dl><dl>
377 <dt>Return Type:</dt>
378 <dd>
379 bool
380 </dd>
381 </dl><a NAME="AdBlockRule.__isMatchingRegExpStrings" ID="AdBlockRule.__isMatchingRegExpStrings"></a>
382 <h4>AdBlockRule.__isMatchingRegExpStrings</h4>
383 <b>__isMatchingRegExpStrings</b>(<i>url</i>)
384 <p>
385 Private method to check the given URL against the fixed parts of
386 the regexp.
387 </p><dl>
388 <dt><i>url</i> (str)</dt>
389 <dd>
390 URL to be checked
391 </dd>
392 </dl><dl>
393 <dt>Returns:</dt>
394 <dd>
395 flag indicating a match
396 </dd>
397 </dl><dl>
398 <dt>Return Type:</dt>
399 <dd>
400 bool
401 </dd>
402 </dl><a NAME="AdBlockRule.__parseDomains" ID="AdBlockRule.__parseDomains"></a>
403 <h4>AdBlockRule.__parseDomains</h4>
404 <b>__parseDomains</b>(<i>domains, separator</i>)
405 <p>
406 Private method to parse a string with a domain list.
407 </p><dl>
408 <dt><i>domains</i> (str)</dt>
409 <dd>
410 list of domains
411 </dd><dt><i>separator</i> (str)</dt>
412 <dd>
413 separator character used by the list
414 </dd>
415 </dl><a NAME="AdBlockRule.__parseFilter" ID="AdBlockRule.__parseFilter"></a>
416 <h4>AdBlockRule.__parseFilter</h4>
417 <b>__parseFilter</b>(<i></i>)
418 <p>
419 Private method to parse the filter pattern.
420 </p><a NAME="AdBlockRule.__parseRegExpFilter" ID="AdBlockRule.__parseRegExpFilter"></a>
421 <h4>AdBlockRule.__parseRegExpFilter</h4>
422 <b>__parseRegExpFilter</b>(<i>filterString</i>)
423 <p>
424 Private method to split the given regular expression into strings that
425 can be used with 'in'.
426 </p><dl>
427 <dt><i>filterString</i> (str)</dt>
428 <dd>
429 regexp filter string to be parsed
430 </dd>
431 </dl><dl>
432 <dt>Returns:</dt>
433 <dd>
434 fixed string parts of the filter
435 </dd>
436 </dl><dl>
437 <dt>Return Type:</dt>
438 <dd>
439 list of str
440 </dd>
441 </dl><a NAME="AdBlockRule.__setException" ID="AdBlockRule.__setException"></a>
442 <h4>AdBlockRule.__setException</h4>
443 <b>__setException</b>(<i>opt, on</i>)
444 <p>
445 Private method to set the given option as an exception.
446 </p><dl>
447 <dt><i>opt</i> (AdBlockRuleOption)</dt>
448 <dd>
449 option to be set
450 </dd><dt><i>on</i> (bool)</dt>
451 <dd>
452 flag indicating to set or unset the exception
453 </dd>
454 </dl><a NAME="AdBlockRule.__stringMatch" ID="AdBlockRule.__stringMatch"></a>
455 <h4>AdBlockRule.__stringMatch</h4>
456 <b>__stringMatch</b>(<i>domain, encodedUrl</i>)
457 <p>
458 Private method to match a domain string.
459 </p><dl>
460 <dt><i>domain</i> (str)</dt>
461 <dd>
462 domain to match
463 </dd><dt><i>encodedUrl</i> (str)</dt>
464 <dd>
465 URL in encoded form
466 </dd>
467 </dl><dl>
468 <dt>Returns:</dt>
469 <dd>
470 flag indicating a match
471 </dd>
472 </dl><dl>
473 <dt>Return Type:</dt>
474 <dd>
475 bool
476 </dd>
477 </dl><a NAME="AdBlockRule.addBlockedDomains" ID="AdBlockRule.addBlockedDomains"></a>
478 <h4>AdBlockRule.addBlockedDomains</h4>
479 <b>addBlockedDomains</b>(<i>domains</i>)
480 <p>
481 Public method to add to the list of blocked domains.
482 </p><dl>
483 <dt><i>domains</i> (str or list of str)</dt>
484 <dd>
485 list of domains to be added
486 </dd>
487 </dl><a NAME="AdBlockRule.allowedDomains" ID="AdBlockRule.allowedDomains"></a>
488 <h4>AdBlockRule.allowedDomains</h4>
489 <b>allowedDomains</b>(<i></i>)
490 <p>
491 Public method to get a copy of the list of allowed domains.
492 </p><dl>
493 <dt>Returns:</dt>
494 <dd>
495 list of allowed domains
496 </dd>
497 </dl><dl>
498 <dt>Return Type:</dt>
499 <dd>
500 list of str
501 </dd>
502 </dl><a NAME="AdBlockRule.blockedDomains" ID="AdBlockRule.blockedDomains"></a>
503 <h4>AdBlockRule.blockedDomains</h4>
504 <b>blockedDomains</b>(<i></i>)
505 <p>
506 Public method to get a copy of the list of blocked domains.
507 </p><dl>
508 <dt>Returns:</dt>
509 <dd>
510 list of blocked domains
511 </dd>
512 </dl><dl>
513 <dt>Return Type:</dt>
514 <dd>
515 list of str
516 </dd>
517 </dl><a NAME="AdBlockRule.caseSensitivity" ID="AdBlockRule.caseSensitivity"></a>
518 <h4>AdBlockRule.caseSensitivity</h4>
519 <b>caseSensitivity</b>(<i></i>)
520 <p>
521 Public method to get the case sensitivity.
522 </p><dl>
523 <dt>Returns:</dt>
524 <dd>
525 case sensitivity
526 </dd>
527 </dl><dl>
528 <dt>Return Type:</dt>
529 <dd>
530 Qt.CaseSensitivity
531 </dd>
532 </dl><a NAME="AdBlockRule.copyFrom" ID="AdBlockRule.copyFrom"></a>
533 <h4>AdBlockRule.copyFrom</h4>
534 <b>copyFrom</b>(<i>other</i>)
535 <p>
536 Public method to copy another AdBlock rule.
537 </p><dl>
538 <dt><i>other</i> (AdBlockRule)</dt>
539 <dd>
540 reference to the AdBlock rule to copy from
541 </dd>
542 </dl><a NAME="AdBlockRule.cssSelector" ID="AdBlockRule.cssSelector"></a>
543 <h4>AdBlockRule.cssSelector</h4>
544 <b>cssSelector</b>(<i></i>)
545 <p>
546 Public method to get the CSS selector of the rule.
547 </p><dl>
548 <dt>Returns:</dt>
549 <dd>
550 CSS selector
551 </dd>
552 </dl><dl>
553 <dt>Return Type:</dt>
554 <dd>
555 str
556 </dd>
557 </dl><a NAME="AdBlockRule.filter" ID="AdBlockRule.filter"></a>
558 <h4>AdBlockRule.filter</h4>
559 <b>filter</b>(<i></i>)
560 <p>
561 Public method to get the rule filter string.
562 </p><dl>
563 <dt>Returns:</dt>
564 <dd>
565 rule filter string
566 </dd>
567 </dl><dl>
568 <dt>Return Type:</dt>
569 <dd>
570 str
571 </dd>
572 </dl><a NAME="AdBlockRule.getRegExpAndMatchers" ID="AdBlockRule.getRegExpAndMatchers"></a>
573 <h4>AdBlockRule.getRegExpAndMatchers</h4>
574 <b>getRegExpAndMatchers</b>(<i></i>)
575 <p>
576 Public method to get the regular expression and associated string
577 matchers.
578 </p><dl>
579 <dt>Returns:</dt>
580 <dd>
581 tuple containing the regular expression and the list of
582 string matchers
583 </dd>
584 </dl><dl>
585 <dt>Return Type:</dt>
586 <dd>
587 tuple of (QRegExp, list of str)
588 </dd>
589 </dl><a NAME="AdBlockRule.isCSSRule" ID="AdBlockRule.isCSSRule"></a>
590 <h4>AdBlockRule.isCSSRule</h4>
591 <b>isCSSRule</b>(<i></i>)
592 <p>
593 Public method to check, if the rule is a CSS rule.
594 </p><dl>
595 <dt>Returns:</dt>
596 <dd>
597 flag indicating a CSS rule
598 </dd>
599 </dl><dl>
600 <dt>Return Type:</dt>
601 <dd>
602 bool
603 </dd>
604 </dl><a NAME="AdBlockRule.isComment" ID="AdBlockRule.isComment"></a>
605 <h4>AdBlockRule.isComment</h4>
606 <b>isComment</b>(<i></i>)
607 <p>
608 Public method to check, if this is a comment.
609 </p><dl>
610 <dt>Returns:</dt>
611 <dd>
612 flag indicating a comment
613 </dd>
614 </dl><dl>
615 <dt>Return Type:</dt>
616 <dd>
617 bool
618 </dd>
619 </dl><a NAME="AdBlockRule.isDocument" ID="AdBlockRule.isDocument"></a>
620 <h4>AdBlockRule.isDocument</h4>
621 <b>isDocument</b>(<i></i>)
622 <p>
623 Public method to check, if this is a document rule.
624 </p><dl>
625 <dt>Returns:</dt>
626 <dd>
627 flag indicating a document rule
628 </dd>
629 </dl><dl>
630 <dt>Return Type:</dt>
631 <dd>
632 bool
633 </dd>
634 </dl><a NAME="AdBlockRule.isDomainRestricted" ID="AdBlockRule.isDomainRestricted"></a>
635 <h4>AdBlockRule.isDomainRestricted</h4>
636 <b>isDomainRestricted</b>(<i></i>)
637 <p>
638 Public method to check, if this rule is restricted by domain.
639 </p><dl>
640 <dt>Returns:</dt>
641 <dd>
642 flag indicating a domain restriction
643 </dd>
644 </dl><dl>
645 <dt>Return Type:</dt>
646 <dd>
647 bool
648 </dd>
649 </dl><a NAME="AdBlockRule.isElementHiding" ID="AdBlockRule.isElementHiding"></a>
650 <h4>AdBlockRule.isElementHiding</h4>
651 <b>isElementHiding</b>(<i></i>)
652 <p>
653 Public method to check, if this is an element hiding rule.
654 </p><dl>
655 <dt>Returns:</dt>
656 <dd>
657 flag indicating an element hiding rule
658 </dd>
659 </dl><dl>
660 <dt>Return Type:</dt>
661 <dd>
662 bool
663 </dd>
664 </dl><a NAME="AdBlockRule.isEnabled" ID="AdBlockRule.isEnabled"></a>
665 <h4>AdBlockRule.isEnabled</h4>
666 <b>isEnabled</b>(<i></i>)
667 <p>
668 Public method to check, if the rule is enabled.
669 </p><dl>
670 <dt>Returns:</dt>
671 <dd>
672 flag indicating enabled state
673 </dd>
674 </dl><dl>
675 <dt>Return Type:</dt>
676 <dd>
677 bool
678 </dd>
679 </dl><a NAME="AdBlockRule.isException" ID="AdBlockRule.isException"></a>
680 <h4>AdBlockRule.isException</h4>
681 <b>isException</b>(<i></i>)
682 <p>
683 Public method to check, if the rule defines an exception.
684 </p><dl>
685 <dt>Returns:</dt>
686 <dd>
687 flag indicating an exception
688 </dd>
689 </dl><dl>
690 <dt>Return Type:</dt>
691 <dd>
692 bool
693 </dd>
694 </dl><a NAME="AdBlockRule.isHeader" ID="AdBlockRule.isHeader"></a>
695 <h4>AdBlockRule.isHeader</h4>
696 <b>isHeader</b>(<i></i>)
697 <p>
698 Public method to check, if this is a header.
699 </p><dl>
700 <dt>Returns:</dt>
701 <dd>
702 flag indicating a header
703 </dd>
704 </dl><dl>
705 <dt>Return Type:</dt>
706 <dd>
707 bool
708 </dd>
709 </dl><a NAME="AdBlockRule.isInternalDisabled" ID="AdBlockRule.isInternalDisabled"></a>
710 <h4>AdBlockRule.isInternalDisabled</h4>
711 <b>isInternalDisabled</b>(<i></i>)
712 <p>
713 Public method to check, if this rule was disabled internally.
714 </p><dl>
715 <dt>Returns:</dt>
716 <dd>
717 flag indicating an internally disabled rule
718 </dd>
719 </dl><dl>
720 <dt>Return Type:</dt>
721 <dd>
722 bool
723 </dd>
724 </dl><a NAME="AdBlockRule.isSlow" ID="AdBlockRule.isSlow"></a>
725 <h4>AdBlockRule.isSlow</h4>
726 <b>isSlow</b>(<i></i>)
727 <p>
728 Public method to check, if this is a slow rule.
729 </p><dl>
730 <dt>Returns:</dt>
731 <dd>
732 flag indicating a slow rule
733 </dd>
734 </dl><dl>
735 <dt>Return Type:</dt>
736 <dd>
737 bool
738 </dd>
739 </dl><a NAME="AdBlockRule.matchDomain" ID="AdBlockRule.matchDomain"></a>
740 <h4>AdBlockRule.matchDomain</h4>
741 <b>matchDomain</b>(<i>domain</i>)
742 <p>
743 Public method to match a domain.
744 </p><dl>
745 <dt><i>domain</i> (str)</dt>
746 <dd>
747 domain name to check
748 </dd>
749 </dl><dl>
750 <dt>Returns:</dt>
751 <dd>
752 flag indicating a match
753 </dd>
754 </dl><dl>
755 <dt>Return Type:</dt>
756 <dd>
757 bool
758 </dd>
759 </dl><a NAME="AdBlockRule.matchFont" ID="AdBlockRule.matchFont"></a>
760 <h4>AdBlockRule.matchFont</h4>
761 <b>matchFont</b>(<i>req</i>)
762 <p>
763 Public method to match a Font rule.
764 </p><dl>
765 <dt><i>req</i> (QWebEngineUrlRequestInfo)</dt>
766 <dd>
767 request object to check
768 </dd>
769 </dl><dl>
770 <dt>Returns:</dt>
771 <dd>
772 flag indicating a match
773 </dd>
774 </dl><dl>
775 <dt>Return Type:</dt>
776 <dd>
777 bool
778 </dd>
779 </dl><a NAME="AdBlockRule.matchImage" ID="AdBlockRule.matchImage"></a>
780 <h4>AdBlockRule.matchImage</h4>
781 <b>matchImage</b>(<i>req</i>)
782 <p>
783 Public method to match an Image rule.
784 </p><dl>
785 <dt><i>req</i> (QWebEngineUrlRequestInfo)</dt>
786 <dd>
787 request object to check
788 </dd>
789 </dl><dl>
790 <dt>Returns:</dt>
791 <dd>
792 flag indicating a match
793 </dd>
794 </dl><dl>
795 <dt>Return Type:</dt>
796 <dd>
797 bool
798 </dd>
799 </dl><a NAME="AdBlockRule.matchMedia" ID="AdBlockRule.matchMedia"></a>
800 <h4>AdBlockRule.matchMedia</h4>
801 <b>matchMedia</b>(<i>req</i>)
802 <p>
803 Public method to match a Media rule.
804 </p><dl>
805 <dt><i>req</i> (QWebEngineUrlRequestInfo)</dt>
806 <dd>
807 request object to check
808 </dd>
809 </dl><dl>
810 <dt>Returns:</dt>
811 <dd>
812 flag indicating a match
813 </dd>
814 </dl><dl>
815 <dt>Return Type:</dt>
816 <dd>
817 bool
818 </dd>
819 </dl><a NAME="AdBlockRule.matchObject" ID="AdBlockRule.matchObject"></a>
820 <h4>AdBlockRule.matchObject</h4>
821 <b>matchObject</b>(<i>req</i>)
822 <p>
823 Public method to match an object rule.
824 </p><dl>
825 <dt><i>req</i> (QWebEngineUrlRequestInfo)</dt>
826 <dd>
827 request object to check
828 </dd>
829 </dl><dl>
830 <dt>Returns:</dt>
831 <dd>
832 flag indicating a match
833 </dd>
834 </dl><dl>
835 <dt>Return Type:</dt>
836 <dd>
837 bool
838 </dd>
839 </dl><a NAME="AdBlockRule.matchObjectSubrequest" ID="AdBlockRule.matchObjectSubrequest"></a>
840 <h4>AdBlockRule.matchObjectSubrequest</h4>
841 <b>matchObjectSubrequest</b>(<i>req</i>)
842 <p>
843 Public method to match an Object Subrequest rule.
844 </p><dl>
845 <dt><i>req</i> (QWebEngineUrlRequestInfo)</dt>
846 <dd>
847 request object to check
848 </dd>
849 </dl><dl>
850 <dt>Returns:</dt>
851 <dd>
852 flag indicating a match
853 </dd>
854 </dl><dl>
855 <dt>Return Type:</dt>
856 <dd>
857 boolean
858 </dd>
859 </dl><a NAME="AdBlockRule.matchOther" ID="AdBlockRule.matchOther"></a>
860 <h4>AdBlockRule.matchOther</h4>
861 <b>matchOther</b>(<i>req</i>)
862 <p>
863 Public method to match any other rule.
864 </p><dl>
865 <dt><i>req</i> (QWebEngineUrlRequestInfo)</dt>
866 <dd>
867 request object to check
868 </dd>
869 </dl><dl>
870 <dt>Returns:</dt>
871 <dd>
872 flag indicating a match
873 </dd>
874 </dl><dl>
875 <dt>Return Type:</dt>
876 <dd>
877 bool
878 </dd>
879 </dl><a NAME="AdBlockRule.matchPing" ID="AdBlockRule.matchPing"></a>
880 <h4>AdBlockRule.matchPing</h4>
881 <b>matchPing</b>(<i>req</i>)
882 <p>
883 Public method to match a Ping rule.
884 </p><dl>
885 <dt><i>req</i> (QWebEngineUrlRequestInfo)</dt>
886 <dd>
887 request object to check
888 </dd>
889 </dl><dl>
890 <dt>Returns:</dt>
891 <dd>
892 flag indicating a match
893 </dd>
894 </dl><dl>
895 <dt>Return Type:</dt>
896 <dd>
897 bool
898 </dd>
899 </dl><a NAME="AdBlockRule.matchScript" ID="AdBlockRule.matchScript"></a>
900 <h4>AdBlockRule.matchScript</h4>
901 <b>matchScript</b>(<i>req</i>)
902 <p>
903 Public method to match a Script rule.
904 </p><dl>
905 <dt><i>req</i> (QWebEngineUrlRequestInfo)</dt>
906 <dd>
907 request object to check
908 </dd>
909 </dl><dl>
910 <dt>Returns:</dt>
911 <dd>
912 flag indicating a match
913 </dd>
914 </dl><dl>
915 <dt>Return Type:</dt>
916 <dd>
917 bool
918 </dd>
919 </dl><a NAME="AdBlockRule.matchString" ID="AdBlockRule.matchString"></a>
920 <h4>AdBlockRule.matchString</h4>
921 <b>matchString</b>(<i></i>)
922 <p>
923 Public method to get the match string.
924 </p><dl>
925 <dt>Returns:</dt>
926 <dd>
927 match string
928 </dd>
929 </dl><dl>
930 <dt>Return Type:</dt>
931 <dd>
932 str
933 </dd>
934 </dl><a NAME="AdBlockRule.matchStyleSheet" ID="AdBlockRule.matchStyleSheet"></a>
935 <h4>AdBlockRule.matchStyleSheet</h4>
936 <b>matchStyleSheet</b>(<i>req</i>)
937 <p>
938 Public method to match a StyleSheet rule.
939 </p><dl>
940 <dt><i>req</i> (QWebEngineUrlRequestInfo)</dt>
941 <dd>
942 request object to check
943 </dd>
944 </dl><dl>
945 <dt>Returns:</dt>
946 <dd>
947 flag indicating a match
948 </dd>
949 </dl><dl>
950 <dt>Return Type:</dt>
951 <dd>
952 bool
953 </dd>
954 </dl><a NAME="AdBlockRule.matchSubdocument" ID="AdBlockRule.matchSubdocument"></a>
955 <h4>AdBlockRule.matchSubdocument</h4>
956 <b>matchSubdocument</b>(<i>req</i>)
957 <p>
958 Public method to match a sub-document rule.
959 </p><dl>
960 <dt><i>req</i> (QWebEngineUrlRequestInfo)</dt>
961 <dd>
962 request object to check
963 </dd>
964 </dl><dl>
965 <dt>Returns:</dt>
966 <dd>
967 flag indicating a match
968 </dd>
969 </dl><dl>
970 <dt>Return Type:</dt>
971 <dd>
972 boolean
973 </dd>
974 </dl><a NAME="AdBlockRule.matchThirdParty" ID="AdBlockRule.matchThirdParty"></a>
975 <h4>AdBlockRule.matchThirdParty</h4>
976 <b>matchThirdParty</b>(<i>req</i>)
977 <p>
978 Public method to match a third-party rule.
979 </p><dl>
980 <dt><i>req</i> (QWebEngineUrlRequestInfo)</dt>
981 <dd>
982 request object to check
983 </dd>
984 </dl><dl>
985 <dt>Returns:</dt>
986 <dd>
987 flag indicating a match
988 </dd>
989 </dl><dl>
990 <dt>Return Type:</dt>
991 <dd>
992 boolean
993 </dd>
994 </dl><a NAME="AdBlockRule.matchXmlHttpRequest" ID="AdBlockRule.matchXmlHttpRequest"></a>
995 <h4>AdBlockRule.matchXmlHttpRequest</h4>
996 <b>matchXmlHttpRequest</b>(<i>req</i>)
997 <p>
998 Public method to match a XmlHttpRequest rule.
999 </p><dl>
1000 <dt><i>req</i> (QWebEngineUrlRequestInfo)</dt>
1001 <dd>
1002 request object to check
1003 </dd>
1004 </dl><dl>
1005 <dt>Returns:</dt>
1006 <dd>
1007 flag indicating a match
1008 </dd>
1009 </dl><dl>
1010 <dt>Return Type:</dt>
1011 <dd>
1012 bool
1013 </dd>
1014 </dl><a NAME="AdBlockRule.networkMatch" ID="AdBlockRule.networkMatch"></a>
1015 <h4>AdBlockRule.networkMatch</h4>
1016 <b>networkMatch</b>(<i>request, domain, encodedUrl</i>)
1017 <p>
1018 Public method to check the rule for a match.
1019 </p><dl>
1020 <dt><i>request</i> (QWebEngineUrlRequestInfo)</dt>
1021 <dd>
1022 reference to the network request
1023 </dd><dt><i>domain</i> (str)</dt>
1024 <dd>
1025 domain name
1026 </dd><dt><i>encodedUrl</i> (str)</dt>
1027 <dd>
1028 string encoded URL to be checked
1029 </dd>
1030 </dl><dl>
1031 <dt>Returns:</dt>
1032 <dd>
1033 flag indicating a match
1034 </dd>
1035 </dl><dl>
1036 <dt>Return Type:</dt>
1037 <dd>
1038 bool
1039 </dd>
1040 </dl><a NAME="AdBlockRule.ruleExceptions" ID="AdBlockRule.ruleExceptions"></a>
1041 <h4>AdBlockRule.ruleExceptions</h4>
1042 <b>ruleExceptions</b>(<i></i>)
1043 <p>
1044 Public method to get the rule exceptions.
1045 </p><dl>
1046 <dt>Returns:</dt>
1047 <dd>
1048 rule exceptions
1049 </dd>
1050 </dl><dl>
1051 <dt>Return Type:</dt>
1052 <dd>
1053 AdBlockRuleOption
1054 </dd>
1055 </dl><a NAME="AdBlockRule.ruleOptions" ID="AdBlockRule.ruleOptions"></a>
1056 <h4>AdBlockRule.ruleOptions</h4>
1057 <b>ruleOptions</b>(<i></i>)
1058 <p>
1059 Public method to get the rule options.
1060 </p><dl>
1061 <dt>Returns:</dt>
1062 <dd>
1063 rule options
1064 </dd>
1065 </dl><dl>
1066 <dt>Return Type:</dt>
1067 <dd>
1068 AdBlockRuleOption
1069 </dd>
1070 </dl><a NAME="AdBlockRule.ruleType" ID="AdBlockRule.ruleType"></a>
1071 <h4>AdBlockRule.ruleType</h4>
1072 <b>ruleType</b>(<i></i>)
1073 <p>
1074 Public method to get the rule type.
1075 </p><dl>
1076 <dt>Returns:</dt>
1077 <dd>
1078 rule type
1079 </dd>
1080 </dl><dl>
1081 <dt>Return Type:</dt>
1082 <dd>
1083 AdBlockRuleType
1084 </dd>
1085 </dl><a NAME="AdBlockRule.setEnabled" ID="AdBlockRule.setEnabled"></a>
1086 <h4>AdBlockRule.setEnabled</h4>
1087 <b>setEnabled</b>(<i>enabled</i>)
1088 <p>
1089 Public method to set the rule's enabled state.
1090 </p><dl>
1091 <dt><i>enabled</i> (bool)</dt>
1092 <dd>
1093 flag indicating the new enabled state
1094 </dd>
1095 </dl><a NAME="AdBlockRule.setException" ID="AdBlockRule.setException"></a>
1096 <h4>AdBlockRule.setException</h4>
1097 <b>setException</b>(<i>exception</i>)
1098 <p>
1099 Public method to set the rule's exception flag.
1100 </p><dl>
1101 <dt><i>exception</i> (bool)</dt>
1102 <dd>
1103 flag indicating an exception rule
1104 </dd>
1105 </dl><a NAME="AdBlockRule.setFilter" ID="AdBlockRule.setFilter"></a>
1106 <h4>AdBlockRule.setFilter</h4>
1107 <b>setFilter</b>(<i>filterRule</i>)
1108 <p>
1109 Public method to set the rule filter string.
1110 </p><dl>
1111 <dt><i>filterRule</i> (str)</dt>
1112 <dd>
1113 rule filter string
1114 </dd>
1115 </dl><a NAME="AdBlockRule.setOption" ID="AdBlockRule.setOption"></a>
1116 <h4>AdBlockRule.setOption</h4>
1117 <b>setOption</b>(<i>opt</i>)
1118 <p>
1119 Public method to set the given option.
1120 </p><dl>
1121 <dt><i>opt</i> (AdBlockRuleOption)</dt>
1122 <dd>
1123 option to be set
1124 </dd>
1125 </dl><a NAME="AdBlockRule.setSubscription" ID="AdBlockRule.setSubscription"></a>
1126 <h4>AdBlockRule.setSubscription</h4>
1127 <b>setSubscription</b>(<i>subscription</i>)
1128 <p>
1129 Public method to set the subscription this rule belongs to.
1130 </p><dl>
1131 <dt><i>subscription</i> (AdBlockSubscription)</dt>
1132 <dd>
1133 subscription of the rule
1134 </dd>
1135 </dl><a NAME="AdBlockRule.subscription" ID="AdBlockRule.subscription"></a>
1136 <h4>AdBlockRule.subscription</h4>
1137 <b>subscription</b>(<i></i>)
1138 <p>
1139 Public method to get the subscription this rule belongs to.
1140 </p><dl>
1141 <dt>Returns:</dt>
1142 <dd>
1143 subscription of the rule
1144 </dd>
1145 </dl><dl>
1146 <dt>Return Type:</dt>
1147 <dd>
1148 AdBlockSubscription
1149 </dd>
1150 </dl><a NAME="AdBlockRule.urlMatch" ID="AdBlockRule.urlMatch"></a>
1151 <h4>AdBlockRule.urlMatch</h4>
1152 <b>urlMatch</b>(<i>url</i>)
1153 <p>
1154 Public method to check an URL against the rule.
1155 </p><dl>
1156 <dt><i>url</i> (QUrl)</dt>
1157 <dd>
1158 URL to check
1159 </dd>
1160 </dl><dl>
1161 <dt>Returns:</dt>
1162 <dd>
1163 flag indicating a match
1164 </dd>
1165 </dl><dl>
1166 <dt>Return Type:</dt>
1167 <dd>
1168 bool
1169 </dd>
1170 </dl>
1171 <div align="right"><a href="#top">Up</a></div>
1172 <hr /><hr />
1173 <a NAME="AdBlockRuleOption" ID="AdBlockRuleOption"></a>
1174 <h2>AdBlockRuleOption</h2>
1175 <p>
1176 Class implementing the rule option enum.
1177 </p>
1178 <h3>Derived from</h3>
1179 IntEnum
1180 <h3>Class Attributes</h3>
1181 <table>
1182 <tr><td>DocumentOption</td></tr><tr><td>DomainRestrictedOption</td></tr><tr><td>ElementHideOption</td></tr><tr><td>FontOption</td></tr><tr><td>ImageOption</td></tr><tr><td>MediaOption</td></tr><tr><td>NoOption</td></tr><tr><td>ObjectOption</td></tr><tr><td>ObjectSubrequestOption</td></tr><tr><td>OtherOption</td></tr><tr><td>PingOption</td></tr><tr><td>ScriptOption</td></tr><tr><td>StyleSheetOption</td></tr><tr><td>SubdocumentOption</td></tr><tr><td>ThirdPartyOption</td></tr><tr><td>XMLHttpRequestOption</td></tr>
1183 </table>
1184 <h3>Class Methods</h3>
1185 <table>
1186 <tr><td>None</td></tr>
1187 </table>
1188 <h3>Methods</h3>
1189 <table>
1190 <tr><td>None</td></tr>
1191 </table>
1192 <h3>Static Methods</h3>
1193 <table>
1194 <tr><td>None</td></tr>
1195 </table>
1196
1197 <div align="right"><a href="#top">Up</a></div>
1198 <hr /><hr />
1199 <a NAME="AdBlockRuleType" ID="AdBlockRuleType"></a>
1200 <h2>AdBlockRuleType</h2>
1201 <p>
1202 Class implementing the rule type enum.
1203 </p>
1204 <h3>Derived from</h3>
1205 IntEnum
1206 <h3>Class Attributes</h3>
1207 <table>
1208 <tr><td>CssRule</td></tr><tr><td>DomainMatchRule</td></tr><tr><td>Invalid</td></tr><tr><td>MatchAllUrlsRule</td></tr><tr><td>RegExpMatchRule</td></tr><tr><td>StringContainsMatchRule</td></tr><tr><td>StringEndsMatchRule</td></tr>
1209 </table>
1210 <h3>Class Methods</h3>
1211 <table>
1212 <tr><td>None</td></tr>
1213 </table>
1214 <h3>Methods</h3>
1215 <table>
1216 <tr><td>None</td></tr>
1217 </table>
1218 <h3>Static Methods</h3>
1219 <table>
1220 <tr><td>None</td></tr>
1221 </table>
1222
1223 <div align="right"><a href="#top">Up</a></div>
1224 <hr /><hr />
1225 <a NAME="toSecondLevelDomain" ID="toSecondLevelDomain"></a>
1226 <h2>toSecondLevelDomain</h2>
1227 <b>toSecondLevelDomain</b>(<i>url</i>)
1228 <p>
1229 Module function to get a second level domain from the given URL.
1230 </p><dl>
1231 <dt><i>url</i> (QUrl)</dt>
1232 <dd>
1233 URL to extract domain from
1234 </dd>
1235 </dl><dl>
1236 <dt>Returns:</dt>
1237 <dd>
1238 name of second level domain
1239 </dd>
1240 </dl><dl>
1241 <dt>Return Type:</dt>
1242 <dd>
1243 str
1244 </dd>
1245 </dl>
1246 <div align="right"><a href="#top">Up</a></div>
1247 <hr />
1248 </body></html>

eric ide

mercurial