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