1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[ecmascript] Show message in status about enabling/disabling Ecmascript

This commit is contained in:
Witold Filipczyk 2021-09-20 18:40:01 +02:00
parent 929c8c9d81
commit 6ffa7ec6e3
3 changed files with 14 additions and 4 deletions

View File

@ -11,6 +11,7 @@
#include "config/home.h"
#include "config/options.h"
#include "dialogs/status.h"
#include "document/document.h"
#include "document/renderer.h"
#include "document/view.h"
@ -136,12 +137,20 @@ read_url_list(void)
}
}
static int ecmascript_enabled = 1;
static int ecmascript_enabled;
void
toggle_ecmascript(void)
toggle_ecmascript(struct session *ses)
{
ecmascript_enabled = !ecmascript_enabled;
if (ecmascript_enabled) {
mem_free_set(&ses->status.window_status, stracpy(_("Ecmascript enabled", ses->tab->term)));
print_screen_status(ses);
} else {
mem_free_set(&ses->status.window_status, stracpy(_("Ecmascript disabled", ses->tab->term)));
print_screen_status(ses);
}
}
int
@ -558,6 +567,7 @@ init_ecmascript_module(struct module *module)
/* ecmascript local storage db location */
local_storage_filename = straconcat(elinks_home, "/elinks_ls.db", NULL);
}
ecmascript_enabled = get_opt_bool("ecmascript.enable", NULL);
}
static void

View File

@ -119,7 +119,7 @@ int get_ecmascript_enable(struct ecmascript_interpreter *interpreter);
void check_for_rerender(struct ecmascript_interpreter *interpreter, const char* text);
void toggle_ecmascript(void);
void toggle_ecmascript(struct session *ses);
extern char *console_error_filename;
extern char *console_log_filename;

View File

@ -673,7 +673,7 @@ do_action(struct session *ses, enum main_action action_id, int verbose)
case ACT_MAIN_TOGGLE_ECMASCRIPT:
#ifdef CONFIG_ECMASCRIPT
toggle_ecmascript();
toggle_ecmascript(ses);
#endif
break;