Added command "script" to run javascript on the current page.
authorBarrucadu <mike@barrucadu.co.uk>
Sun, 3 May 2009 18:32:49 +0000 (19:32 +0100)
committerBarrucadu <mike@barrucadu.co.uk>
Sun, 3 May 2009 18:32:49 +0000 (19:32 +0100)
CHECKLIST
examples/configs/sampleconfig
examples/configs/sampleconfig-dev
uzbl.c
uzbl.h

index 9a9bfbf..66f7bf6 100644 (file)
--- a/CHECKLIST
+++ b/CHECKLIST
@@ -34,3 +34,4 @@ Also testers and interested people can use this list to see what uzbl is about,
 * searching:
   /_ = search %s <-- hilight all
   ; = search <-- jump over all hits
+* run javascript on curent page through "script" command.
\ No newline at end of file
index 6f4d8d9..e4fd3a6 100644 (file)
@@ -50,7 +50,7 @@ B = spawn /usr/share/uzbl/examples/scripts/insert_bookmark.sh
 u = spawn /usr/share/uzbl/examples/scripts/load_url_from_history.sh
 U = spawn /usr/share/uzbl/examples/scripts/load_url_from_bookmarks.sh
 ZZ = exit
-
+S = script alert("hi");
 
 [network]
 proxy_server = 
index 7e1e31d..7ce220f 100644 (file)
@@ -50,6 +50,7 @@ B = spawn ./examples/scripts/insert_bookmark.sh
 u = spawn ./examples/scripts/load_url_from_history.sh
 U = spawn ./examples/scripts/load_url_from_bookmarks.sh
 ZZ = exit
+S = script alert("hi");
 
 [network]
 # to start a local socks server, do : ssh -fND localhost:8118 localhost
diff --git a/uzbl.c b/uzbl.c
index 2f24b56..edd0b38 100644 (file)
--- a/uzbl.c
+++ b/uzbl.c
@@ -303,6 +303,7 @@ static struct {char *name; Command command;} cmdlist[] =
     { "zoom_in",        view_zoom_in,      }, //Can crash (when max zoom reached?).
     { "zoom_out",       view_zoom_out,     },
     { "uri",            load_uri           },
+    { "script",         run_js             },
     { "toggle_status",  toggle_status_cb   },
     { "spawn",          spawn              },
     { "exit",           close_uzbl         },
@@ -375,6 +376,12 @@ load_uri (WebKitWebView * web_view, const gchar *param) {
 }
 
 static void
+run_js (WebKitWebView * web_view, const gchar *param) {
+    if (param)
+        webkit_web_view_execute_script (web_view, param);
+}
+
+static void
 search_text (WebKitWebView *page, const char *param) {
     if ((param) && (param[0] != '\0')) {
         strcpy(searchtx, param);
diff --git a/uzbl.h b/uzbl.h
index f9e3053..f81e3f6 100644 (file)
--- a/uzbl.h
+++ b/uzbl.h
@@ -119,4 +119,7 @@ settings_init ();
 static void
 search_text (WebKitWebView *page, const char *param);
 
+static void
+run_js (WebKitWebView * web_view, const gchar *param);
+
 /* vi: set et ts=4: */