-var ThemeControlCodeMap = {\r
- "C": "\x03",\r
- "B": "\x02",\r
- "U": "\x1F",\r
- "O": "\x0F",\r
- "$": "$"\r
-};\r
-\r
-var DefaultTheme = {\r
- "PREFIX": ["$C4==$O "],\r
- "SIGNON": ["Signed on!", true],\r
- "CONNECT": ["Connected to server.", true],\r
- "RAW": ["$m", true],\r
- "DISCONNECT": ["Disconnected from server.", true],\r
- "ERROR": ["ERROR: $m", true],\r
- "SERVERNOTICE": ["$m", true],\r
- "JOIN": ["$n [$h] has joined $c", true],\r
- "PART": ["$n [$h] has left $c [$m]", true],\r
- "KICK": ["$v was kicked from $c by $n [$m]", true],\r
- "MODE": ["mode/$c [$m] by $n", true],\r
- "QUIT": ["$n [$h] has quit [$m]", true],\r
- "NICK": ["$n has changed nick to $w", true],\r
- "TOPIC": ["$n changed the topic of $c to: $m", true],\r
- "UMODE": ["MODE $n $m", true],\r
- "INVITE": ["$n invites you to join $c", true],\r
- "CHANMSG": ["<$n> $m"],\r
- "PRIVMSG": ["<$n> $m"],\r
- "CHANNOTICE": ["-$n:$c- $m"],\r
- "PRIVNOTICE": ["-$n- $m"],\r
- "OURCHANMSG": ["<$n> $m"],\r
- "OURPRIVMSG": ["<$n> $m"],\r
- "OURTARGETEDMSG": ["*$t* $m"],\r
- "OURTARGETEDNOTICE": ["[notice($t)] $m"],\r
- "OURCHANNOTICE": ["-$n:$t- $m"],\r
- "OURPRIVNOTICE": ["-$n- $m"],\r
- "OURCHANACTION": [" * $n $m"],\r
- "OURPRIVACTION": [" * $n $m"],\r
- "CHANACTION": [" * $n $m"],\r
- "PRIVACTION": [" * $n $m"],\r
- "CHANCTCP": ["$n [$h] requested CTCP $x from $c: $m"],\r
- "PRIVCTCP": ["$n [$h] requested CTCP $x from $-: $m"],\r
- "CTCPREPLY": ["CTCP $x reply from $n: $m"],\r
- "OURCHANCTCP": ["[ctcp($t)] $x $m"],\r
- "OURPRIVCTCP": ["[ctcp($t)] $x $m"],\r
- "OURTARGETEDCTCP": ["[ctcp($t)] $x $m"]\r
-};\r
-\r
-var Theme = new Class({\r
- initialize: function(themeDict) {\r
- this.__theme = {};\r
- \r
- for(var k in DefaultTheme)\r
- this.__theme[k] = DefaultTheme[k];\r
- \r
- if(themeDict)\r
- for(var k in themeDict)\r
- this.__theme[k] = themeDict[k];\r
-\r
- for(var k in this.__theme) {\r
- if(k == "PREFIX")\r
- continue;\r
-\r
- var data = this.__theme[k];\r
- if(data[1]) {\r
- this.__theme[k] = this.__theme["PREFIX"] + data[0];\r
- } else {\r
- this.__theme[k] = data[0];\r
- }\r
- }\r
- },\r
- __dollarSubstitute: function(x, h) {\r
- var msg = [];\r
-\r
- var n = x.split("");\r
- for(var i=0;i<n.length;i++) {\r
- var c = n[i];\r
- if(c == "$" && (i <= n.length - 1)) {\r
- var c2 = n[++i];\r
-\r
- var o = ThemeControlCodeMap[c2];\r
- if(!o)\r
- o = h[c2];\r
- if(o)\r
- msg.push(o);\r
- } else {\r
- msg.push(c);\r
- }\r
- }\r
- \r
- return msg.join("");\r
- },\r
- message: function(type, data) {\r
- var msg = this.__theme[type];\r
- \r
- msg = this.__dollarSubstitute(msg, data);\r
-\r
- return msg;\r
- }\r
-});\r
+qwebirc.ui.themes.ThemeControlCodeMap = {
+ "C": "\x03",
+ "B": "\x02",
+ "U": "\x1F",
+ "O": "\x0F",
+ "$": "$"
+};
+
+qwebirc.ui.themes.Default = {
+ "PREFIX": ["$C4==$O "],
+ "SIGNON": ["Signed on!", true],
+ "CONNECT": ["Connected to server.", true],
+ "RAW": ["$m", true],
+ "DISCONNECT": ["Disconnected from server: $m", true],
+ "ERROR": ["ERROR: $m", true],
+ "SERVERNOTICE": ["$m", true],
+ "JOIN": ["$n [$h] has joined $c", true],
+ "OURJOIN": ["$n [$h] has joined $c", true],
+ "PART": ["$n [$h] has left $c [$m]", true],
+ "KICK": ["$v was kicked from $c by $n [$m]", true],
+ "MODE": ["mode/$c [$m] by $n", true],
+ "QUIT": ["$n [$h] has quit [$m]", true],
+ "NICK": ["$n has changed nick to $w", true],
+ "TOPIC": ["$n changed the topic of $c to: $m", true],
+ "UMODE": ["MODE $n $m", true],
+ "INVITE": ["$n invites you to join $c", true],
+ "CHANMSG": ["<$n> $m"],
+ "PRIVMSG": ["<$n> $m"],
+ "CHANNOTICE": ["-$n:$c- $m"],
+ "PRIVNOTICE": ["-$n- $m"],
+ "OURCHANMSG": ["<$n> $m"],
+ "OURPRIVMSG": ["<$n> $m"],
+ "OURTARGETEDMSG": ["*$t* $m"],
+ "OURTARGETEDNOTICE": ["[notice($t)] $m"],
+ "OURCHANNOTICE": ["-$n:$t- $m"],
+ "OURPRIVNOTICE": ["-$n- $m"],
+ "OURCHANACTION": [" * $n $m"],
+ "OURPRIVACTION": [" * $n $m"],
+ "CHANACTION": [" * $n $m"],
+ "PRIVACTION": [" * $n $m"],
+ "CHANCTCP": ["$n [$h] requested CTCP $x from $c: $m"],
+ "PRIVCTCP": ["$n [$h] requested CTCP $x from $-: $m"],
+ "CTCPREPLY": ["CTCP $x reply from $n: $m"],
+ "OURCHANCTCP": ["[ctcp($t)] $x $m"],
+ "OURPRIVCTCP": ["[ctcp($t)] $x $m"],
+ "OURTARGETEDCTCP": ["[ctcp($t)] $x $m"],
+ "WHOISUSER": ["$B$n$B [$h]", true],
+ "WHOISREALNAME": [" realname : $m", true],
+ "WHOISCHANNELS": [" channels : $m", true],
+ "WHOISSERVER": [" server : $x [$m]", true],
+ "WHOISACCOUNT": [" account : $m", true],
+ "WHOISIDLE": [" idle : $x [connected: $m]", true],
+ "WHOISAWAY": [" away : $m", true],
+ "WHOISOPER": [" : $BIRC Operator$B", true],
+ "WHOISOPERNAME": [" operedas : $m", true],
+ "WHOISACTUALLY": [" realhost : $m [ip: $x]", true],
+ "WHOISEND": ["End of WHOIS", true],
+ "AWAY": ["$n is away: $m", true]
+};
+
+qwebirc.ui.Theme = new Class({
+ initialize: function(themeDict) {
+ this.__theme = {};
+
+ for(var k in qwebirc.ui.themes.Default)
+ this.__theme[k] = qwebirc.ui.themes.Default[k];
+
+ if(themeDict)
+ for(var k in themeDict)
+ this.__theme[k] = themeDict[k];
+
+ for(var k in this.__theme) {
+ if(k == "PREFIX")
+ continue;
+
+ var data = this.__theme[k];
+ if(data[1]) {
+ this.__theme[k] = this.__theme["PREFIX"] + data[0];
+ } else {
+ this.__theme[k] = data[0];
+ }
+ }
+ },
+ __dollarSubstitute: function(x, h) {
+ var msg = [];
+
+ var n = x.split("");
+ for(var i=0;i<n.length;i++) {
+ var c = n[i];
+ if(c == "$" && (i <= n.length - 1)) {
+ var c2 = n[++i];
+
+ var o = qwebirc.ui.themes.ThemeControlCodeMap[c2];
+ if(!o)
+ o = h[c2];
+ if(o)
+ msg.push(o);
+ } else {
+ msg.push(c);
+ }
+ }
+
+ return msg.join("");
+ },
+ message: function(type, data) {
+ var msg = this.__theme[type];
+
+ msg = this.__dollarSubstitute(msg, data);
+
+ return msg;
+ }
+});