mirror of
https://github.com/thelounge/thelounge
synced 2024-11-10 14:44:13 +00:00
Added tab completion for users
This commit is contained in:
parent
ffe9068c9e
commit
b730e60582
2 changed files with 27 additions and 17 deletions
|
@ -44,13 +44,14 @@ $(function() {
|
|||
}
|
||||
|
||||
function event(e, data) {
|
||||
console.log(arguments);
|
||||
switch (e) {
|
||||
case "join":
|
||||
chat.append(render("#windows", {windows: [data.chan]}))
|
||||
.find(".window")
|
||||
.last()
|
||||
.find(".input")
|
||||
.tabComplete({after: " ", list: commands})
|
||||
.tabComplete({list: commands})
|
||||
.inputHistory({submit: true})
|
||||
.end()
|
||||
.bringToTop()
|
||||
|
@ -81,15 +82,15 @@ $(function() {
|
|||
.bringToTop()
|
||||
.end()
|
||||
.find(".input")
|
||||
.tabComplete({after: " ", list: commands})
|
||||
.tabComplete({list: commands})
|
||||
.inputHistory({submit: true})
|
||||
.end()
|
||||
.find(".messages")
|
||||
.scrollGlue({speed: 400})
|
||||
.end()
|
||||
.find(".hidden")
|
||||
.prev(".show-more")
|
||||
.show()
|
||||
.parent()
|
||||
.scrollGlue({speed: 400})
|
||||
.end();
|
||||
.show();
|
||||
|
||||
sidebar.html(render("#networks", {networks: data.networks}))
|
||||
.find(".channel")
|
||||
|
@ -109,9 +110,15 @@ $(function() {
|
|||
break;
|
||||
|
||||
case "users":
|
||||
var users = $.map(data.users, function(u) { return u.name; });
|
||||
var tabComplete = commands.concat(users);
|
||||
$("#window-" + data.id)
|
||||
.find(".input")
|
||||
.data("list", tabComplete)
|
||||
.end()
|
||||
.find(".users")
|
||||
.html(render("#users", {users: data.users}));
|
||||
.html(render("#users", {users: data.users}))
|
||||
.end();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* Copyright (c) 2014 Mattias Erming <mattias@mattiaserming.com>
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Version 0.1.1
|
||||
* Version 0.1.2
|
||||
*/
|
||||
(function($) {
|
||||
$.fn.inputHistory = function(options) {
|
||||
|
@ -95,13 +95,15 @@
|
|||
* Copyright (c) 2014 Mattias Erming <mattias@mattiaserming.com>
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Version 0.2.2
|
||||
* Version 1.1.0
|
||||
*/
|
||||
(function($) {
|
||||
$.fn.scrollGlue = function(options) {
|
||||
var settings = $.extend({
|
||||
speed: 0,
|
||||
disableManualScroll: false,
|
||||
overflow: "scroll",
|
||||
scrollToBottom: true,
|
||||
speed: 0
|
||||
}, options);
|
||||
|
||||
var self = this;
|
||||
|
@ -111,6 +113,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
self.css("overflow-y", settings.overflow);
|
||||
if (settings.scrollToBottom) {
|
||||
self.scrollToBottom();
|
||||
}
|
||||
|
@ -119,9 +122,13 @@
|
|||
self.finish();
|
||||
});
|
||||
|
||||
var sticky = false;
|
||||
var sticky = true;
|
||||
self.on('scroll', function() {
|
||||
sticky = self.isScrollAtBottom();
|
||||
if (settings.disableManualScroll) {
|
||||
self.scrollToBottom();
|
||||
} else {
|
||||
sticky = self.isScrollAtBottom();
|
||||
}
|
||||
});
|
||||
self.trigger('scroll');
|
||||
self.on('append', function() {
|
||||
|
@ -133,8 +140,6 @@
|
|||
return this;
|
||||
};
|
||||
|
||||
// Overrides
|
||||
|
||||
var prepend = $.fn.prepend;
|
||||
$.fn.prepend = function() {
|
||||
return prepend.apply(this, arguments).trigger('append');
|
||||
|
@ -154,8 +159,6 @@
|
|||
return result;
|
||||
};
|
||||
|
||||
// Utils
|
||||
|
||||
$.fn.scrollToBottom = function(speed) {
|
||||
return this.each(function() {
|
||||
$(this).finish().animate({scrollTop: this.scrollHeight}, speed || 0);
|
||||
|
@ -176,7 +179,7 @@
|
|||
* Copyright (c) 2014 Mattias Erming <mattias@mattiaserming.com>
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Version 0.2.2
|
||||
* Version 0.2.3
|
||||
*/
|
||||
(function($) {
|
||||
$.fn.tabComplete = function(options) {
|
||||
|
|
Loading…
Reference in a new issue