]>
jfr.im git - irc/quakenet/qwebirc.git/blob - js/ui/menuitems.js
1 qwebirc
.ui
.menuitems
= {fns: {}};
3 qwebirc
.ui
.menuitems
.fns
.always = function() {
7 qwebirc
.ui
.menuitems
.fns
.is_opped = function() {
8 var channel
= this.name
; /* window name */
9 var myNick
= this.client
.nickname
;
11 var entry
= this.client
.tracker
.getNickOnChannel(myNick
, channel
);
13 return false; /* shouldn't happen */
15 /* TODO: improve (halfops) */
16 return entry
.prefixes
.indexOf("@") != -1;
20 [text, command_fn, visible_predicate]
22 - text is the text shown to the user in the menu
23 - command_fn is executed when they click
24 (this will be the current window)
25 - visible_predicate will be executed to determine whether or not to show the item
26 (this will be the current window)
28 qwebirc
.ui
.MENU_ITEMS
= [
29 ["whois", function(nick
) {
30 this.client
.exec("/WHOIS " + nick
);
31 }, qwebirc
.ui
.menuitems
.fns
.always
],
32 ["query", function(nick
) {
33 this.client
.exec("/QUERY " + nick
);
34 }, qwebirc
.ui
.menuitems
.fns
.always
],
35 ["slap", function(nick
) {
36 this.client
.exec("/ME slaps " + nick
+ " around a bit with a large fishbot");
37 }, qwebirc
.ui
.menuitems
.fns
.always
],
38 ["kick", function(nick
) { /* TODO: disappear when we're deopped */
39 this.client
.exec("/KICK " + nick
+ " wibble");
40 }, qwebirc
.ui
.menuitems
.fns
.is_opped
]
43 qwebirc
.ui
.UI_COMMANDS
= [
44 ["Options", "options"],
45 ["Add webchat to your site", "embedded"],
46 ["Privacy policy", "privacy"],
47 ["Feedback", "feedback"],
48 ["Frequently asked questions", "faq"],
49 ["About qwebirc", "about"]