mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
[js] placeholder for onkeypress
This commit is contained in:
parent
5dc2187450
commit
447aa41dc9
@ -101,6 +101,7 @@ const char *script_event_hook_name[] = {
|
|||||||
"blur",
|
"blur",
|
||||||
"keydown",
|
"keydown",
|
||||||
"keyup",
|
"keyup",
|
||||||
|
"keypress",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -98,7 +98,8 @@ enum script_event_hook_type {
|
|||||||
SEVHOOK_ONMOUSEOUT,
|
SEVHOOK_ONMOUSEOUT,
|
||||||
SEVHOOK_ONBLUR,
|
SEVHOOK_ONBLUR,
|
||||||
SEVHOOK_ONKEYDOWN,
|
SEVHOOK_ONKEYDOWN,
|
||||||
SEVHOOK_ONKEYUP
|
SEVHOOK_ONKEYUP,
|
||||||
|
SEVHOOK_ONKEYPRESS,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* keep in sync with above */
|
/* keep in sync with above */
|
||||||
|
@ -332,6 +332,7 @@ html_focusable(struct html_context *html_context, char *a)
|
|||||||
mem_free_set(&elformat.onblur, get_attr_val(a, "onblur", cp));
|
mem_free_set(&elformat.onblur, get_attr_val(a, "onblur", cp));
|
||||||
mem_free_set(&elformat.onkeydown, get_attr_val(a, "onkeydown", cp));
|
mem_free_set(&elformat.onkeydown, get_attr_val(a, "onkeydown", cp));
|
||||||
mem_free_set(&elformat.onkeyup, get_attr_val(a, "onkeyup", cp));
|
mem_free_set(&elformat.onkeyup, get_attr_val(a, "onkeyup", cp));
|
||||||
|
mem_free_set(&elformat.onkeypress, get_attr_val(a, "onkeypress", cp));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -854,7 +855,7 @@ init_html_parser(struct uri *uri, struct document *document,
|
|||||||
elformat.link = elformat.target = elformat.image = NULL;
|
elformat.link = elformat.target = elformat.image = NULL;
|
||||||
elformat.onclick = elformat.ondblclick = elformat.onmouseover = elformat.onhover
|
elformat.onclick = elformat.ondblclick = elformat.onmouseover = elformat.onhover
|
||||||
= elformat.onfocus = elformat.onmouseout = elformat.onblur
|
= elformat.onfocus = elformat.onmouseout = elformat.onblur
|
||||||
= elformat.onkeydown = elformat.onkeyup = NULL;
|
= elformat.onkeydown = elformat.onkeyup = elformat.onkeypress = NULL;
|
||||||
elformat.select = NULL;
|
elformat.select = NULL;
|
||||||
elformat.form = NULL;
|
elformat.form = NULL;
|
||||||
elformat.title = NULL;
|
elformat.title = NULL;
|
||||||
|
@ -77,6 +77,7 @@ struct text_attrib {
|
|||||||
char *onblur;
|
char *onblur;
|
||||||
char *onkeydown;
|
char *onkeydown;
|
||||||
char *onkeyup;
|
char *onkeyup;
|
||||||
|
char *onkeypress;
|
||||||
|
|
||||||
char *top_name;
|
char *top_name;
|
||||||
};
|
};
|
||||||
|
@ -135,6 +135,7 @@ kill_html_stack_item(struct html_context *html_context, struct html_element *e)
|
|||||||
mem_free_if(e->attr.onblur);
|
mem_free_if(e->attr.onblur);
|
||||||
mem_free_if(e->attr.onkeydown);
|
mem_free_if(e->attr.onkeydown);
|
||||||
mem_free_if(e->attr.onkeyup);
|
mem_free_if(e->attr.onkeyup);
|
||||||
|
mem_free_if(e->attr.onkeypress);
|
||||||
|
|
||||||
del_from_list(e);
|
del_from_list(e);
|
||||||
mem_free(e);
|
mem_free(e);
|
||||||
@ -174,7 +175,7 @@ html_stack_dup(struct html_context *html_context, enum html_element_mortality_ty
|
|||||||
/* XXX: For sure? --pasky */
|
/* XXX: For sure? --pasky */
|
||||||
e->attr.onclick = e->attr.ondblclick = e->attr.onmouseover = e->attr.onhover
|
e->attr.onclick = e->attr.ondblclick = e->attr.onmouseover = e->attr.onhover
|
||||||
= e->attr.onfocus = e->attr.onmouseout = e->attr.onblur
|
= e->attr.onfocus = e->attr.onmouseout = e->attr.onblur
|
||||||
= e->attr.onkeydown = e->attr.onkeyup = NULL;
|
= e->attr.onkeydown = e->attr.onkeyup = e->attr.onkeypress = NULL;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (e->name) {
|
if (e->name) {
|
||||||
|
@ -1453,6 +1453,7 @@ init_link_event_hooks(struct html_context *html_context, struct link *link)
|
|||||||
add_evhook(link->event_hooks, SEVHOOK_ONBLUR, elformat.onblur);
|
add_evhook(link->event_hooks, SEVHOOK_ONBLUR, elformat.onblur);
|
||||||
add_evhook(link->event_hooks, SEVHOOK_ONKEYDOWN, elformat.onkeydown);
|
add_evhook(link->event_hooks, SEVHOOK_ONKEYDOWN, elformat.onkeydown);
|
||||||
add_evhook(link->event_hooks, SEVHOOK_ONKEYUP, elformat.onkeyup);
|
add_evhook(link->event_hooks, SEVHOOK_ONKEYUP, elformat.onkeyup);
|
||||||
|
add_evhook(link->event_hooks, SEVHOOK_ONKEYPRESS, elformat.onkeypress);
|
||||||
|
|
||||||
#undef add_evhook
|
#undef add_evhook
|
||||||
}
|
}
|
||||||
|
@ -2453,7 +2453,7 @@ check_element_event(void *interp, void *elem, const char *event_name, struct ter
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ev && ev->ev == EVENT_KBD && (!strcmp(event_name, "keydown") || !strcmp(event_name, "keyup"))) {
|
if (ev && ev->ev == EVENT_KBD && (!strcmp(event_name, "keydown") || !strcmp(event_name, "keyup") || !strcmp(event_name, "keypress"))) {
|
||||||
js_getregistry(J, l->fun); /* retrieve the js function from the registry */
|
js_getregistry(J, l->fun); /* retrieve the js function from the registry */
|
||||||
js_getregistry(J, el_private->thisval);
|
js_getregistry(J, el_private->thisval);
|
||||||
mjs_push_keyboardEvent(J, ev);
|
mjs_push_keyboardEvent(J, ev);
|
||||||
|
@ -2760,7 +2760,7 @@ check_element_event(void *interp, void *elem, const char *event_name, struct ter
|
|||||||
if (strcmp(l->typ, event_name)) {
|
if (strcmp(l->typ, event_name)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (ev && ev->ev == EVENT_KBD && (!strcmp(event_name, "keydown") || !strcmp(event_name, "keyup"))) {
|
if (ev && ev->ev == EVENT_KBD && (!strcmp(event_name, "keydown") || !strcmp(event_name, "keyup") || !strcmp(event_name("keypress")))) {
|
||||||
JSValue func = JS_DupValue(ctx, l->fun);
|
JSValue func = JS_DupValue(ctx, l->fun);
|
||||||
JSValue arg = get_keyboardEvent(ctx, ev);
|
JSValue arg = get_keyboardEvent(ctx, ev);
|
||||||
JSValue ret = JS_Call(ctx, func, el_private->thisval, 1, (JSValueConst *) &arg);
|
JSValue ret = JS_Call(ctx, func, el_private->thisval, 1, (JSValueConst *) &arg);
|
||||||
|
@ -4315,7 +4315,7 @@ check_element_event(void *interp, void *elem, const char *event_name, struct ter
|
|||||||
if (strcmp(l->typ, event_name)) {
|
if (strcmp(l->typ, event_name)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (ev && ev->ev == EVENT_KBD && (!strcmp(event_name, "keydown") || !strcmp(event_name, "keyup"))) {
|
if (ev && ev->ev == EVENT_KBD && (!strcmp(event_name, "keydown") || !strcmp(event_name, "keyup") || !strcmp(event_name, "keypress"))) {
|
||||||
JS::RootedValueVector argv(ctx);
|
JS::RootedValueVector argv(ctx);
|
||||||
if (!argv.resize(1)) {
|
if (!argv.resize(1)) {
|
||||||
return;
|
return;
|
||||||
|
@ -1330,6 +1330,8 @@ try_form_action(struct session *ses, struct document_view *doc_view,
|
|||||||
check_element_event(doc_view->vs->ecmascript, element, event_name, ev);
|
check_element_event(doc_view->vs->ecmascript, element, event_name, ev);
|
||||||
event_name = script_event_hook_name[SEVHOOK_ONKEYUP];
|
event_name = script_event_hook_name[SEVHOOK_ONKEYUP];
|
||||||
check_element_event(doc_view->vs->ecmascript, element, event_name, ev);
|
check_element_event(doc_view->vs->ecmascript, element, event_name, ev);
|
||||||
|
event_name = script_event_hook_name[SEVHOOK_ONKEYPRESS];
|
||||||
|
check_element_event(doc_view->vs->ecmascript, element, event_name, ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1339,6 +1341,10 @@ try_form_action(struct session *ses, struct document_view *doc_view,
|
|||||||
if (status != FRAME_EVENT_IGNORED && !current_link_evhook(doc_view, SEVHOOK_ONKEYUP)) {
|
if (status != FRAME_EVENT_IGNORED && !current_link_evhook(doc_view, SEVHOOK_ONKEYUP)) {
|
||||||
status = FRAME_EVENT_IGNORED;
|
status = FRAME_EVENT_IGNORED;
|
||||||
}
|
}
|
||||||
|
if (status != FRAME_EVENT_IGNORED && !current_link_evhook(doc_view, SEVHOOK_ONKEYPRESS)) {
|
||||||
|
status = FRAME_EVENT_IGNORED;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (status != FRAME_EVENT_IGNORED) {
|
if (status != FRAME_EVENT_IGNORED) {
|
||||||
|
Loading…
Reference in New Issue
Block a user