Hi dear Elinks developers,
First of all I was very impressed of your dynamic and fast developing project
And I’ve found your browser very useful for me, especially after that new “_javascript_” epoch begun.
I see that this line of development is just in the beginning, so I tried to make some minor
changes in order to implement some my “everyday” needs.
1. I see that there is no support for “textarea” & “select” controls in _javascript_, so,
I’ve tried to add some code copied from the “input” element. In the file: spidermonkey.c I’ve added something like:
static JSBool textarea_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp);
static JSBool textarea_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp);
static const JSClass textarea_class = {
"textarea", /* here, we unleash ourselves */
JSCLASS_HAS_PRIVATE,
JS_PropertyStub, JS_PropertyStub,
textarea_get_property, textarea_set_property,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
};
…………
etc.
etc.
etc.
- exactly like it’s implemented for input.
I really see that get & set properties now supported: I can get/set properties in a script, but callback functions like “onFocus()” etc. don’t work.
Have I defined something else in addition to spidermonkey.c in order to register callback functions?
2. I was needed confirm dialog and tried to add it:
static JSBool window_confirm(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
static JSBool window_open(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
static const JSFunctionSpec window_funcs[] = {
{ "alert", window_alert, 1 },
{ "confirm", window_confirm, 1 },
{ "open", window_open, 3 },
{ NULL }
};
static int
confirmed(JSContext *ctx)
{
// It;s not clear how to transfer the chosen value to script from this call back -
}
static JSBool
window_confirm(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
struct view_state *vs = JS_GetPrivate(ctx, obj);
union jsval_union v;
struct jsval_property prop;
set_prop_undef(&prop);
if (argc != 1)
return JS_TRUE;
jsval_to_value(ctx, &argv[0], JSTYPE_STRING, &v);
if (!v.string || !*v.string)
return JS_TRUE;
msg_box(vs->doc_view->session->tab->term, NULL, MSGBOX_FREE_TEXT,
N_("_javascript_ Confirm"), ALIGN_CENTER,
stracpy(v.string),
ctx, 2,
N_("YES"), confirmed, B_ENTER, N_("NO"), NULL, B_ESC);
value_to_jsval(ctx, rval, &prop);
return JS_TRUE;
}
How can I transfer to script result from callback fuction
in order to script with if(confirm(“Would you like…”)) make working?
3. I need to update simultaneously two frames by clicking the link, so I tried to run something like:
"<TR><TD height=20 width=160 class=\"$button_style\"><a href = "" $click_path </a></TD></TR>"
And then in <script> part the function:
<script language=_javascript_>
function draw_to_both_frames(url1, url2)
{
parent.textFrm.location.href="" ;
parent.left_frame.location.href="" ;
}
Unfortunately only the last line works, so only one frame is updated. Have any idea about any fix or work around?
4. I have a problem with dynamic menu: it’s very simple cgi script that runs itself with an item name (see example of line above).
It works fine when I click first time on every link (every menu item), but when I click it anther time, it looks like instead of running of cgi Elinks gets result form cache. The problem occurs even when I nullified all cache settings and make “flush all caches”.
Does this problem is known and do you have any work around/fix on it.
OF COURSE, AFTER THE UNIT TEST THE STABLE CODE WITH MY CHANGES WILL BE SENT BACK.
Regards,
Michael.
_______________________________________________ elinks-dev mailing list [email protected] http://linuxfromscratch.org/mailman/listinfo/elinks-dev
