diff --git a/js/glowingbear.js b/js/glowingbear.js index 243d249..5a42194 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -868,7 +868,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', // get last word var lastSpace = trimmedValue.lastIndexOf(' ') + 1; var lastWord = trimmedValue.slice(lastSpace, trimmedValue.length - 1); - var nicklist = models.getActiveBuffer().flatNicklist(); + var nicklist = models.getActiveBuffer().getNicklistByTime(); // check against nicklist to see if it's a list of highlights if (nicklist.indexOf(lastWord) !== -1) { // It's another highlight! @@ -1230,7 +1230,7 @@ weechat.directive('inputBar', function() { // get current caret position var caretPos = inputNode.selectionStart; - // create flat array of nicks + // get current active buffer var activeBuffer = models.getActiveBuffer(); // complete nick diff --git a/js/irc-utils.js b/js/irc-utils.js index f608317..11e2465 100644 --- a/js/irc-utils.js +++ b/js/irc-utils.js @@ -3,24 +3,6 @@ */ var IrcUtils = { - /** - * Get a new version of a nick list, sorted alphabetically by lowercase nick. - * - * @param nickList Original nick list - * @return Nick list sorted alphabetically by lowercase nick - */ - _ciSearchNickList: function(nickList) { - var newList = []; - - nickList.forEach(function(nick) { - newList.push(nick); - }); - newList.sort(function(a, b) { - return a.toLowerCase() < b.toLowerCase() ? -1 : 1; - }); - - return newList; - }, /** * Get a new version of a nick list, sorted by last speaker * diff --git a/js/models.js b/js/models.js index b5ab4e8..08af87d 100644 --- a/js/models.js +++ b/js/models.js @@ -20,7 +20,6 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter) var lines = []; var requestedLines = 0; var nicklist = {}; - var flatnicklist = []; var history = []; var historyPos = 0; var active = false; @@ -53,7 +52,6 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter) if (nicklistRequested()) { nick.spokeAt = Date.now(); nicklist[group].nicks.push(nick); - flatnicklist = getFlatNicklist(); } }; /* @@ -65,7 +63,6 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter) return; } group.nicks = _.filter(group.nicks, function(n) { return n.name !== nick.name;}); - flatnicklist = getFlatNicklist(); /* for (i in group.nicks) { if (group.nicks[i].name == nick.name) { @@ -86,7 +83,6 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter) break; } } - flatnicklist = getFlatNicklist(); }; /* @@ -116,7 +112,6 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter) } }); }); - flatnicklist = getFlatNicklist(); }; /* @@ -139,20 +134,6 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter) return newlist; }; - var getFlatNicklist = function() { - var newlist = []; - _.each(nicklist, function(nickGroup) { - _.each(nickGroup.nicks, function(nickObj) { - newlist.push(nickObj.name); - }); - }); - return newlist; - }; - - var flatNicklist = function() { - return flatnicklist; - }; - var addToHistory = function(line) { var result = ""; if (historyPos !== history.length) { @@ -234,7 +215,6 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter) addNick: addNick, delNick: delNick, updateNick: updateNick, - flatNicklist: flatNicklist, getNicklistByTime: getNicklistByTime, serverSortKey: serverSortKey, indent: indent,