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

[mujs] addproperty

This commit is contained in:
Witold Filipczyk 2022-08-08 15:45:32 +02:00
parent 72b8c508a3
commit 5f79e6e91c
3 changed files with 12 additions and 49 deletions

View File

@ -146,32 +146,13 @@ mjs_navigator_init(js_State *J)
js_newobject(J);
{
addmethod(J, "navigator.toString", mjs_navigator_toString, 0);
js_newcfunction(J, mjs_navigator_get_property_appCodeName, "navigator.appCodeName", 0);
js_pushnull(J);
js_defaccessor(J, -3, "appCodeName", JS_READONLY | JS_DONTENUM | JS_DONTCONF);
js_newcfunction(J, mjs_navigator_get_property_appName, "navigator.appName", 0);
js_pushnull(J);
js_defaccessor(J, -3, "appName", JS_READONLY | JS_DONTENUM | JS_DONTCONF);
js_newcfunction(J, mjs_navigator_get_property_appVersion, "navigator.appVersion", 0);
js_pushnull(J);
js_defaccessor(J, -3, "appVersion", JS_READONLY | JS_DONTENUM | JS_DONTCONF);
js_newcfunction(J, mjs_navigator_get_property_language, "navigator.language", 0);
js_pushnull(J);
js_defaccessor(J, -3, "language", JS_READONLY | JS_DONTENUM | JS_DONTCONF);
js_newcfunction(J, mjs_navigator_get_property_platform, "navigator.platform", 0);
js_pushnull(J);
js_defaccessor(J, -3, "platform", JS_READONLY | JS_DONTENUM | JS_DONTCONF);
js_newcfunction(J, mjs_navigator_get_property_userAgent, "navigator.userAgent", 0);
js_pushnull(J);
js_defaccessor(J, -3, "userAgent", JS_READONLY | JS_DONTENUM | JS_DONTCONF);
addproperty(J, "navigator.appCodeName", mjs_navigator_get_property_appCodeName, NULL);
addproperty(J, "navigator.appName", mjs_navigator_get_property_appName, NULL);
addproperty(J, "navigator.appVersion", mjs_navigator_get_property_appVersion, NULL);
addproperty(J, "navigator.language", mjs_navigator_get_property_language, NULL);
addproperty(J, "navigator.platform", mjs_navigator_get_property_platform, NULL);
addproperty(J, "navigator.userAgent", mjs_navigator_get_property_userAgent, NULL);
}
js_defglobal(J, "navigator", JS_DONTENUM);
return 0;

View File

@ -150,22 +150,10 @@ mjs_screen_init(js_State *J)
js_newobject(J);
{
addmethod(J, "screen.toString", mjs_screen_toString, 0);
js_newcfunction(J, mjs_screen_get_property_availHeight, "screen.availHeight", 0);
js_pushnull(J);
js_defaccessor(J, -3, "availHeight", JS_READONLY | JS_DONTENUM | JS_DONTCONF);
js_newcfunction(J, mjs_screen_get_property_availWidth, "screen.availWidth", 0);
js_pushnull(J);
js_defaccessor(J, -3, "availWidth", JS_READONLY | JS_DONTENUM | JS_DONTCONF);
js_newcfunction(J, mjs_screen_get_property_height, "screen.height", 0);
js_pushnull(J);
js_defaccessor(J, -3, "height", JS_READONLY | JS_DONTENUM | JS_DONTCONF);
js_newcfunction(J, mjs_screen_get_property_width, "screen.width", 0);
js_pushnull(J);
js_defaccessor(J, -3, "width", JS_READONLY | JS_DONTENUM | JS_DONTCONF);
addproperty(J, "screen.availHeight", mjs_screen_get_property_availHeight, NULL);
addproperty(J, "screen.availWidth", mjs_screen_get_property_availWidth, NULL);
addproperty(J, "screen.height", mjs_screen_get_property_height, NULL);
addproperty(J, "screen.width", mjs_screen_get_property_width, NULL);
}
js_defglobal(J, "screen", JS_DONTENUM);

View File

@ -152,10 +152,7 @@ mjs_menubar_init(js_State *J)
js_newobject(J);
{
addmethod(J, "menubar.toString", mjs_menubar_toString, 0);
js_newcfunction(J, mjs_menubar_get_property_visible, "menubar.visible", 0);
js_newcfunction(J, mjs_menubar_set_property_visible, "menubar.visible", 1);
js_defaccessor(J, -3, "visible", JS_DONTENUM | JS_DONTCONF);
addproperty(J, "menubar.visible", mjs_menubar_get_property_visible, mjs_menubar_set_property_visible);
}
js_defglobal(J, "menubar", JS_DONTENUM);
}
@ -166,10 +163,7 @@ mjs_statusbar_init(js_State *J)
js_newobject(J);
{
addmethod(J, "statusbar.toString", mjs_statusbar_toString, 0);
js_newcfunction(J, mjs_statusbar_get_property_visible, "statusbar.visible", 0);
js_newcfunction(J, mjs_statusbar_set_property_visible, "statusbar.visible", 1);
js_defaccessor(J, -3, "visible", JS_DONTENUM | JS_DONTCONF);
addproperty(J, "statusbar.visible", mjs_statusbar_get_property_visible, mjs_statusbar_set_property_visible);
}
js_defglobal(J, "statusbar", JS_DONTENUM);
}