]> jfr.im git - irc/quakenet/qwebirc.git/blame - js/ui/menuitems.js
notifier now uses themes
[irc/quakenet/qwebirc.git] / js / ui / menuitems.js
CommitLineData
f3d0c9f5
CP
1qwebirc.ui.UI_COMMANDS = [
2 ["Options", "options"],
3 ["Add webchat to your site", "embedded"],
4 ["Privacy policy", "privacy"],
5 ["Feedback", "feedback"],
355dbcb7 6 ["Help!", "help"],
f3d0c9f5
CP
7 ["About qwebirc", "about"]
8];
27add99a
CP
9
10qwebirc.ui.MENU_ITEMS = function() {
11 var isOpped = function(nick) {
12 var channel = this.name; /* window name */
13 var myNick = this.client.nickname;
14
6b12b682 15 return this.client.nickOnChanHasAtLeastPrefix(myNick, channel, "@");
27add99a
CP
16 };
17
18 var isVoiced = function(nick) {
19 var channel = this.name;
20 var myNick = this.client.nickname;
21
22 return this.client.nickOnChanHasPrefix(myNick, channel, "+");
23 };
24
25 var targetOpped = function(nick) {
26 var channel = this.name;
27 return this.client.nickOnChanHasPrefix(nick, channel, "@");
28 };
29
30 var targetVoiced = function(nick) {
31 var channel = this.name;
32 return this.client.nickOnChanHasPrefix(nick, channel, "+");
33 };
34
b90b6d5f
CP
35 var isIgnored = function(nick) {
36 return this.client.isIgnored(nick);
37 };
38
27add99a
CP
39 var invert = qwebirc.util.invertFn, compose = qwebirc.util.composeAnd;
40
41 var command = function(cmd) {
42 return function(nick) { this.client.exec("/" + cmd + " " + nick); };
43 };
44
45 return [
46 {
47 text: "whois",
48 fn: command("whois"),
49 predicate: true
50 },
51 {
52 text: "query",
53 fn: command("query"),
54 predicate: true
55 },
56 {
57 text: "slap",
58 fn: function(nick) { this.client.exec("/ME slaps " + nick + " around a bit with a large fishbot"); },
59 predicate: true
60 },
61 {
62 text: "kick", /* TODO: disappear when we're deopped */
63 fn: function(nick) { this.client.exec("/KICK " + nick + " wibble"); },
64 predicate: isOpped
65 },
66 {
67 text: "op",
68 fn: command("op"),
69 predicate: compose(isOpped, invert(targetOpped))
70 },
71 {
72 text: "deop",
73 fn: command("deop"),
74 predicate: compose(isOpped, targetOpped)
75 },
76 {
77 text: "voice",
78 fn: command("voice"),
79 predicate: compose(isOpped, invert(targetVoiced))
80 },
81 {
82 text: "devoice",
83 fn: command("devoice"),
84 predicate: compose(isOpped, targetVoiced)
b90b6d5f
CP
85 },
86 {
87 text: "ignore",
88 fn: command("ignore"),
89 predicate: invert(isIgnored)
90 },
91 {
92 text: "unignore",
93 fn: command("unignore"),
94 predicate: isIgnored
27add99a
CP
95 }
96 ];
97}();