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

changeset 3673
e26d7d0c1088
child 5606
da305d172769
equal deleted inserted replaced
3670:f0cb7579c0b4 3673:e26d7d0c1088
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.Helpviewer.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.Helpviewer.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>
36 </table>
37 <h3>Functions</h3>
38 <table>
39 <tr>
40 <td><a href="#toSecondLevelDomain">toSecondLevelDomain</a></td>
41 <td>Module function to get a second level domain from the given URL.</td>
42 </tr>
43 </table>
44 <hr /><hr />
45 <a NAME="AdBlockRule" ID="AdBlockRule"></a>
46 <h2>AdBlockRule</h2>
47 <p>
48 Class implementing the AdBlock rule.
49 </p>
50 <h3>Derived from</h3>
51 object
52 <h3>Class Attributes</h3>
53 <table>
54 <tr><td>None</td></tr>
55 </table>
56 <h3>Class Methods</h3>
57 <table>
58 <tr><td>None</td></tr>
59 </table>
60 <h3>Methods</h3>
61 <table>
62 <tr>
63 <td><a href="#AdBlockRule.__init__">AdBlockRule</a></td>
64 <td>Constructor</td>
65 </tr><tr>
66 <td><a href="#AdBlockRule.__convertPatternToRegExp">__convertPatternToRegExp</a></td>
67 <td>Private method to convert a wildcard pattern to a regular expression.</td>
68 </tr><tr>
69 <td><a href="#AdBlockRule.__parseDomains">__parseDomains</a></td>
70 <td>Private method to parse a string with a domain list.</td>
71 </tr><tr>
72 <td><a href="#AdBlockRule.__parseFilter">__parseFilter</a></td>
73 <td>Private method to parse the filter pattern.</td>
74 </tr><tr>
75 <td><a href="#AdBlockRule.cssSelector">cssSelector</a></td>
76 <td>Public method to get the CSS selector of the rule.</td>
77 </tr><tr>
78 <td><a href="#AdBlockRule.filter">filter</a></td>
79 <td>Public method to get the rule filter string.</td>
80 </tr><tr>
81 <td><a href="#AdBlockRule.isCSSRule">isCSSRule</a></td>
82 <td>Public method to check, if the rule is a CSS rule.</td>
83 </tr><tr>
84 <td><a href="#AdBlockRule.isComment">isComment</a></td>
85 <td>Public method to check, if this is a comment.</td>
86 </tr><tr>
87 <td><a href="#AdBlockRule.isDocument">isDocument</a></td>
88 <td>Public method to check, if this is a document rule.</td>
89 </tr><tr>
90 <td><a href="#AdBlockRule.isDomainRestricted">isDomainRestricted</a></td>
91 <td>Public method to check, if this rule is restricted by domain.</td>
92 </tr><tr>
93 <td><a href="#AdBlockRule.isElementHiding">isElementHiding</a></td>
94 <td>Public method to check, if this is an element hiding rule.</td>
95 </tr><tr>
96 <td><a href="#AdBlockRule.isEnabled">isEnabled</a></td>
97 <td>Public method to check, if the rule is enabled.</td>
98 </tr><tr>
99 <td><a href="#AdBlockRule.isException">isException</a></td>
100 <td>Public method to check, if the rule defines an exception.</td>
101 </tr><tr>
102 <td><a href="#AdBlockRule.isHeader">isHeader</a></td>
103 <td>Public method to check, if this is a header.</td>
104 </tr><tr>
105 <td><a href="#AdBlockRule.isInternalDisabled">isInternalDisabled</a></td>
106 <td>Public method to check, if this rule was disabled internally.</td>
107 </tr><tr>
108 <td><a href="#AdBlockRule.isSlow">isSlow</a></td>
109 <td>Public method to check, if this is a slow rule.</td>
110 </tr><tr>
111 <td><a href="#AdBlockRule.matchDomain">matchDomain</a></td>
112 <td>Public method to match a domain.</td>
113 </tr><tr>
114 <td><a href="#AdBlockRule.matchObject">matchObject</a></td>
115 <td>Public slot to match an object rule.</td>
116 </tr><tr>
117 <td><a href="#AdBlockRule.matchSubdocument">matchSubdocument</a></td>
118 <td>Public slot to match a sub-document rule.</td>
119 </tr><tr>
120 <td><a href="#AdBlockRule.matchThirdParty">matchThirdParty</a></td>
121 <td>Public slot to match a third-party rule.</td>
122 </tr><tr>
123 <td><a href="#AdBlockRule.matchXmlHttpRequest">matchXmlHttpRequest</a></td>
124 <td>Public slot to match a XmlHttpRequest rule.</td>
125 </tr><tr>
126 <td><a href="#AdBlockRule.networkMatch">networkMatch</a></td>
127 <td>Public method to check the rule for a match.</td>
128 </tr><tr>
129 <td><a href="#AdBlockRule.setEnabled">setEnabled</a></td>
130 <td>Public method to set the rule's enabled state.</td>
131 </tr><tr>
132 <td><a href="#AdBlockRule.setException">setException</a></td>
133 <td>Public method to set the rule's exception flag.</td>
134 </tr><tr>
135 <td><a href="#AdBlockRule.setFilter">setFilter</a></td>
136 <td>Public method to set the rule filter string.</td>
137 </tr><tr>
138 <td><a href="#AdBlockRule.subscription">subscription</a></td>
139 <td>Public method to get the subscription this rule belongs to.</td>
140 </tr><tr>
141 <td><a href="#AdBlockRule.urlMatch">urlMatch</a></td>
142 <td>Public method to check an URL against the rule.</td>
143 </tr>
144 </table>
145 <h3>Static Methods</h3>
146 <table>
147 <tr><td>None</td></tr>
148 </table>
149 <a NAME="AdBlockRule.__init__" ID="AdBlockRule.__init__"></a>
150 <h4>AdBlockRule (Constructor)</h4>
151 <b>AdBlockRule</b>(<i>filter="", subscription=None</i>)
152 <p>
153 Constructor
154 </p><dl>
155 <dt><i>filter</i></dt>
156 <dd>
157 filter string of the rule (string)
158 </dd><dt><i>subscription</i></dt>
159 <dd>
160 reference to the subscription object
161 (AdBlockSubscription)
162 </dd>
163 </dl><a NAME="AdBlockRule.__convertPatternToRegExp" ID="AdBlockRule.__convertPatternToRegExp"></a>
164 <h4>AdBlockRule.__convertPatternToRegExp</h4>
165 <b>__convertPatternToRegExp</b>(<i>wildcardPattern</i>)
166 <p>
167 Private method to convert a wildcard pattern to a regular expression.
168 </p><dl>
169 <dt><i>wildcardPattern</i></dt>
170 <dd>
171 string containing the wildcard pattern (string)
172 </dd>
173 </dl><dl>
174 <dt>Returns:</dt>
175 <dd>
176 string containing a regular expression (string)
177 </dd>
178 </dl><a NAME="AdBlockRule.__parseDomains" ID="AdBlockRule.__parseDomains"></a>
179 <h4>AdBlockRule.__parseDomains</h4>
180 <b>__parseDomains</b>(<i>domains, separator</i>)
181 <p>
182 Private method to parse a string with a domain list.
183 </p><dl>
184 <dt><i>domains</i></dt>
185 <dd>
186 list of domains (string)
187 </dd><dt><i>separator</i></dt>
188 <dd>
189 separator character used by the list (string)
190 </dd>
191 </dl><a NAME="AdBlockRule.__parseFilter" ID="AdBlockRule.__parseFilter"></a>
192 <h4>AdBlockRule.__parseFilter</h4>
193 <b>__parseFilter</b>(<i></i>)
194 <p>
195 Private method to parse the filter pattern.
196 </p><a NAME="AdBlockRule.cssSelector" ID="AdBlockRule.cssSelector"></a>
197 <h4>AdBlockRule.cssSelector</h4>
198 <b>cssSelector</b>(<i></i>)
199 <p>
200 Public method to get the CSS selector of the rule.
201 </p><dl>
202 <dt>Returns:</dt>
203 <dd>
204 CSS selector (string)
205 </dd>
206 </dl><a NAME="AdBlockRule.filter" ID="AdBlockRule.filter"></a>
207 <h4>AdBlockRule.filter</h4>
208 <b>filter</b>(<i></i>)
209 <p>
210 Public method to get the rule filter string.
211 </p><dl>
212 <dt>Returns:</dt>
213 <dd>
214 rule filter string (string)
215 </dd>
216 </dl><a NAME="AdBlockRule.isCSSRule" ID="AdBlockRule.isCSSRule"></a>
217 <h4>AdBlockRule.isCSSRule</h4>
218 <b>isCSSRule</b>(<i></i>)
219 <p>
220 Public method to check, if the rule is a CSS rule.
221 </p><dl>
222 <dt>Returns:</dt>
223 <dd>
224 flag indicating a CSS rule (boolean)
225 </dd>
226 </dl><a NAME="AdBlockRule.isComment" ID="AdBlockRule.isComment"></a>
227 <h4>AdBlockRule.isComment</h4>
228 <b>isComment</b>(<i></i>)
229 <p>
230 Public method to check, if this is a comment.
231 </p><dl>
232 <dt>Returns:</dt>
233 <dd>
234 flag indicating a comment (boolean)
235 </dd>
236 </dl><a NAME="AdBlockRule.isDocument" ID="AdBlockRule.isDocument"></a>
237 <h4>AdBlockRule.isDocument</h4>
238 <b>isDocument</b>(<i></i>)
239 <p>
240 Public method to check, if this is a document rule.
241 </p><dl>
242 <dt>Returns:</dt>
243 <dd>
244 flag indicating a document rule (boolean)
245 </dd>
246 </dl><a NAME="AdBlockRule.isDomainRestricted" ID="AdBlockRule.isDomainRestricted"></a>
247 <h4>AdBlockRule.isDomainRestricted</h4>
248 <b>isDomainRestricted</b>(<i></i>)
249 <p>
250 Public method to check, if this rule is restricted by domain.
251 </p><dl>
252 <dt>Returns:</dt>
253 <dd>
254 flag indicating a domain restriction (boolean)
255 </dd>
256 </dl><a NAME="AdBlockRule.isElementHiding" ID="AdBlockRule.isElementHiding"></a>
257 <h4>AdBlockRule.isElementHiding</h4>
258 <b>isElementHiding</b>(<i></i>)
259 <p>
260 Public method to check, if this is an element hiding rule.
261 </p><dl>
262 <dt>Returns:</dt>
263 <dd>
264 flag indicating an element hiding rule (boolean)
265 </dd>
266 </dl><a NAME="AdBlockRule.isEnabled" ID="AdBlockRule.isEnabled"></a>
267 <h4>AdBlockRule.isEnabled</h4>
268 <b>isEnabled</b>(<i></i>)
269 <p>
270 Public method to check, if the rule is enabled.
271 </p><dl>
272 <dt>Returns:</dt>
273 <dd>
274 flag indicating enabled state (boolean)
275 </dd>
276 </dl><a NAME="AdBlockRule.isException" ID="AdBlockRule.isException"></a>
277 <h4>AdBlockRule.isException</h4>
278 <b>isException</b>(<i></i>)
279 <p>
280 Public method to check, if the rule defines an exception.
281 </p><dl>
282 <dt>Returns:</dt>
283 <dd>
284 flag indicating an exception (boolean)
285 </dd>
286 </dl><a NAME="AdBlockRule.isHeader" ID="AdBlockRule.isHeader"></a>
287 <h4>AdBlockRule.isHeader</h4>
288 <b>isHeader</b>(<i></i>)
289 <p>
290 Public method to check, if this is a header.
291 </p><dl>
292 <dt>Returns:</dt>
293 <dd>
294 flag indicating a header (boolean)
295 </dd>
296 </dl><a NAME="AdBlockRule.isInternalDisabled" ID="AdBlockRule.isInternalDisabled"></a>
297 <h4>AdBlockRule.isInternalDisabled</h4>
298 <b>isInternalDisabled</b>(<i></i>)
299 <p>
300 Public method to check, if this rule was disabled internally.
301 </p><dl>
302 <dt>Returns:</dt>
303 <dd>
304 flag indicating an internally disabled rule (boolean)
305 </dd>
306 </dl><a NAME="AdBlockRule.isSlow" ID="AdBlockRule.isSlow"></a>
307 <h4>AdBlockRule.isSlow</h4>
308 <b>isSlow</b>(<i></i>)
309 <p>
310 Public method to check, if this is a slow rule.
311 </p><dl>
312 <dt>Returns:</dt>
313 <dd>
314 flag indicating a slow rule (boolean)
315 </dd>
316 </dl><a NAME="AdBlockRule.matchDomain" ID="AdBlockRule.matchDomain"></a>
317 <h4>AdBlockRule.matchDomain</h4>
318 <b>matchDomain</b>(<i>domain</i>)
319 <p>
320 Public method to match a domain.
321 </p><dl>
322 <dt><i>domain</i></dt>
323 <dd>
324 domain name to check (string)
325 </dd>
326 </dl><dl>
327 <dt>Returns:</dt>
328 <dd>
329 flag indicating a match (boolean)
330 </dd>
331 </dl><a NAME="AdBlockRule.matchObject" ID="AdBlockRule.matchObject"></a>
332 <h4>AdBlockRule.matchObject</h4>
333 <b>matchObject</b>(<i>req</i>)
334 <p>
335 Public slot to match an object rule.
336 </p><dl>
337 <dt><i>req</i></dt>
338 <dd>
339 request object to check (QNetworkRequest)
340 </dd>
341 </dl><dl>
342 <dt>Returns:</dt>
343 <dd>
344 flag indicating a match (boolean)
345 </dd>
346 </dl><a NAME="AdBlockRule.matchSubdocument" ID="AdBlockRule.matchSubdocument"></a>
347 <h4>AdBlockRule.matchSubdocument</h4>
348 <b>matchSubdocument</b>(<i>req</i>)
349 <p>
350 Public slot to match a sub-document rule.
351 </p><dl>
352 <dt><i>req</i></dt>
353 <dd>
354 request object to check (QNetworkRequest)
355 </dd>
356 </dl><dl>
357 <dt>Returns:</dt>
358 <dd>
359 flag indicating a match (boolean)
360 </dd>
361 </dl><a NAME="AdBlockRule.matchThirdParty" ID="AdBlockRule.matchThirdParty"></a>
362 <h4>AdBlockRule.matchThirdParty</h4>
363 <b>matchThirdParty</b>(<i>req</i>)
364 <p>
365 Public slot to match a third-party rule.
366 </p><dl>
367 <dt><i>req</i></dt>
368 <dd>
369 request object to check (QNetworkRequest)
370 </dd>
371 </dl><dl>
372 <dt>Returns:</dt>
373 <dd>
374 flag indicating a match (boolean)
375 </dd>
376 </dl><a NAME="AdBlockRule.matchXmlHttpRequest" ID="AdBlockRule.matchXmlHttpRequest"></a>
377 <h4>AdBlockRule.matchXmlHttpRequest</h4>
378 <b>matchXmlHttpRequest</b>(<i>req</i>)
379 <p>
380 Public slot to match a XmlHttpRequest rule.
381 </p><dl>
382 <dt><i>req</i></dt>
383 <dd>
384 request object to check (QNetworkRequest)
385 </dd>
386 </dl><dl>
387 <dt>Returns:</dt>
388 <dd>
389 flag indicating a match (boolean)
390 </dd>
391 </dl><a NAME="AdBlockRule.networkMatch" ID="AdBlockRule.networkMatch"></a>
392 <h4>AdBlockRule.networkMatch</h4>
393 <b>networkMatch</b>(<i>request, domain, encodedUrl</i>)
394 <p>
395 Public method to check the rule for a match.
396 </p><dl>
397 <dt><i>request</i></dt>
398 <dd>
399 reference to the network request (QNetworkRequest)
400 </dd><dt><i>domain</i></dt>
401 <dd>
402 domain name (string)
403 </dd><dt><i>encodedUrl</i></dt>
404 <dd>
405 string encoded URL to be checked (string)
406 </dd>
407 </dl><dl>
408 <dt>Returns:</dt>
409 <dd>
410 flag indicating a match (boolean)
411 </dd>
412 </dl><a NAME="AdBlockRule.setEnabled" ID="AdBlockRule.setEnabled"></a>
413 <h4>AdBlockRule.setEnabled</h4>
414 <b>setEnabled</b>(<i>enabled</i>)
415 <p>
416 Public method to set the rule's enabled state.
417 </p><dl>
418 <dt><i>enabled</i></dt>
419 <dd>
420 flag indicating the new enabled state (boolean)
421 </dd>
422 </dl><a NAME="AdBlockRule.setException" ID="AdBlockRule.setException"></a>
423 <h4>AdBlockRule.setException</h4>
424 <b>setException</b>(<i>exception</i>)
425 <p>
426 Public method to set the rule's exception flag.
427 </p><dl>
428 <dt><i>exception</i></dt>
429 <dd>
430 flag indicating an exception rule (boolean)
431 </dd>
432 </dl><a NAME="AdBlockRule.setFilter" ID="AdBlockRule.setFilter"></a>
433 <h4>AdBlockRule.setFilter</h4>
434 <b>setFilter</b>(<i>filter</i>)
435 <p>
436 Public method to set the rule filter string.
437 </p><dl>
438 <dt><i>filter</i></dt>
439 <dd>
440 rule filter string (string)
441 </dd>
442 </dl><a NAME="AdBlockRule.subscription" ID="AdBlockRule.subscription"></a>
443 <h4>AdBlockRule.subscription</h4>
444 <b>subscription</b>(<i></i>)
445 <p>
446 Public method to get the subscription this rule belongs to.
447 </p><dl>
448 <dt>Returns:</dt>
449 <dd>
450 subscription of the rule (AdBlockSubscription)
451 </dd>
452 </dl><a NAME="AdBlockRule.urlMatch" ID="AdBlockRule.urlMatch"></a>
453 <h4>AdBlockRule.urlMatch</h4>
454 <b>urlMatch</b>(<i>url</i>)
455 <p>
456 Public method to check an URL against the rule.
457 </p><dl>
458 <dt><i>url</i></dt>
459 <dd>
460 URL to check (QUrl)
461 </dd>
462 </dl><dl>
463 <dt>Returns:</dt>
464 <dd>
465 flag indicating a match (boolean)
466 </dd>
467 </dl>
468 <div align="right"><a href="#top">Up</a></div>
469 <hr /><hr />
470 <a NAME="toSecondLevelDomain" ID="toSecondLevelDomain"></a>
471 <h2>toSecondLevelDomain</h2>
472 <b>toSecondLevelDomain</b>(<i>url</i>)
473 <p>
474 Module function to get a second level domain from the given URL.
475 </p><dl>
476 <dt><i>url</i></dt>
477 <dd>
478 URL to extract domain from (QUrl)
479 </dd>
480 </dl><dl>
481 <dt>Returns:</dt>
482 <dd>
483 name of second level domain (string)
484 </dd>
485 </dl>
486 <div align="right"><a href="#top">Up</a></div>
487 <hr />
488 </body></html>

eric ide

mercurial