diff options
author | Robert Manea <gotmor@gmail.com> | 2009-06-16 10:38:54 +0200 |
---|---|---|
committer | Robert Manea <gotmor@gmail.com> | 2009-06-16 10:38:54 +0200 |
commit | 5197965d064e9fc373098552f4c4395e7be8be41 (patch) | |
tree | cbac0c5209ddc2107143c2e0152af6eba6438f67 /uzbl.c | |
parent | b5aac3dc171a3c29c129161c9f18c2b5f0b9b997 (diff) |
added JS expansion command @<java script>
Diffstat (limited to 'uzbl.c')
-rw-r--r-- | uzbl.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -192,7 +192,7 @@ make_var_to_name_hash() { /* --- UTILITY FUNCTIONS --- */ -enum {EXP_ERR, EXP_SIMPLE_VAR, EXP_BRACED_VAR, EXP_EXPR}; +enum {EXP_ERR, EXP_SIMPLE_VAR, EXP_BRACED_VAR, EXP_EXPR, EXP_JS}; static guint get_exp_type(gchar *s) { /* variables */ @@ -200,6 +200,8 @@ get_exp_type(gchar *s) { return EXP_EXPR; else if(*(s+1) == '{') return EXP_BRACED_VAR; + else if(*(s+1) == '<') + return EXP_JS; else return EXP_SIMPLE_VAR; @@ -220,6 +222,7 @@ expand(char *s, gboolean recurse) { gchar *cmd_stdout = NULL; gchar *mycmd = NULL; GString *buf = g_string_new(""); + GString *js_ret = g_string_new(""); while(*s) { switch(*s) { @@ -241,6 +244,9 @@ expand(char *s, gboolean recurse) { case EXP_EXPR: s++; upto = ')'; break; + case EXP_JS: + s++; upto = '>'; + break; } s++; @@ -280,6 +286,17 @@ expand(char *s, gboolean recurse) { } s = vend+1; } + else if(!recurse && + etype == EXP_JS) { + mycmd = expand(ret, 1); + eval_js(uzbl.gui.web_view, mycmd, js_ret); + g_free(mycmd); + + if(js_ret->str) { + g_string_append(buf, js_ret->str); + g_string_free(js_ret, 1); + } + } break; default: |