diff options
author | Egil Moeller <egil.moller@freecode.no> | 2010-03-19 00:38:28 +0100 |
---|---|---|
committer | Egil Moeller <egil.moller@freecode.no> | 2010-03-19 00:38:28 +0100 |
commit | 0fdab3db005c4fa31fb8306b573c0b35073d3e56 (patch) | |
tree | eeac9351bdc712083fb79e4ae0f207da1da2be92 /trunk/etherpad/src/static | |
parent | 1e290fceb9833c36235202c9443f33ba6f86a461 (diff) | |
download | etherpad-0fdab3db005c4fa31fb8306b573c0b35073d3e56.tar.gz etherpad-0fdab3db005c4fa31fb8306b573c0b35073d3e56.tar.bz2 etherpad-0fdab3db005c4fa31fb8306b573c0b35073d3e56.zip |
Added support for client plugins too
Diffstat (limited to 'trunk/etherpad/src/static')
-rw-r--r-- | trunk/etherpad/src/static/js/plugins.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/trunk/etherpad/src/static/js/plugins.js b/trunk/etherpad/src/static/js/plugins.js new file mode 100644 index 0000000..6d8804e --- /dev/null +++ b/trunk/etherpad/src/static/js/plugins.js @@ -0,0 +1,19 @@ +function callHook(hookName, args) { + if (clientVars.hooks[hookName] === undefined) + return []; + var res = []; + for (i = 0; i < clientVars.hooks[hookName].length; i++) { + var plugin = clientVars.hooks[hookName][i]; + var pluginRes = eval(plugin.plugin)[plugin.original || hookName](args); + if (pluginRes != undefined && pluginRes != null) + res = res.concat(pluginRes); + } + return res; +} + +function callHookStr(hookName, args, sep, pre, post) { + if (sep == undefined) sep = ''; + if (pre == undefined) pre = ''; + if (post == undefined) post = ''; + return callHook(hookName, args).map(function (x) { return pre + x + post}).join(sep || ""); +} |