1 // based on http://www.velvetcache.org/2010/08/19/a-simple-javascript-hooks-system
4 HOOK_ARTICLE_RENDERED: 1,
5 HOOK_ARTICLE_RENDERED_CDM: 2,
6 HOOK_ARTICLE_SET_ACTIVE: 3,
7 HOOK_FEED_SET_ACTIVE: 4,
9 HOOK_ARTICLE_EXPANDED: 6,
10 HOOK_ARTICLE_COLLAPSED: 7,
11 HOOK_PARAMS_LOADED: 8,
12 HOOK_RUNTIME_INFO_LOADED: 9,
13 HOOK_FLOATING_TITLE: 10,
15 register: function (name, callback) {
16 if (typeof(this.hooks[name]) == 'undefined')
17 this.hooks[name] = [];
19 this.hooks[name].push(callback);
21 run: function (name, args) {
22 console.warn('PluginHost::run ' + name);
24 if (typeof(this.hooks[name]) != 'undefined')
25 for (i = 0; i < this.hooks[name].length; i++)
26 if (!this.hooks[name][i](args)) break;
30 /* PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED,
31 function (args) { console.log('ARTICLE_RENDERED: ' + args); return true; });
33 PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM,
34 function (args) { console.log('ARTICLE_RENDERED_CDM: ' + args); return true; }); */