__dirname + '/src/views/userbox.js',\r
__dirname + '/src/views/channeltools.js',\r
__dirname + '/src/views/channelinfo.js',\r
- __dirname + '/src/views/texttheme.js',\r
__dirname + '/src/applets/settings.js',\r
__dirname + '/src/applets/chanlist.js',\r
__dirname + '/src/applets/scripteditor.js',\r
// Simplyfy the translation syntax
function translateText(string_id, params) {
- if (params === undefined) var params = '';
-
+ params = params || '';
+
return _kiwi.global.i18n.translate(string_id).fetch(params);
}
-// Simplyfy the text styling syntax
+
+/**
+ * Simplyfy the text styling syntax
+ *
+ * Syntax:
+ * %N: nickname
+ * %C: channel
+ * %J: ident
+ * %H: host
+ * %R: realname
+ * %C[digit]: color
+ * %B: bold
+ * %I: italic
+ * %U: underline
+ * %O: cancel styles
+ * %T: translated text
+ **/
function styleText(string_id, params) {
- return _kiwi.global.text_theme.styleText(string_id, params);
+ var style, text;
+
+ style = formatToIrcMsg(_kiwi.global.text_theme.options[string_id]);
+
+ // Bring member info back to first level of params
+ if (params['%M']) {
+ _.each(params['%M'], function(val, key) {
+ params[key] = val;
+ });
+ }
+
+ // Do the magic. Use the shorthand syntax to produce output.
+ text = style.replace(/%([TJHNCR])/g, function(match, key) {
+ key = '%' + key;
+
+ if (typeof params[key.toUpperCase()] !== 'undefined')
+ return params[key.toUpperCase()];
+ });
+
+ return text;
}
\ No newline at end of file
+++ /dev/null
-/**
- * TEXT THEMES SYNTAX
- *
- * %N: nickname
- * %C[digit]: color
- * %C: channel
- * %J: ident
- * %H: host
- * %R: realname
- * %B: bold
- * %I: italic
- * %U: underline
- * %O: cancel styles
- * %T: translated text
- **/
-
-_kiwi.view.TextTheme = _kiwi.view.Panel.extend({
- initialize: function(text_theme) {
- this.text_theme = text_theme;
- },
- styleText: function(string_id, params) {
- var style, text;
-
- style = formatToIrcMsg(_kiwi.global.text_theme.options[string_id]);
-
- // Bring member info back to first level of params
- if (params['%M']) {
- for(key in params['%M']) {
- params[key] = params['%M'][key];
- }
- }
-
- // Do the magic. Use the shorthand syntax to produce output.
- text = style.replace(/%([TJHNCR])/g, function(match, key) {
- key = '%' + key;
-
- if (typeof params[key.toUpperCase()] !== 'undefined')
- return params[key.toUpperCase()];
- });
- return text;
- }
-});
\ No newline at end of file
'src/views/userbox.js',
'src/views/channeltools.js',
'src/views/channelinfo.js',
- 'src/views/texttheme.js',
'src/applets/settings.js',
'src/applets/chanlist.js',
'src/applets/scripteditor.js',