mirror of
https://github.com/rkd77/elinks.git
synced 2024-09-28 03:06:20 -04:00
[console.log] Added boolean option ecmascript.enable_console_log. Disabled by default.
This commit is contained in:
parent
bc7a1ae6ad
commit
7f1d718993
@ -47,6 +47,10 @@ static union option_info ecmascript_options[] = {
|
|||||||
"enable", 0, 0,
|
"enable", 0, 0,
|
||||||
N_("Whether to run those scripts inside of documents.")),
|
N_("Whether to run those scripts inside of documents.")),
|
||||||
|
|
||||||
|
INIT_OPT_BOOL("ecmascript", N_("Console log"),
|
||||||
|
"enable_console_log", 0, 0,
|
||||||
|
N_("When enabled logs will be appended to ~/.elinks/console.log.")),
|
||||||
|
|
||||||
INIT_OPT_BOOL("ecmascript", N_("Script error reporting"),
|
INIT_OPT_BOOL("ecmascript", N_("Script error reporting"),
|
||||||
"error_reporting", 0, 0,
|
"error_reporting", 0, 0,
|
||||||
N_("Open a message box when a script reports an error.")),
|
N_("Open a message box when a script reports an error.")),
|
||||||
|
@ -84,17 +84,19 @@ console_log(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
|||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char *key = JS_EncodeString(ctx, args[0].toString());
|
if (get_opt_bool("ecmascript.enable_console_log", NULL))
|
||||||
|
|
||||||
FILE *f = fopen(console_log_filename, "a");
|
|
||||||
|
|
||||||
if (f)
|
|
||||||
{
|
{
|
||||||
fprintf(f, "%s\n", key);
|
unsigned char *key = JS_EncodeString(ctx, args[0].toString());
|
||||||
fclose(f);
|
|
||||||
|
FILE *f = fopen(console_log_filename, "a");
|
||||||
|
|
||||||
|
if (f)
|
||||||
|
{
|
||||||
|
fprintf(f, "%s\n", key);
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
args.rval().setBoolean(true);
|
args.rval().setBoolean(true);
|
||||||
return(true);
|
return(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user