diff --git a/client/js/chat.js b/client/js/chat.js index 2b2311a..41ed7ae 100644 --- a/client/js/chat.js +++ b/client/js/chat.js @@ -59,7 +59,7 @@ $(function() { .find(".window") .last() .find(".messages") - .scrollGlue({speed: 400}) + .sticky({speed: 400}) .end() .find(".input") .tabComplete(commands); @@ -87,7 +87,7 @@ $(function() { .prev(".show-more") .show(); chat.find(".messages") - .scrollGlue({speed: 400}) + .sticky({speed: 400}) .end(); var networks = $("#networks") diff --git a/client/js/jquery.plugins.js b/client/js/jquery.plugins.js index b702054..7ea94d2 100644 --- a/client/js/jquery.plugins.js +++ b/client/js/jquery.plugins.js @@ -1,72 +1,6 @@ /*! - * inputHistory - * https://github.com/erming/inputHistory - * - * Copyright (c) 2014 Mattias Erming - * Licensed under the MIT License. - * - * Version 0.1.2 - */ -(function($) { - $.fn.inputHistory = function(options) { - var settings = $.extend({ - history: [], - submit: false, - }, options); - - var self = this; - if (self.size() > 1) { - return self.each(function() { - $(this).inputHistory(options); - }); - } - - self.data('history', settings.history.concat([''])); - - var i = 0; - self.on('keydown', function(e) { - var history = self.data('history'); - var key = e.which; - switch (key) { - - case 13: // Enter - if (self.val() != '') { - i = history.length; - history[i - 1] = self.val(); - history.push(''); - } - if (settings.submit) { - self.parents('form').eq(0).submit(); - } - self.val(''); - break; - - case 38: // Up - case 40: // Down - history[i] = self.val(); - if (key == 38 && i != 0) { - i--; - } else if (key == 40 && i < history.length - 1) { - i++; - } - self.val(history[i]); - break; - - default: - return; - - } - - return false; - }); - - return this; - } -})(jQuery); - -/*! - * scrollGlue - * https://github.com/erming/scrollGlue + * stickyScroll + * https://github.com/erming/stickyScroll * * Copyright (c) 2014 Mattias Erming * Licensed under the MIT License. @@ -74,7 +8,7 @@ * Version 1.2.1 */ (function($) { - $.fn.scrollGlue = function(options) { + $.fn.sticky = function(options) { var settings = $.extend({ disableManualScroll: false, overflow: 'scroll', @@ -85,7 +19,7 @@ var self = this; if (self.size() > 1) { return self.each(function() { - $(this).scrollGlue(options); + $(this).sticky(options); }); } @@ -156,43 +90,52 @@ /*! * tabComplete + * Lightweight tab completion for and