summaryrefslogtreecommitdiff
path: root/static/js/plugins.js
blob: 2ebf98f3c0278986b3537c5f7648818e1833e84b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
plugins = {
  callHook: function(hookName, args)
  {
    var hook = clientVars.hooks[hookName];
    if (hook === undefined) return [];
    var res = [];
    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);
    }
    return res;
  },

  callHookStr: function(hookName, args, sep, pre, post)
  {
    if (sep == undefined) sep = '';
    if (pre == undefined) pre = '';
    if (post == undefined) post = '';
    return plugins.callHook(hookName, args).map(function(x)
    {
      return pre + x + post
    }).join(sep || "");
  }
};