1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

Try to comply to the client-side javascript interface and not our own

Renames the following things:
ELinks.write() -> alert() or navigator.alert()
ELinks.version -> navigator.appVersion
ELinks.home    -> navigator.appHome

The last one is not defined by the client-side javascript interface.
This commit is contained in:
Jonas Fonseca 2005-10-25 17:43:33 +02:00 committed by Jonas Fonseca
parent eaee3d5f44
commit 7659f284ac
2 changed files with 18 additions and 16 deletions

View File

@ -3,8 +3,9 @@
* Copyright (c) Jonas Fonseca, 2005 * Copyright (c) Jonas Fonseca, 2005
*/ */
function quit() { function quit()
// ELinks.write("quiting ... " + ELinks.version); {
// alert("quiting ... " + navigator.appVersion);
} }
/********************************************************************* /*********************************************************************
@ -206,7 +207,7 @@ function expand_smartprefix(context, current_url)
return true return true
} else { } else {
ELinks.write('smartprefix "' + nick + '" has unsupported type "' + typeof smartprefixes[nick] + '".') alert('smartprefix "' + nick + '" has unsupported type "' + typeof smartprefixes[nick] + '".')
return false return false
} }
} }

View File

@ -53,7 +53,7 @@ alert_see_error(struct session *ses, unsigned char *msg)
/* The ELinks module: */ /* The ELinks module: */
static void static void
elinks_see_write(struct SEE_interpreter *see, struct SEE_object *self, navigator_alert(struct SEE_interpreter *see, struct SEE_object *self,
struct SEE_object *thisobj, int argc, struct SEE_value **argv, struct SEE_object *thisobj, int argc, struct SEE_value **argv,
struct SEE_value *res) struct SEE_value *res)
{ {
@ -99,7 +99,7 @@ static void
init_see_environment(struct SEE_interpreter *see) init_see_environment(struct SEE_interpreter *see)
{ {
unsigned char *home; unsigned char *home;
struct SEE_object *obj, *elinks; struct SEE_object *obj, *navigator;
struct SEE_value value; struct SEE_value value;
struct SEE_string *name; struct SEE_string *name;
@ -107,28 +107,29 @@ init_see_environment(struct SEE_interpreter *see)
SEE_intern_global(s_print = &S_print); SEE_intern_global(s_print = &S_print);
* */ * */
/* Create the elinks browser object. Add it to the global space */ /* Create the navigator browser object. Add it to the global space */
elinks = SEE_Object_new(see); navigator = SEE_Object_new(see);
SEE_SET_OBJECT(&value, elinks); SEE_SET_OBJECT(&value, navigator);
name = SEE_string_sprintf(see, "ELinks"); name = SEE_string_sprintf(see, "navigator");
SEE_OBJECT_PUT(see, see->Global, name, &value, SEE_ATTR_READONLY); SEE_OBJECT_PUT(see, see->Global, name, &value, SEE_ATTR_READONLY);
/* Create a string and attach as 'ELinks.version' */ /* Create a string and attach as 'ELinks.version' */
SEE_SET_STRING(&value, SEE_string_sprintf(see, VERSION)); SEE_SET_STRING(&value, SEE_string_sprintf(see, VERSION));
name = SEE_string_sprintf(see, "version"); name = SEE_string_sprintf(see, "appVersion");
SEE_OBJECT_PUT(see, elinks, name, &value, SEE_ATTR_READONLY); SEE_OBJECT_PUT(see, navigator, name, &value, SEE_ATTR_READONLY);
/* Create a string and attach as 'ELinks.home' */ /* Create a string and attach as 'ELinks.home' */
home = elinks_home ? elinks_home : (unsigned char *) CONFDIR; home = elinks_home ? elinks_home : (unsigned char *) CONFDIR;
SEE_SET_STRING(&value, SEE_string_sprintf(see, home)); SEE_SET_STRING(&value, SEE_string_sprintf(see, home));
name = SEE_string_sprintf(see, "home"); name = SEE_string_sprintf(see, "appHome");
SEE_OBJECT_PUT(see, elinks, name, &value, SEE_ATTR_READONLY); SEE_OBJECT_PUT(see, navigator, name, &value, SEE_ATTR_READONLY);
/* Create a 'write' method and attach to the browser object. */ /* Create a 'write' method and attach to the browser object. */
name = SEE_string_sprintf(see, "write"); name = SEE_string_sprintf(see, "alert");
obj = SEE_cfunction_make(see, elinks_see_write, name, 1); obj = SEE_cfunction_make(see, navigator_alert, name, 1);
SEE_SET_OBJECT(&value, obj); SEE_SET_OBJECT(&value, obj);
SEE_OBJECT_PUT(see, elinks, name, &value, 0); SEE_OBJECT_PUT(see, navigator, name, &value, 0);
SEE_OBJECT_PUT(see, see->Global, name, &value, 0);
} }
static void static void