]>
jfr.im git - irc/quakenet/qwebirc.git/blob - js/ui/theme.js
1 var ThemeControlCodeMap
= {
10 "PREFIX": ["$C4==$O "],
11 "SIGNON": ["Signed on!", true],
12 "CONNECT": ["Connected to server.", true],
14 "DISCONNECT": ["Disconnected from server: $m", true],
15 "ERROR": ["ERROR: $m", true],
16 "SERVERNOTICE": ["$m", true],
17 "JOIN": ["$n [$h] has joined $c", true],
18 "OURJOIN": ["$n [$h] has joined $c", true],
19 "PART": ["$n [$h] has left $c [$m]", true],
20 "KICK": ["$v was kicked from $c by $n [$m]", true],
21 "MODE": ["mode/$c [$m] by $n", true],
22 "QUIT": ["$n [$h] has quit [$m]", true],
23 "NICK": ["$n has changed nick to $w", true],
24 "TOPIC": ["$n changed the topic of $c to: $m", true],
25 "UMODE": ["MODE $n $m", true],
26 "INVITE": ["$n invites you to join $c", true],
27 "CHANMSG": ["<$n> $m"],
28 "PRIVMSG": ["<$n> $m"],
29 "CHANNOTICE": ["-$n:$c- $m"],
30 "PRIVNOTICE": ["-$n- $m"],
31 "OURCHANMSG": ["<$n> $m"],
32 "OURPRIVMSG": ["<$n> $m"],
33 "OURTARGETEDMSG": ["*$t* $m"],
34 "OURTARGETEDNOTICE": ["[notice($t)] $m"],
35 "OURCHANNOTICE": ["-$n:$t- $m"],
36 "OURPRIVNOTICE": ["-$n- $m"],
37 "OURCHANACTION": [" * $n $m"],
38 "OURPRIVACTION": [" * $n $m"],
39 "CHANACTION": [" * $n $m"],
40 "PRIVACTION": [" * $n $m"],
41 "CHANCTCP": ["$n [$h] requested CTCP $x from $c: $m"],
42 "PRIVCTCP": ["$n [$h] requested CTCP $x from $-: $m"],
43 "CTCPREPLY": ["CTCP $x reply from $n: $m"],
44 "OURCHANCTCP": ["[ctcp($t)] $x $m"],
45 "OURPRIVCTCP": ["[ctcp($t)] $x $m"],
46 "OURTARGETEDCTCP": ["[ctcp($t)] $x $m"]
49 var Theme
= new Class({
50 initialize: function(themeDict
) {
53 for(var k
in DefaultTheme
)
54 this.__theme
[k
] = DefaultTheme
[k
];
57 for(var k
in themeDict
)
58 this.__theme
[k
] = themeDict
[k
];
60 for(var k
in this.__theme
) {
64 var data
= this.__theme
[k
];
66 this.__theme
[k
] = this.__theme
["PREFIX"] + data
[0];
68 this.__theme
[k
] = data
[0];
72 __dollarSubstitute: function(x
, h
) {
76 for(var i
=0;i
<n
.length
;i
++) {
78 if(c
== "$" && (i
<= n
.length
- 1)) {
81 var o
= ThemeControlCodeMap
[c2
];
93 message: function(type
, data
) {
94 var msg
= this.__theme
[type
];
96 msg
= this.__dollarSubstitute(msg
, data
);