sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

surf-0.4.1-togglejs.diff (1889B)


      1 diff -r 71388899ac09 config.def.h
      2 --- a/config.def.h	Tue Jun 08 09:06:10 2010 +0200
      3 +++ b/config.def.h	Mon Sep 26 23:23:29 2011 +0100
      4 @@ -33,6 +33,7 @@
      5      { MODKEY,               GDK_k,      scroll,     { .i = -1 } },
      6      { 0,                    GDK_Escape, stop,       { 0 } },
      7      { MODKEY,               GDK_o,      source,     { 0 } },
      8 +    { MODKEY,               GDK_s,      togglescript, { .b = FALSE } },
      9      { MODKEY,               GDK_g,      spawn,      SETPROP("_SURF_URI", "_SURF_GO") },
     10      { MODKEY,               GDK_slash,  spawn,      SETPROP("_SURF_FIND", "_SURF_FIND") },
     11      { MODKEY,               GDK_n,      find,       { .b = TRUE } },
     12 diff -r 71388899ac09 surf.1
     13 --- a/surf.1	Tue Jun 08 09:06:10 2010 +0200
     14 +++ b/surf.1	Mon Sep 26 23:23:29 2011 +0100
     15 @@ -87,6 +87,9 @@
     16  .B Ctrl\-y
     17  Copies current URI to primary selection.
     18  .TP
     19 +.B Ctrl\-s
     20 +Toggles javascript.
     21 +.TP
     22  .B Ctrl\-o
     23  show the sourcecode of the current page.
     24  .SH SEE ALSO
     25 diff -r 71388899ac09 surf.c
     26 --- a/surf.c	Tue Jun 08 09:06:10 2010 +0200
     27 +++ b/surf.c	Mon Sep 26 23:23:29 2011 +0100
     28 @@ -104,6 +104,7 @@
     29  static void source(Client *c, const Arg *arg);
     30  static void spawn(Client *c, const Arg *arg);
     31  static void stop(Client *c, const Arg *arg);
     32 +static void togglescript(Client *c, const Arg *arg);
     33  static void titlechange(WebKitWebView *v, WebKitWebFrame* frame, const char* title, Client *c);
     34  static void update(Client *c);
     35  static void updatewinid(Client *c);
     36 @@ -158,6 +159,17 @@
     37  }
     38  
     39  void
     40 +togglescript(Client *c, const Arg *arg) {
     41 +	WebKitWebSettings *settings;
     42 +	gboolean script;
     43 +
     44 +	settings = webkit_web_view_get_settings(c->view);
     45 +	g_object_get(G_OBJECT(settings), "enable-scripts", &script, NULL);
     46 +	g_object_set(G_OBJECT(settings), "enable-scripts", !script, NULL);
     47 +	reload(c, arg);
     48 +}
     49 +
     50 +void
     51  clipboard(Client *c, const Arg *arg) {
     52  	gboolean paste = *(gboolean *)arg;
     53