diff options
-rw-r--r-- | DOCS/man/javascript.rst | 2 | ||||
-rw-r--r-- | player/javascript/defaults.js | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/DOCS/man/javascript.rst b/DOCS/man/javascript.rst index 8e3e7d6199..db12b65a09 100644 --- a/DOCS/man/javascript.rst +++ b/DOCS/man/javascript.rst @@ -188,7 +188,7 @@ success, ``fn`` is called always a-sync, ``error`` is empty string on success. ``mp.add_hook(type, priority, fn)`` ``mp.options.read_options(obj [, identifier [, on_update]])`` (types: -string/boolean/number, ``on_update`` does re-read the config file) +string/boolean/number) Additional utilities -------------------- diff --git a/player/javascript/defaults.js b/player/javascript/defaults.js index 4520373886..fba5b10144 100644 --- a/player/javascript/defaults.js +++ b/player/javascript/defaults.js @@ -511,13 +511,13 @@ g.require = new_require(SCRIPTDIR_META + "/" + main_script[1]); /********************************************************************** * mp.options *********************************************************************/ -function read_options(opts, id, on_update) { +function read_options(opts, id, on_update, conf_override) { id = String(id ? id : mp.get_script_name()); mp.msg.debug("reading options for " + id); var conf, fname = "~~/script-opts/" + id + ".conf"; try { - conf = mp.utils.read_file(fname); + conf = arguments.length > 3 ? conf_override : mp.utils.read_file(fname); } catch (e) { mp.msg.verbose(fname + " not found."); } @@ -561,7 +561,7 @@ function read_options(opts, id, on_update) { mp.observe_property("options/script-opts", "native", function(_n, _v) { var saved = JSON.parse(JSON.stringify(opts)); // clone var changelist = {}, changed = false; - read_options(opts, id); // re-apply conf-file + script-opts + read_options(opts, id, 0, conf); // re-apply orig-file + script-opts for (var key in opts) { if (opts[key] != saved[key]) // type always stays the same changelist[key] = changed = true; |