Press tab to complete usernames
This commit is contained in:
parent
0f456596ed
commit
7d36997b83
@ -61,12 +61,12 @@ $(function() {
|
|||||||
chat.append(render("windows", {windows: [data.chan]}))
|
chat.append(render("windows", {windows: [data.chan]}))
|
||||||
.find(".window")
|
.find(".window")
|
||||||
.last()
|
.last()
|
||||||
.find(".chat")
|
|
||||||
.sticky()
|
|
||||||
.end()
|
|
||||||
.find(".input")
|
.find(".input")
|
||||||
.tabcomplete(complete, {hint: false})
|
.tabcomplete(complete, {hint: false})
|
||||||
.history();
|
.history()
|
||||||
|
.end()
|
||||||
|
.find(".chat")
|
||||||
|
.sticky();
|
||||||
|
|
||||||
$("#network-" + data.id)
|
$("#network-" + data.id)
|
||||||
.append(render("channels", {channels: [data.chan]}))
|
.append(render("channels", {channels: [data.chan]}))
|
||||||
@ -97,12 +97,12 @@ $(function() {
|
|||||||
case "networks":
|
case "networks":
|
||||||
var channels = $.map(data.networks, function(n) { return n.channels; });
|
var channels = $.map(data.networks, function(n) { return n.channels; });
|
||||||
chat.html(render("windows", {windows: channels}))
|
chat.html(render("windows", {windows: channels}))
|
||||||
.find(".chat")
|
|
||||||
.sticky()
|
|
||||||
.end()
|
|
||||||
.find(".input")
|
.find(".input")
|
||||||
.tabcomplete(complete, {hint: false})
|
.tabcomplete(complete, {hint: false})
|
||||||
.history();
|
.history()
|
||||||
|
.end()
|
||||||
|
.find(".chat")
|
||||||
|
.sticky();
|
||||||
|
|
||||||
var networks = $("#networks")
|
var networks = $("#networks")
|
||||||
.html(render("networks", {networks: data.networks}))
|
.html(render("networks", {networks: data.networks}))
|
||||||
@ -291,8 +291,14 @@ $(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function complete(word) {
|
function complete(word) {
|
||||||
|
var words = commands;
|
||||||
|
var users = $(this).closest(".window")
|
||||||
|
.find(".users .user")
|
||||||
|
.each(function() {
|
||||||
|
words.push(this.getAttribute("href").slice(1));
|
||||||
|
});
|
||||||
return $.grep(
|
return $.grep(
|
||||||
commands,
|
words,
|
||||||
function(cmd) {
|
function(cmd) {
|
||||||
return !cmd.indexOf(word);
|
return !cmd.indexOf(word);
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@
|
|||||||
if (typeof args === "function") {
|
if (typeof args === "function") {
|
||||||
// If the user supplies a function, invoke it
|
// If the user supplies a function, invoke it
|
||||||
// and keep the result.
|
// and keep the result.
|
||||||
words = args(word);
|
words = args.call(self, word);
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, call the .match() function.
|
// Otherwise, call the .match() function.
|
||||||
words = match(word, args, options.caseSensitive);
|
words = match(word, args, options.caseSensitive);
|
||||||
|
Loading…
Reference in New Issue
Block a user