summaryrefslogtreecommitdiffstats
path: root/etherpad/src/static
diff options
context:
space:
mode:
authorEgil Moeller <egil.moller@freecode.no>2010-03-22 19:59:04 +0100
committerEgil Moeller <egil.moller@freecode.no>2010-03-22 19:59:04 +0100
commite19fc9f24ab128d4337d67d0e3f312a1ab0be38b (patch)
tree8a0b22c0842ee472df1e51d1277924d8a3796baf /etherpad/src/static
parentefffc8687a0fe92b993e9b65de3e4511df36815d (diff)
downloadetherpad-e19fc9f24ab128d4337d67d0e3f312a1ab0be38b.tar.gz
etherpad-e19fc9f24ab128d4337d67d0e3f312a1ab0be38b.tar.bz2
etherpad-e19fc9f24ab128d4337d67d0e3f312a1ab0be38b.zip
Made the client side plugin API more similar to the server side one
Diffstat (limited to 'etherpad/src/static')
-rw-r--r--etherpad/src/static/js/plugins.js38
1 files changed, 20 insertions, 18 deletions
diff --git a/etherpad/src/static/js/plugins.js b/etherpad/src/static/js/plugins.js
index 6d8804e..d1d6b14 100644
--- a/etherpad/src/static/js/plugins.js
+++ b/etherpad/src/static/js/plugins.js
@@ -1,19 +1,21 @@
-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;
-}
+plugins = {
+ callHook: function (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 || "");
-}
+ callHookStr: function (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 || "");
+ }
+};