mirror of
https://github.com/thelounge/thelounge
synced 2024-11-26 14:00:21 +00:00
Press tab to complete usernames
This commit is contained in:
parent
0f456596ed
commit
7d36997b83
2 changed files with 16 additions and 10 deletions
|
@ -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 a new issue