Commit | Line | Data |
---|---|---|
d2cf53f5 CC |
1 | _kiwi.view.TextTheme = _kiwi.view.Panel.extend({ |
2 | initialize: function(text_theme) { | |
3 | this.text_theme = text_theme; | |
4 | }, | |
530f55dc | 5 | styleText: function(string_id, params) { |
d2cf53f5 CC |
6 | var style, text; |
7 | ||
8 | style = formatToIrcMsg(_kiwi.global.text_theme.options[string_id]); | |
d2cf53f5 | 9 | |
530f55dc CC |
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; | |
d2cf53f5 CC |
24 | } |
25 | }); |