Helpviewer/AdBlock/AdBlockRule.py

changeset 1994
84d55b34ba5a
parent 1963
9c5b3235abf9
child 2302
f29e9405c851
equal deleted inserted replaced
1993:5038ab5ff88f 1994:84d55b34ba5a
116 Private method to parse the filter pattern. 116 Private method to parse the filter pattern.
117 """ 117 """
118 parsedLine = self.__filter 118 parsedLine = self.__filter
119 119
120 # empty rule or just a comment 120 # empty rule or just a comment
121 if not parsedLine.strip() or parsedLine.startswith("!"): 121 if not parsedLine.strip() or parsedLine.startswith(("!", "[Adblock")):
122 self.__enabled = False 122 self.__enabled = False
123 return 123 return
124 124
125 # CSS element hiding rule 125 # CSS element hiding rule
126 if "##" in parsedLine: 126 if "##" in parsedLine:
502 Public method to check, if this is a comment. 502 Public method to check, if this is a comment.
503 503
504 @return flag indicating a comment (boolean) 504 @return flag indicating a comment (boolean)
505 """ 505 """
506 return self.__filter.startswith("!") 506 return self.__filter.startswith("!")
507
508 def isHeader(self):
509 """
510 Public method to check, if this is a header.
511
512 @return flag indicating a header (boolean)
513 """
514 return self.__filter.startswith("[Adblock")
507 515
508 def isSlow(self): 516 def isSlow(self):
509 """ 517 """
510 Public method to check, if this is a slow rule. 518 Public method to check, if this is a slow rule.
511 519

eric ide

mercurial