More work on text themes. Splitting translation and text themes, adding nick/ident...
[KiwiIRC.git] / client / src / views / texttheme.js
1 _kiwi.view.TextTheme = _kiwi.view.Panel.extend({
2 initialize: function(text_theme) {
3 this.text_theme = text_theme;
4 },
5 styleText: function(string_id, params) {
6 var style, text;
7
8 style = formatToIrcMsg(_kiwi.global.text_theme.options[string_id]);
9
10 // Bring member info back to first level of params
11 if (params['%M']) {
12 for(key in params['%M']) {
13 params[key] = params['%M'][key];
14 }
15 }
16
17 text = style.replace(/%([TJHNC])/g, function(match, key) {
18 key = '%' + key;
19
20 if (typeof params[key.toUpperCase()] !== 'undefined')
21 return params[key.toUpperCase()];
22 });
23 return text;
24 }
25 });