diff options
-rw-r--r-- | etherpad/src/static/js/plugins.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/etherpad/src/static/js/plugins.js b/etherpad/src/static/js/plugins.js index d1d6b14..f7a5990 100644 --- a/etherpad/src/static/js/plugins.js +++ b/etherpad/src/static/js/plugins.js @@ -1,13 +1,14 @@ plugins = { callHook: function (hookName, args) { - if (clientVars.hooks[hookName] === undefined) + var hook = clientVars.hooks[hookName]; + if (hook === undefined) return []; var res = []; - for (i = 0; i < clientVars.hooks[hookName].length; i++) { - var plugin = clientVars.hooks[hookName][i]; + for (var i = 0, N=hook.length; i < N; i++) { + var plugin = hook[i]; var pluginRes = eval(plugin.plugin)[plugin.original || hookName](args); if (pluginRes != undefined && pluginRes != null) - res = res.concat(pluginRes); + res = res.concat(pluginRes); } return res; }, |