]>
Commit | Line | Data |
---|---|---|
1 | qwebirc.ui.menuitems = {fns: {}}; | |
2 | ||
3 | qwebirc.ui.menuitems.fns.always = function() { | |
4 | return true; | |
5 | }; | |
6 | ||
7 | qwebirc.ui.menuitems.fns.is_opped = function() { | |
8 | var channel = this.name; /* window name */ | |
9 | var myNick = this.client.nickname; | |
10 | ||
11 | var entry = this.client.tracker.getNickOnChannel(myNick, channel); | |
12 | if(!$defined(entry)) | |
13 | return false; /* shouldn't happen */ | |
14 | ||
15 | /* TODO: improve (halfops) */ | |
16 | return entry.prefixes.indexOf("@") != -1; | |
17 | }; | |
18 | ||
19 | /* | |
20 | [text, command_fn, visible_predicate] | |
21 | ||
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) | |
27 | */ | |
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] | |
41 | ]; | |
42 | ||
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"] | |
50 | ]; |