diff options
-rw-r--r-- | settings.c | 28 | ||||
-rw-r--r-- | xxxterm.1 | 8 | ||||
-rw-r--r-- | xxxterm.c | 4 |
3 files changed, 35 insertions, 5 deletions
diff --git a/settings.c b/settings.c index ac305d0..f98fa77 100644 --- a/settings.c +++ b/settings.c @@ -136,6 +136,7 @@ int set_default_script(struct settings *, char *); int set_default_script_rt(char *); int set_default_zoom_level(char *); int set_enable_cookie_whitelist(char *); +int set_enable_js_autorun(char *); int set_enable_js_whitelist(char *); int set_enable_localstorage(char *); int set_enable_plugins(char *); @@ -349,14 +350,14 @@ struct settings rs[] = { { "enable_scripts", XT_S_INT, 0, &enable_scripts, NULL, NULL, NULL, set_enable_scripts }, { "enable_socket", XT_S_INT, XT_SF_RESTART,&enable_socket, NULL, NULL, NULL, NULL }, { "enable_spell_checking", XT_S_INT, 0, &enable_spell_checking, NULL, NULL, NULL, set_enable_spell_checking }, - { "encoding", XT_S_STR, 0, NULL, &encoding, NULL, NULL, set_encoding_rt }, + { "encoding", XT_S_STR, 0, NULL, &encoding, NULL, NULL, NULL }, { "external_editor", XT_S_STR,0, NULL, &external_editor, NULL, NULL, set_external_editor }, { "fancy_bar", XT_S_INT, XT_SF_RESTART,&fancy_bar, NULL, NULL, NULL, NULL }, { "guess_search", XT_S_INT, 0, &guess_search, NULL, NULL, NULL, set_guess_search }, { "history_autosave", XT_S_INT, 0, &history_autosave, NULL, NULL, NULL, NULL }, { "http_proxy", XT_S_STR, 0, NULL, &http_proxy, NULL, NULL, set_http_proxy }, { "icon_size", XT_S_INT, 0, &icon_size, NULL, NULL, NULL, NULL }, - { "enable_js_autorun", XT_S_INT, 0, &enable_js_autorun, NULL, NULL, NULL, NULL }, + { "enable_js_autorun", XT_S_INT, 0, &enable_js_autorun, NULL, NULL, NULL, set_enable_js_autorun }, { "max_connections", XT_S_INT, XT_SF_RESTART,&max_connections, NULL, NULL, NULL, NULL }, { "max_host_connections", XT_S_INT, XT_SF_RESTART,&max_host_connections, NULL, NULL, NULL, NULL }, { "read_only_cookies", XT_S_INT, 0, &read_only_cookies, NULL, NULL, NULL, set_read_only_cookies }, @@ -1334,6 +1335,19 @@ set_enable_cookie_whitelist(char *value) } int +set_enable_js_autorun(char *value) +{ + int tmp; + const char *errstr; + + tmp = strtonum(value, 0, 1, &errstr); + if (errstr) + return (-1); + enable_js_autorun = tmp; + return (0); +} + +int set_enable_js_whitelist(char *value) { int tmp; @@ -1411,7 +1425,6 @@ set_enable_plugins(char *value) int set_enable_plugin_whitelist(char *value) { - /* XXX: this needs testing */ int tmp; const char *errstr; @@ -1469,6 +1482,14 @@ set_enable_strict_transport(char *value) return (0); } +#if 0 +/* + * XXX: this is currently broken. Need to figure out what to do with + * this. Problemm is set_encoding will refresh the tab it's run on, so + * we can either put a big fat warning in the manpage and refresh every + * single open tab with the new encoding or scrap it as a runtime + * setting. + */ int set_encoding_rt(char *value) { @@ -1483,6 +1504,7 @@ set_encoding_rt(char *value) set_encoding(get_current_tab(), &args); return (0); } +#endif int set_guess_search(char *value) diff --git a/xxxterm.1 b/xxxterm.1 index 9960831..ac24163 100644 --- a/xxxterm.1 +++ b/xxxterm.1 @@ -1066,6 +1066,14 @@ does not exist, will be tried instead. The content of the both default and host/domain files are read and executed on each page load. Default is 1. +.Pp +As an example, if you add the line +.Pa alert("Hello, world"); +to your +.Pa default.js , +a pop-up displaying "Hello, world" will be shown on every page reload. +While not useful, any javascript can be run through this mechanism, +making it useful for global or site-specific modifications. .It Cm enable_js_whitelist When enabled all domains must be in the js whitelist in order to run Java Script. diff --git a/xxxterm.c b/xxxterm.c index 802d32d..3a9695e 100644 --- a/xxxterm.c +++ b/xxxterm.c @@ -3318,7 +3318,7 @@ activate_search_entry_cb(GtkWidget* entry, struct tab *t) return; } - if (search_string == NULL) { + if (search_string == NULL || strlen(search_string) == 0) { show_oops(t, "no search_string"); return; } @@ -6468,7 +6468,7 @@ create_toolbar(struct tab *t) gtk_box_pack_start(GTK_BOX(b), eb1, TRUE, TRUE, 0); /* search entry */ - if (search_string) { + if (search_string != NULL && strlen(search_string) != 0) { GtkWidget *eb2; t->search_entry = gtk_entry_new(); gtk_entry_set_width_chars(GTK_ENTRY(t->search_entry), 30); |