aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Barrucadu <mike@barrucadu.co.uk>2009-05-03 19:32:49 +0100
committerGravatar Barrucadu <mike@barrucadu.co.uk>2009-05-03 19:32:49 +0100
commit01cfcffd7762edd4bed94e91b2013890680765a9 (patch)
tree1c9269911972d6a71628a16732c055c18feae630
parentd0dfcc7ad664f4ff25ade28a38a2157ce4fda94d (diff)
Added command "script" to run javascript on the current page.
-rw-r--r--CHECKLIST1
-rw-r--r--examples/configs/sampleconfig2
-rw-r--r--examples/configs/sampleconfig-dev1
-rw-r--r--uzbl.c7
-rw-r--r--uzbl.h3
5 files changed, 13 insertions, 1 deletions
diff --git a/CHECKLIST b/CHECKLIST
index 9a9bfbf..66f7bf6 100644
--- 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
diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig
index 6f4d8d9..e4fd3a6 100644
--- a/examples/configs/sampleconfig
+++ b/examples/configs/sampleconfig
@@ -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 =
diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev
index 7e1e31d..7ce220f 100644
--- a/examples/configs/sampleconfig-dev
+++ b/examples/configs/sampleconfig-dev
@@ -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
--- 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
--- 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: */