]> jfr.im git - irc/quakenet/qwebirc.git/blame - js/ui/menuitems.js
Merge.
[irc/quakenet/qwebirc.git] / js / ui / menuitems.js
CommitLineData
7555d601
CP
1qwebirc.ui.menuitems = {fns: {}};
2
3qwebirc.ui.menuitems.fns.always = function() {
4 return true;
5};
6
7qwebirc.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*/
cffd43cf
CP
28qwebirc.ui.MENU_ITEMS = [
29 ["whois", function(nick) {
30 this.client.exec("/WHOIS " + nick);
7555d601 31 }, qwebirc.ui.menuitems.fns.always],
cffd43cf
CP
32 ["query", function(nick) {
33 this.client.exec("/QUERY " + nick);
7555d601 34 }, qwebirc.ui.menuitems.fns.always],
cffd43cf
CP
35 ["slap", function(nick) {
36 this.client.exec("/ME slaps " + nick + " around a bit with a large fishbot");
7555d601
CP
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]
cffd43cf 41];
f3d0c9f5
CP
42
43qwebirc.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];