Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser: Add CSS based Adblock plugin #336

Merged
merged 5 commits into from Jul 13, 2020

Conversation

HollowMan6
Copy link
Contributor

Add the CSS-based Adblock functionality for browser.

An example of Adblock CSS is provide at core/adblock.css from http://www.floppymoose.com/ , users can customize their own rules.

Use C-d to enable or disable adblock.

Here is a demo which shows the effect of block Google ADs when enable and disable adblock at my website under the provided CSS file:
image
image

Signed-off-by: Hollow Man <hollowman186@vip.qq.com>
core/browser.py Outdated Show resolved Hide resolved
Signed-off-by: Hollow Man <hollowman186@vip.qq.com>
eaf.el Outdated Show resolved Hide resolved
Signed-off-by: Hollow Man <hollowman186@vip.qq.com>
Signed-off-by: Mingde (Matthew) Zeng <matthewzmd@gmail.com>
Signed-off-by: Mingde (Matthew) Zeng <matthewzmd@gmail.com>
@MatthewZMD MatthewZMD merged commit f692b43 into emacs-eaf:master Jul 13, 2020
@MatthewZMD
Copy link
Member

MatthewZMD commented Jul 13, 2020

现在有个问题,x尝试关闭页面会在*eaf* buffer弹出以下错误

Traceback (most recent call last):
  File "/home/mt/.emacs.d/site-elisp/emacs-application-framework/app/browser/buffer.py", line 66, in set_adblocker
    self.buffer_widget.load_adblocker()
  File "/home/mt/.emacs.d/site-elisp/emacs-application-framework/core/browser.py", line 107, in load_adblocker
    self.load_css(os.path.join(os.path.dirname(__file__), "adblocker.css"),'adblocker')
  File "/home/mt/.emacs.d/site-elisp/emacs-application-framework/core/browser.py", line 98, in load_css
    self.web_page.runJavaScript(SCRIPT, QWebEngineScript.ApplicationWorld)
RuntimeError: wrapped C/C++ object of type BrowserPage has been deleted

我暂时revert了。

manateelazycat pushed a commit that referenced this pull request Jul 13, 2020
Signed-off-by: Hollow Man <hollowman186@vip.qq.com>
manateelazycat added a commit that referenced this pull request Jul 13, 2020
Fix bug in Browser: Add CSS based Adblock plugin #336
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants