]>
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.", true],
15 "ERROR": ["ERROR: $m", true],
16 "SERVERNOTICE": ["$m", true],
17 "JOIN": ["$n [$h] has joined $c", true],
18 "PART": ["$n [$h] has left $c [$m]", true],
19 "KICK": ["$v was kicked from $c by $n [$m]", true],
20 "MODE": ["mode/$c [$m] by $n", true],
21 "QUIT": ["$n [$h] has quit [$m]", true],
22 "NICK": ["$n has changed nick to $w", true],
23 "TOPIC": ["$n changed the topic of $c to: $m", true],
24 "UMODE": ["MODE $n $m", true],
25 "INVITE": ["$n invites you to join $c", true],
26 "CHANMSG": ["<$n> $m"],
27 "PRIVMSG": ["<$n> $m"],
28 "CHANNOTICE": ["-$n:$c- $m"],
29 "PRIVNOTICE": ["-$n- $m"],
30 "OURCHANMSG": ["<$n> $m"],
31 "OURPRIVMSG": ["<$n> $m"],
32 "OURTARGETEDMSG": ["*$t* $m"],
33 "OURTARGETEDNOTICE": ["[notice($t)] $m"],
34 "OURCHANNOTICE": ["-$n:$t- $m"],
35 "OURPRIVNOTICE": ["-$n- $m"],
36 "OURCHANACTION": [" * $n $m"],
37 "OURPRIVACTION": [" * $n $m"],
38 "CHANACTION": [" * $n $m"],
39 "PRIVACTION": [" * $n $m"],
40 "CHANCTCP": ["$n [$h] requested CTCP $x from $c: $m"],
41 "PRIVCTCP": ["$n [$h] requested CTCP $x from $-: $m"],
42 "CTCPREPLY": ["CTCP $x reply from $n: $m"],
43 "OURCHANCTCP": ["[ctcp($t)] $x $m"],
44 "OURPRIVCTCP": ["[ctcp($t)] $x $m"],
45 "OURTARGETEDCTCP": ["[ctcp($t)] $x $m"]
48 var Theme
= new Class({
49 initialize: function(themeDict
) {
52 for(var k
in DefaultTheme
)
53 this.__theme
[k
] = DefaultTheme
[k
];
56 for(var k
in themeDict
)
57 this.__theme
[k
] = themeDict
[k
];
59 for(var k
in this.__theme
) {
63 var data
= this.__theme
[k
];
65 this.__theme
[k
] = this.__theme
["PREFIX"] + data
[0];
67 this.__theme
[k
] = data
[0];
71 __dollarSubstitute: function(x
, h
) {
75 for(var i
=0;i
<n
.length
;i
++) {
77 if(c
== "$" && (i
<= n
.length
- 1)) {
80 var o
= ThemeControlCodeMap
[c2
];
92 message: function(type
, data
) {
93 var msg
= this.__theme
[type
];
95 msg
= this.__dollarSubstitute(msg
, data
);