--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Documentation/Source/eric6.Helpviewer.AdBlock.AdBlockRule.html Sat Jul 05 12:29:15 2014 +0200 @@ -0,0 +1,488 @@ +<!DOCTYPE html> +<html><head> +<title>eric6.Helpviewer.AdBlock.AdBlockRule</title> +<meta charset="UTF-8"> +<style> +body { + background: #EDECE6; + margin: 0em 1em 10em 1em; + color: black; +} + +h1 { color: white; background: #85774A; } +h2 { color: white; background: #85774A; } +h3 { color: white; background: #9D936E; } +h4 { color: white; background: #9D936E; } + +a { color: #BA6D36; } + +</style> +</head> +<body><a NAME="top" ID="top"></a> +<h1>eric6.Helpviewer.AdBlock.AdBlockRule</h1> +<p> +Module implementing the AdBlock rule class. +</p> +<h3>Global Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> +<h3>Classes</h3> +<table> +<tr> +<td><a href="#AdBlockRule">AdBlockRule</a></td> +<td>Class implementing the AdBlock rule.</td> +</tr> +</table> +<h3>Functions</h3> +<table> +<tr> +<td><a href="#toSecondLevelDomain">toSecondLevelDomain</a></td> +<td>Module function to get a second level domain from the given URL.</td> +</tr> +</table> +<hr /><hr /> +<a NAME="AdBlockRule" ID="AdBlockRule"></a> +<h2>AdBlockRule</h2> +<p> + Class implementing the AdBlock rule. +</p> +<h3>Derived from</h3> +object +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> +<h3>Methods</h3> +<table> +<tr> +<td><a href="#AdBlockRule.__init__">AdBlockRule</a></td> +<td>Constructor</td> +</tr><tr> +<td><a href="#AdBlockRule.__convertPatternToRegExp">__convertPatternToRegExp</a></td> +<td>Private method to convert a wildcard pattern to a regular expression.</td> +</tr><tr> +<td><a href="#AdBlockRule.__parseDomains">__parseDomains</a></td> +<td>Private method to parse a string with a domain list.</td> +</tr><tr> +<td><a href="#AdBlockRule.__parseFilter">__parseFilter</a></td> +<td>Private method to parse the filter pattern.</td> +</tr><tr> +<td><a href="#AdBlockRule.cssSelector">cssSelector</a></td> +<td>Public method to get the CSS selector of the rule.</td> +</tr><tr> +<td><a href="#AdBlockRule.filter">filter</a></td> +<td>Public method to get the rule filter string.</td> +</tr><tr> +<td><a href="#AdBlockRule.isCSSRule">isCSSRule</a></td> +<td>Public method to check, if the rule is a CSS rule.</td> +</tr><tr> +<td><a href="#AdBlockRule.isComment">isComment</a></td> +<td>Public method to check, if this is a comment.</td> +</tr><tr> +<td><a href="#AdBlockRule.isDocument">isDocument</a></td> +<td>Public method to check, if this is a document rule.</td> +</tr><tr> +<td><a href="#AdBlockRule.isDomainRestricted">isDomainRestricted</a></td> +<td>Public method to check, if this rule is restricted by domain.</td> +</tr><tr> +<td><a href="#AdBlockRule.isElementHiding">isElementHiding</a></td> +<td>Public method to check, if this is an element hiding rule.</td> +</tr><tr> +<td><a href="#AdBlockRule.isEnabled">isEnabled</a></td> +<td>Public method to check, if the rule is enabled.</td> +</tr><tr> +<td><a href="#AdBlockRule.isException">isException</a></td> +<td>Public method to check, if the rule defines an exception.</td> +</tr><tr> +<td><a href="#AdBlockRule.isHeader">isHeader</a></td> +<td>Public method to check, if this is a header.</td> +</tr><tr> +<td><a href="#AdBlockRule.isInternalDisabled">isInternalDisabled</a></td> +<td>Public method to check, if this rule was disabled internally.</td> +</tr><tr> +<td><a href="#AdBlockRule.isSlow">isSlow</a></td> +<td>Public method to check, if this is a slow rule.</td> +</tr><tr> +<td><a href="#AdBlockRule.matchDomain">matchDomain</a></td> +<td>Public method to match a domain.</td> +</tr><tr> +<td><a href="#AdBlockRule.matchObject">matchObject</a></td> +<td>Public slot to match an object rule.</td> +</tr><tr> +<td><a href="#AdBlockRule.matchSubdocument">matchSubdocument</a></td> +<td>Public slot to match a sub-document rule.</td> +</tr><tr> +<td><a href="#AdBlockRule.matchThirdParty">matchThirdParty</a></td> +<td>Public slot to match a third-party rule.</td> +</tr><tr> +<td><a href="#AdBlockRule.matchXmlHttpRequest">matchXmlHttpRequest</a></td> +<td>Public slot to match a XmlHttpRequest rule.</td> +</tr><tr> +<td><a href="#AdBlockRule.networkMatch">networkMatch</a></td> +<td>Public method to check the rule for a match.</td> +</tr><tr> +<td><a href="#AdBlockRule.setEnabled">setEnabled</a></td> +<td>Public method to set the rule's enabled state.</td> +</tr><tr> +<td><a href="#AdBlockRule.setException">setException</a></td> +<td>Public method to set the rule's exception flag.</td> +</tr><tr> +<td><a href="#AdBlockRule.setFilter">setFilter</a></td> +<td>Public method to set the rule filter string.</td> +</tr><tr> +<td><a href="#AdBlockRule.subscription">subscription</a></td> +<td>Public method to get the subscription this rule belongs to.</td> +</tr><tr> +<td><a href="#AdBlockRule.urlMatch">urlMatch</a></td> +<td>Public method to check an URL against the rule.</td> +</tr> +</table> +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> +<a NAME="AdBlockRule.__init__" ID="AdBlockRule.__init__"></a> +<h4>AdBlockRule (Constructor)</h4> +<b>AdBlockRule</b>(<i>filter="", subscription=None</i>) +<p> + Constructor +</p><dl> +<dt><i>filter</i></dt> +<dd> +filter string of the rule (string) +</dd><dt><i>subscription</i></dt> +<dd> +reference to the subscription object + (AdBlockSubscription) +</dd> +</dl><a NAME="AdBlockRule.__convertPatternToRegExp" ID="AdBlockRule.__convertPatternToRegExp"></a> +<h4>AdBlockRule.__convertPatternToRegExp</h4> +<b>__convertPatternToRegExp</b>(<i>wildcardPattern</i>) +<p> + Private method to convert a wildcard pattern to a regular expression. +</p><dl> +<dt><i>wildcardPattern</i></dt> +<dd> +string containing the wildcard pattern (string) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +string containing a regular expression (string) +</dd> +</dl><a NAME="AdBlockRule.__parseDomains" ID="AdBlockRule.__parseDomains"></a> +<h4>AdBlockRule.__parseDomains</h4> +<b>__parseDomains</b>(<i>domains, separator</i>) +<p> + Private method to parse a string with a domain list. +</p><dl> +<dt><i>domains</i></dt> +<dd> +list of domains (string) +</dd><dt><i>separator</i></dt> +<dd> +separator character used by the list (string) +</dd> +</dl><a NAME="AdBlockRule.__parseFilter" ID="AdBlockRule.__parseFilter"></a> +<h4>AdBlockRule.__parseFilter</h4> +<b>__parseFilter</b>(<i></i>) +<p> + Private method to parse the filter pattern. +</p><a NAME="AdBlockRule.cssSelector" ID="AdBlockRule.cssSelector"></a> +<h4>AdBlockRule.cssSelector</h4> +<b>cssSelector</b>(<i></i>) +<p> + Public method to get the CSS selector of the rule. +</p><dl> +<dt>Returns:</dt> +<dd> +CSS selector (string) +</dd> +</dl><a NAME="AdBlockRule.filter" ID="AdBlockRule.filter"></a> +<h4>AdBlockRule.filter</h4> +<b>filter</b>(<i></i>) +<p> + Public method to get the rule filter string. +</p><dl> +<dt>Returns:</dt> +<dd> +rule filter string (string) +</dd> +</dl><a NAME="AdBlockRule.isCSSRule" ID="AdBlockRule.isCSSRule"></a> +<h4>AdBlockRule.isCSSRule</h4> +<b>isCSSRule</b>(<i></i>) +<p> + Public method to check, if the rule is a CSS rule. +</p><dl> +<dt>Returns:</dt> +<dd> +flag indicating a CSS rule (boolean) +</dd> +</dl><a NAME="AdBlockRule.isComment" ID="AdBlockRule.isComment"></a> +<h4>AdBlockRule.isComment</h4> +<b>isComment</b>(<i></i>) +<p> + Public method to check, if this is a comment. +</p><dl> +<dt>Returns:</dt> +<dd> +flag indicating a comment (boolean) +</dd> +</dl><a NAME="AdBlockRule.isDocument" ID="AdBlockRule.isDocument"></a> +<h4>AdBlockRule.isDocument</h4> +<b>isDocument</b>(<i></i>) +<p> + Public method to check, if this is a document rule. +</p><dl> +<dt>Returns:</dt> +<dd> +flag indicating a document rule (boolean) +</dd> +</dl><a NAME="AdBlockRule.isDomainRestricted" ID="AdBlockRule.isDomainRestricted"></a> +<h4>AdBlockRule.isDomainRestricted</h4> +<b>isDomainRestricted</b>(<i></i>) +<p> + Public method to check, if this rule is restricted by domain. +</p><dl> +<dt>Returns:</dt> +<dd> +flag indicating a domain restriction (boolean) +</dd> +</dl><a NAME="AdBlockRule.isElementHiding" ID="AdBlockRule.isElementHiding"></a> +<h4>AdBlockRule.isElementHiding</h4> +<b>isElementHiding</b>(<i></i>) +<p> + Public method to check, if this is an element hiding rule. +</p><dl> +<dt>Returns:</dt> +<dd> +flag indicating an element hiding rule (boolean) +</dd> +</dl><a NAME="AdBlockRule.isEnabled" ID="AdBlockRule.isEnabled"></a> +<h4>AdBlockRule.isEnabled</h4> +<b>isEnabled</b>(<i></i>) +<p> + Public method to check, if the rule is enabled. +</p><dl> +<dt>Returns:</dt> +<dd> +flag indicating enabled state (boolean) +</dd> +</dl><a NAME="AdBlockRule.isException" ID="AdBlockRule.isException"></a> +<h4>AdBlockRule.isException</h4> +<b>isException</b>(<i></i>) +<p> + Public method to check, if the rule defines an exception. +</p><dl> +<dt>Returns:</dt> +<dd> +flag indicating an exception (boolean) +</dd> +</dl><a NAME="AdBlockRule.isHeader" ID="AdBlockRule.isHeader"></a> +<h4>AdBlockRule.isHeader</h4> +<b>isHeader</b>(<i></i>) +<p> + Public method to check, if this is a header. +</p><dl> +<dt>Returns:</dt> +<dd> +flag indicating a header (boolean) +</dd> +</dl><a NAME="AdBlockRule.isInternalDisabled" ID="AdBlockRule.isInternalDisabled"></a> +<h4>AdBlockRule.isInternalDisabled</h4> +<b>isInternalDisabled</b>(<i></i>) +<p> + Public method to check, if this rule was disabled internally. +</p><dl> +<dt>Returns:</dt> +<dd> +flag indicating an internally disabled rule (boolean) +</dd> +</dl><a NAME="AdBlockRule.isSlow" ID="AdBlockRule.isSlow"></a> +<h4>AdBlockRule.isSlow</h4> +<b>isSlow</b>(<i></i>) +<p> + Public method to check, if this is a slow rule. +</p><dl> +<dt>Returns:</dt> +<dd> +flag indicating a slow rule (boolean) +</dd> +</dl><a NAME="AdBlockRule.matchDomain" ID="AdBlockRule.matchDomain"></a> +<h4>AdBlockRule.matchDomain</h4> +<b>matchDomain</b>(<i>domain</i>) +<p> + Public method to match a domain. +</p><dl> +<dt><i>domain</i></dt> +<dd> +domain name to check (string) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +flag indicating a match (boolean) +</dd> +</dl><a NAME="AdBlockRule.matchObject" ID="AdBlockRule.matchObject"></a> +<h4>AdBlockRule.matchObject</h4> +<b>matchObject</b>(<i>req</i>) +<p> + Public slot to match an object rule. +</p><dl> +<dt><i>req</i></dt> +<dd> +request object to check (QNetworkRequest) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +flag indicating a match (boolean) +</dd> +</dl><a NAME="AdBlockRule.matchSubdocument" ID="AdBlockRule.matchSubdocument"></a> +<h4>AdBlockRule.matchSubdocument</h4> +<b>matchSubdocument</b>(<i>req</i>) +<p> + Public slot to match a sub-document rule. +</p><dl> +<dt><i>req</i></dt> +<dd> +request object to check (QNetworkRequest) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +flag indicating a match (boolean) +</dd> +</dl><a NAME="AdBlockRule.matchThirdParty" ID="AdBlockRule.matchThirdParty"></a> +<h4>AdBlockRule.matchThirdParty</h4> +<b>matchThirdParty</b>(<i>req</i>) +<p> + Public slot to match a third-party rule. +</p><dl> +<dt><i>req</i></dt> +<dd> +request object to check (QNetworkRequest) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +flag indicating a match (boolean) +</dd> +</dl><a NAME="AdBlockRule.matchXmlHttpRequest" ID="AdBlockRule.matchXmlHttpRequest"></a> +<h4>AdBlockRule.matchXmlHttpRequest</h4> +<b>matchXmlHttpRequest</b>(<i>req</i>) +<p> + Public slot to match a XmlHttpRequest rule. +</p><dl> +<dt><i>req</i></dt> +<dd> +request object to check (QNetworkRequest) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +flag indicating a match (boolean) +</dd> +</dl><a NAME="AdBlockRule.networkMatch" ID="AdBlockRule.networkMatch"></a> +<h4>AdBlockRule.networkMatch</h4> +<b>networkMatch</b>(<i>request, domain, encodedUrl</i>) +<p> + Public method to check the rule for a match. +</p><dl> +<dt><i>request</i></dt> +<dd> +reference to the network request (QNetworkRequest) +</dd><dt><i>domain</i></dt> +<dd> +domain name (string) +</dd><dt><i>encodedUrl</i></dt> +<dd> +string encoded URL to be checked (string) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +flag indicating a match (boolean) +</dd> +</dl><a NAME="AdBlockRule.setEnabled" ID="AdBlockRule.setEnabled"></a> +<h4>AdBlockRule.setEnabled</h4> +<b>setEnabled</b>(<i>enabled</i>) +<p> + Public method to set the rule's enabled state. +</p><dl> +<dt><i>enabled</i></dt> +<dd> +flag indicating the new enabled state (boolean) +</dd> +</dl><a NAME="AdBlockRule.setException" ID="AdBlockRule.setException"></a> +<h4>AdBlockRule.setException</h4> +<b>setException</b>(<i>exception</i>) +<p> + Public method to set the rule's exception flag. +</p><dl> +<dt><i>exception</i></dt> +<dd> +flag indicating an exception rule (boolean) +</dd> +</dl><a NAME="AdBlockRule.setFilter" ID="AdBlockRule.setFilter"></a> +<h4>AdBlockRule.setFilter</h4> +<b>setFilter</b>(<i>filter</i>) +<p> + Public method to set the rule filter string. +</p><dl> +<dt><i>filter</i></dt> +<dd> +rule filter string (string) +</dd> +</dl><a NAME="AdBlockRule.subscription" ID="AdBlockRule.subscription"></a> +<h4>AdBlockRule.subscription</h4> +<b>subscription</b>(<i></i>) +<p> + Public method to get the subscription this rule belongs to. +</p><dl> +<dt>Returns:</dt> +<dd> +subscription of the rule (AdBlockSubscription) +</dd> +</dl><a NAME="AdBlockRule.urlMatch" ID="AdBlockRule.urlMatch"></a> +<h4>AdBlockRule.urlMatch</h4> +<b>urlMatch</b>(<i>url</i>) +<p> + Public method to check an URL against the rule. +</p><dl> +<dt><i>url</i></dt> +<dd> +URL to check (QUrl) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +flag indicating a match (boolean) +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> +<a NAME="toSecondLevelDomain" ID="toSecondLevelDomain"></a> +<h2>toSecondLevelDomain</h2> +<b>toSecondLevelDomain</b>(<i>url</i>) +<p> + Module function to get a second level domain from the given URL. +</p><dl> +<dt><i>url</i></dt> +<dd> +URL to extract domain from (QUrl) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +name of second level domain (string) +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html> \ No newline at end of file