mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[action] Added toggle-ecmascript action
This commit is contained in:
parent
4e61b886bb
commit
929c8c9d81
@ -123,6 +123,7 @@ ACTION_(MAIN, "toggle-display-images", TOGGLE_DISPLAY_IMAGES, N__("Toggle displa
|
|||||||
ACTION_(MAIN, "toggle-display-tables", TOGGLE_DISPLAY_TABLES, N__("Toggle rendering of tables"), 0),
|
ACTION_(MAIN, "toggle-display-tables", TOGGLE_DISPLAY_TABLES, N__("Toggle rendering of tables"), 0),
|
||||||
ACTION_(MAIN, "toggle-document-colors", TOGGLE_DOCUMENT_COLORS, N__("Toggle usage of document specific colors"), 0),
|
ACTION_(MAIN, "toggle-document-colors", TOGGLE_DOCUMENT_COLORS, N__("Toggle usage of document specific colors"), 0),
|
||||||
ACTION_(MAIN, "toggle-document-width", TOGGLE_DOCUMENT_WIDTH, N__("Toggle use of document width"), 0),
|
ACTION_(MAIN, "toggle-document-width", TOGGLE_DOCUMENT_WIDTH, N__("Toggle use of document width"), 0),
|
||||||
|
ACTION_(MAIN, "toggle-ecmascript", TOGGLE_ECMASCRIPT, N__("Toggle Ecmascript handling"), 0),
|
||||||
ACTION_(MAIN, "toggle-html-plain", TOGGLE_HTML_PLAIN, N__("Toggle rendering page as HTML / plain text"), 0),
|
ACTION_(MAIN, "toggle-html-plain", TOGGLE_HTML_PLAIN, N__("Toggle rendering page as HTML / plain text"), 0),
|
||||||
ACTION_(MAIN, "toggle-mouse", TOGGLE_MOUSE, N__("Toggle mouse handling"), 0),
|
ACTION_(MAIN, "toggle-mouse", TOGGLE_MOUSE, N__("Toggle mouse handling"), 0),
|
||||||
ACTION_(MAIN, "toggle-numbered-links", TOGGLE_NUMBERED_LINKS, N__("Toggle displaying of links numbers"), 0),
|
ACTION_(MAIN, "toggle-numbered-links", TOGGLE_NUMBERED_LINKS, N__("Toggle displaying of links numbers"), 0),
|
||||||
|
@ -136,13 +136,21 @@ read_url_list(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ecmascript_enabled = 1;
|
||||||
|
|
||||||
|
void
|
||||||
|
toggle_ecmascript(void)
|
||||||
|
{
|
||||||
|
ecmascript_enabled = !ecmascript_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
get_ecmascript_enable(struct ecmascript_interpreter *interpreter)
|
get_ecmascript_enable(struct ecmascript_interpreter *interpreter)
|
||||||
{
|
{
|
||||||
struct string_list_item *item;
|
struct string_list_item *item;
|
||||||
char *url;
|
char *url;
|
||||||
|
|
||||||
if (!get_opt_bool("ecmascript.enable", NULL)
|
if (!ecmascript_enabled || !get_opt_bool("ecmascript.enable", NULL)
|
||||||
|| !interpreter || !interpreter->vs || !interpreter->vs->doc_view
|
|| !interpreter || !interpreter->vs || !interpreter->vs->doc_view
|
||||||
|| !interpreter->vs->doc_view->document || !interpreter->vs->doc_view->document->uri) {
|
|| !interpreter->vs->doc_view->document || !interpreter->vs->doc_view->document->uri) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -119,6 +119,8 @@ int get_ecmascript_enable(struct ecmascript_interpreter *interpreter);
|
|||||||
|
|
||||||
void check_for_rerender(struct ecmascript_interpreter *interpreter, const char* text);
|
void check_for_rerender(struct ecmascript_interpreter *interpreter, const char* text);
|
||||||
|
|
||||||
|
void toggle_ecmascript(void);
|
||||||
|
|
||||||
extern char *console_error_filename;
|
extern char *console_error_filename;
|
||||||
extern char *console_log_filename;
|
extern char *console_log_filename;
|
||||||
|
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
#include "dialogs/status.h"
|
#include "dialogs/status.h"
|
||||||
#include "document/document.h"
|
#include "document/document.h"
|
||||||
#include "document/view.h"
|
#include "document/view.h"
|
||||||
|
#ifdef CONFIG_ECMASCRIPT
|
||||||
|
#include "ecmascript/ecmascript.h"
|
||||||
|
#endif
|
||||||
#include "formhist/dialogs.h"
|
#include "formhist/dialogs.h"
|
||||||
#include "globhist/dialogs.h"
|
#include "globhist/dialogs.h"
|
||||||
#include "main/main.h"
|
#include "main/main.h"
|
||||||
@ -668,6 +671,12 @@ do_action(struct session *ses, enum main_action action_id, int verbose)
|
|||||||
redraw_terminal_cls(term);
|
redraw_terminal_cls(term);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ACT_MAIN_TOGGLE_ECMASCRIPT:
|
||||||
|
#ifdef CONFIG_ECMASCRIPT
|
||||||
|
toggle_ecmascript();
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
case ACT_MAIN_TOGGLE_HTML_PLAIN:
|
case ACT_MAIN_TOGGLE_HTML_PLAIN:
|
||||||
toggle_plain_html(ses, ses->doc_view, 0);
|
toggle_plain_html(ses, ses->doc_view, 0);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user