]>
jfr.im git - irc/quakenet/qwebirc.git/blob - js/ui/menuitems.js
1 qwebirc
.ui
.UI_COMMANDS
= [
2 ["Options", "options"],
3 ["Add webchat to your site", "embedded"],
4 ["Privacy policy", "privacy"],
5 ["Feedback", "feedback"],
6 ["Frequently asked questions", "faq"],
7 ["About qwebirc", "about"]
10 qwebirc
.ui
.MENU_ITEMS = function() {
11 var isOpped = function(nick
) {
12 var channel
= this.name
; /* window name */
13 var myNick
= this.client
.nickname
;
15 return this.client
.nickOnChanHasAtLeastPrefix(myNick
, channel
, "@");
18 var isVoiced = function(nick
) {
19 var channel
= this.name
;
20 var myNick
= this.client
.nickname
;
22 return this.client
.nickOnChanHasPrefix(myNick
, channel
, "+");
25 var targetOpped = function(nick
) {
26 var channel
= this.name
;
27 return this.client
.nickOnChanHasPrefix(nick
, channel
, "@");
30 var targetVoiced = function(nick
) {
31 var channel
= this.name
;
32 return this.client
.nickOnChanHasPrefix(nick
, channel
, "+");
35 var invert
= qwebirc
.util
.invertFn
, compose
= qwebirc
.util
.composeAnd
;
37 var command = function(cmd
) {
38 return function(nick
) { this.client
.exec("/" + cmd
+ " " + nick
); };
54 fn: function(nick
) { this.client
.exec("/ME slaps " + nick
+ " around a bit with a large fishbot"); },
58 text: "kick", /* TODO: disappear when we're deopped */
59 fn: function(nick
) { this.client
.exec("/KICK " + nick
+ " wibble"); },
65 predicate: compose(isOpped
, invert(targetOpped
))
70 predicate: compose(isOpped
, targetOpped
)
75 predicate: compose(isOpped
, invert(targetVoiced
))
79 fn: command("devoice"),
80 predicate: compose(isOpped
, targetVoiced
)