diff -r 36c4b21c9f7b -r 0a44aff88bfa WebBrowser/AdBlock/AdBlockPage.py --- a/WebBrowser/AdBlock/AdBlockPage.py Mon Mar 14 20:48:01 2016 +0100 +++ b/WebBrowser/AdBlock/AdBlockPage.py Tue Mar 15 19:47:54 2016 +0100 @@ -9,7 +9,7 @@ from __future__ import unicode_literals -from PyQt5.QtCore import QObject, QUrl +from PyQt5.QtCore import QObject from ..Tools import Scripts @@ -37,67 +37,3 @@ if elementHiding: script = Scripts.setCss(elementHiding) page.runJavaScript(script) -## docElement = page.mainFrame().documentElement() -## -## for entry in page.getAdBlockedPageEntries(): -## urlString = entry.urlString() -## if urlString.endswith((".js", ".css")): -## continue -## -## urlEnd = "" -## pos = urlString.rfind("/") -## if pos >= 0: -## urlEnd = urlString[pos + 1:] -## if urlString.endswith("/"): -## urlEnd = urlString[:-1] -## -## selector = \ -## 'img[src$="{0}"], iframe[src$="{0}"], embed[src$="{0}"]'\ -## .format(urlEnd) -## elements = docElement.findAll(selector) -## -## for element in elements: -## src = element.attribute("src") -## src = src.replace("../", "") -## if src in urlString: -## element.setStyleProperty("display", "none") -## -## -## elementHiding += "{display: none !important;}\n</style>" -## -## bodyElement = docElement.findFirst("body") -## bodyElement.appendInside( -## '<style type="text/css">\n/* AdBlock for eric */\n' + -## elementHiding) -## -## -##class AdBlockedPageEntry(object): -## """ -## Class implementing a data structure for web page rules. -## """ -## def __init__(self, rule, url): -## """ -## Constructor -## -## @param rule AdBlock rule to add (AdBlockRule) -## @param url URL that matched the rule (QUrl) -## """ -## self.rule = rule -## self.url = QUrl(url) -## -## def __eq__(self, other): -## """ -## Special method to test equality. -## -## @param other reference to the other entry (AdBlockedPageEntry) -## @return flag indicating equality (boolean) -## """ -## return self.rule == other.rule and self.url == other.url -## -## def urlString(self): -## """ -## Public method to get the URL as a string. -## -## @return URL as a string (string) -## """ -## return self.url.toString()