I've rather changed my mind about surf. While webkit-gtk is a very 
long way from suckless, surf is somewhat hackable (depending on the 
task), and script.js is quite useful if you're prepared to roll up 
your sleeves and do battle with js & the dom.

Netsurf has proven less stable than I'd like (I still wish it the 
best, and look forward to its progress), and dillo's lack of 
extension through something akin to script.js just makes it less 
useful than I'd like.

Anyway, I'm attaching a patch which adds a keybinding to toggle 
script enabling. I find it useful, not least to be able to enable 
scripts to use something in script.js (like link hints), then 
disable it again.

In other news, I happen to be very fond of my ssl verification patch 
- http://lists.suckless.org/dev/1102/7041.html - could someone wise
and trustworthy consider applying it?  (incidentally, I looked 
into a ssh-style trusted site fingerprints model, and it's 
basically impossible to do with libsoup at present. this is a good 
example of why building on top of horrible enormous libraries is a 
nasty thing to do if it can be avoided.)
diff -r 2533f186089d config.def.h
--- a/config.def.h      Thu Mar 31 12:52:35 2011 +0200
+++ b/config.def.h      Sat Aug 20 17:35:55 2011 +0100
@@ -33,6 +33,7 @@
     { MODKEY,               GDK_k,      scroll,     { .i = -1 } },
     { 0,                    GDK_Escape, stop,       { 0 } },
     { MODKEY,               GDK_o,      source,     { 0 } },
+    { MODKEY,               GDK_s,      togglescript, { 0 } },
     { MODKEY,               GDK_g,      spawn,      SETPROP("_SURF_URI", 
"_SURF_GO") },
     { MODKEY,               GDK_f,      spawn,      SETPROP("_SURF_FIND", 
"_SURF_FIND") },
     { MODKEY,               GDK_n,      find,       { .b = TRUE } },
diff -r 2533f186089d surf.1
--- a/surf.1    Thu Mar 31 12:52:35 2011 +0200
+++ b/surf.1    Sat Aug 20 17:35:55 2011 +0100
@@ -87,6 +87,9 @@
 .B Ctrl\-y
 Copies current URI to primary selection.
 .TP
+.B Ctrl\-s
+Toggles javascript.
+.TP
 .B Ctrl\-o
 show the sourcecode of the current page.
 .SH SEE ALSO
diff -r 2533f186089d surf.c
--- a/surf.c    Thu Mar 31 12:52:35 2011 +0200
+++ b/surf.c    Sat Aug 20 17:35:55 2011 +0100
@@ -104,6 +104,7 @@
 static void source(Client *c, const Arg *arg);
 static void spawn(Client *c, const Arg *arg);
 static void stop(Client *c, const Arg *arg);
+static void togglescript(Client *c, const Arg *arg);
 static void titlechange(WebKitWebView *v, WebKitWebFrame* frame, const char* 
title, Client *c);
 static void update(Client *c);
 static void updatewinid(Client *c);
@@ -158,6 +159,16 @@
 }
 
 void
+togglescript(Client *c, const Arg *arg) {
+       WebKitWebSettings *settings;
+       gboolean script;
+
+       settings = webkit_web_view_get_settings(c->view);
+       g_object_get(G_OBJECT(settings), "enable-scripts", &script, NULL);
+       g_object_set(G_OBJECT(settings), "enable-scripts", !script, NULL);
+}
+
+void
 clipboard(Client *c, const Arg *arg) {
        gboolean paste = *(gboolean *)arg;
 

Attachment: pgpmIqjKZh84o.pgp
Description: PGP signature

Reply via email to