X-Git-Url: https://jfr.im/git/irc/quakenet/qwebirc.git/blobdiff_plain/0019128d23892af53330295b65db0ecebe8135a0..9e769c12bfb7ac3beafbcfee9604f8aadcd8f2ca:/js/ui/theme.js diff --git a/js/ui/theme.js b/js/ui/theme.js index f4657b0..9e5ffc2 100644 --- a/js/ui/theme.js +++ b/js/ui/theme.js @@ -1,99 +1,99 @@ -var ThemeControlCodeMap = { - "C": "\x03", - "B": "\x02", - "U": "\x1F", - "O": "\x0F", - "$": "$" -}; - -var DefaultTheme = { - "PREFIX": ["$C4==$O "], - "SIGNON": ["Signed on!", true], - "CONNECT": ["Connected to server.", true], - "RAW": ["$m", true], - "DISCONNECT": ["Disconnected from server.", true], - "ERROR": ["ERROR: $m", true], - "SERVERNOTICE": ["$m", true], - "JOIN": ["$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"] -}; - -var Theme = new Class({ - initialize: function(themeDict) { - this.__theme = {}; - - for(var k in DefaultTheme) - this.__theme[k] = DefaultTheme[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 $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"] +}; + +var Theme = new Class({ + initialize: function(themeDict) { + this.__theme = {}; + + for(var k in DefaultTheme) + this.__theme[k] = DefaultTheme[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