From d223a63bc5de423bca7337795fe165678cf6d236 Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Sat, 13 Dec 2014 18:27:47 +0200 Subject: js: add javascript scripting support using MuJS Implements JS with almost identical API to the Lua support. Key differences from Lua: - The global mp, mp.msg and mp.utils are always available. - Instead of returning x, error, return x and expose mp.last_error(). - Timers are JS standard set/clear Timeout/Interval. - Supports CommonJS modules/require. - Added at mp.utils: getenv, read_file, write_file and few more. - Global print and dump (expand objects) functions. - mp.options currently not supported. See DOCS/man/javascript.rst for more details. --- options/options.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'options/options.c') diff --git a/options/options.c b/options/options.c index d20aa03b99..324a1c9a3e 100644 --- a/options/options.c +++ b/options/options.c @@ -308,14 +308,16 @@ const m_option_t mp_opts[] = { M_OPT_FIXED | CONF_NOCFG | CONF_PRE_PARSE | M_OPT_FILE), OPT_STRINGLIST("reset-on-next-file", reset_options, 0), -#if HAVE_LUA +#if HAVE_LUA || HAVE_JAVASCRIPT OPT_STRINGLIST("script", script_files, M_OPT_FIXED | M_OPT_FILE), OPT_KEYVALUELIST("script-opts", script_opts, 0), + OPT_FLAG("load-scripts", auto_load_scripts, 0), +#endif +#if HAVE_LUA OPT_FLAG("osc", lua_load_osc, UPDATE_BUILTIN_SCRIPTS), OPT_FLAG("ytdl", lua_load_ytdl, UPDATE_BUILTIN_SCRIPTS), OPT_STRING("ytdl-format", lua_ytdl_format, 0), OPT_KEYVALUELIST("ytdl-raw-options", lua_ytdl_raw_options, 0), - OPT_FLAG("load-scripts", auto_load_scripts, 0), #endif // ------------------------- stream options -------------------- -- cgit v1.2.3