On Thu, Sep 22, 2016 at 10:22:14AM +0200, git_AT_suckless.org wrote:
> commit da5290a41aac4eabef83f6b88039f44d28b0ea00
> Author: Quentin Rameau <quinq_AT_fifth.space>
> AuthorDate: Mon Nov 23 22:12:00 2015 +0100
> Commit: Quentin Rameau <quinq_AT_fifth.space>
> CommitDate: Thu Sep 22 10:21:31 2016 +0200
>
> Add support for loading Webkit extensions
>
I like it, I like it alawt[0]. For the interested I'm working on an
adblocker (with emotional support from Quentin).
It is a work-in-progress but available at:
https://git.codemadness.org/surf-adblock/files.html
For now it can only read adblock/ublock rules in a basic manner and block
basic content types.
Have fun and happy hacking!
[0] -
https://www.youtube.com/watch?v=28GLa9T2CtI
> diff --git a/config.mk b/config.mk
> index e71316c..c0a9959 100644
> --- a/config.mk
> +++ b/config.mk
> _AT_@ -6,6 +6,7 @@ VERSION = 0.6
> # paths
> PREFIX = /usr/local
> MANPREFIX = ${PREFIX}/share/man
> +LIBPREFIX = ${PREFIX}/lib/surf
>
> X11INC = /usr/X11R6/include
> X11LIB = /usr/X11R6/lib
> _AT_@ -18,7 +19,7 @@ INCS = -I. -I/usr/include -I${X11INC} ${GTKINC}
> LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${GTKLIB} -lgthread-2.0
>
> # flags
> -CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE
> +CPPFLAGS = -DVERSION=\"${VERSION}\" -DWEBEXTDIR=\"${LIBPREFIX}\" -D_DEFAULT_SOURCE
> CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
> LDFLAGS = -s ${LIBS}
>
> diff --git a/surf.c b/surf.c
> index 29b9ede..fb3ef81 100644
> --- a/surf.c
> +++ b/surf.c
> _AT_@ -175,6 +175,7 @@ static void cleanup(void);
>
> /* GTK/WebKit */
> static WebKitWebView *newview(Client *c, WebKitWebView *rv);
> +static void initwebextensions(WebKitWebContext *wc, Client *c);
> static GtkWidget *createview(WebKitWebView *v, WebKitNavigationAction *a,
> Client *c);
> static gboolean buttonreleased(GtkWidget *w, GdkEvent *e, Client *c);
> _AT_@ -980,6 +981,8 @@ newview(Client *c, WebKitWebView *rv)
>
> g_signal_connect(G_OBJECT(context), "download-started",
> G_CALLBACK(downloadstarted), c);
> + g_signal_connect(G_OBJECT(context), "initialize-web-extensions",
> + G_CALLBACK(initwebextensions), c);
>
> v = g_object_new(WEBKIT_TYPE_WEB_VIEW,
> "settings", settings,
> _AT_@ -1012,6 +1015,12 @@ newview(Client *c, WebKitWebView *rv)
> return v;
> }
>
> +void
> +initwebextensions(WebKitWebContext *wc, Client *c)
> +{
> + webkit_web_context_set_web_extensions_directory(wc, WEBEXTDIR);
> +}
> +
> GtkWidget *
> createview(WebKitWebView *v, WebKitNavigationAction *a, Client *c)
> {
>
--
Kind regards,
Hiltjo
Received on Fri Sep 23 2016 - 12:58:39 CEST