X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/3ac83c6134a876990a2b5e26075e4304b3ce1cae..50f19777781cca115e5aef51b2809a54af93da23:/js/kivi.js diff --git a/js/kivi.js b/js/kivi.js index ea892f521..5901c89a1 100644 --- a/js/kivi.js +++ b/js/kivi.js @@ -37,6 +37,17 @@ namespace("kivi", function(ns) { kivi.PartPicker($(elt)); }); }; + + // Return a function object by its name (a string). Works both with + // global functions (e.g. "check_right_date_format") and those in + // namespaces (e.g. "kivi.t8"). + // Returns null if the object is not found. + ns.get_function_by_name = function(name) { + var parts = name.match("(.+)\\.([^\\.]+)$"); + if (!parts) + return window[name]; + return namespace(parts[1])[ parts[2] ]; + }; }); kivi = namespace('kivi');