From 03cb90c036bf4d5c9940df62ee2828a7a2e6ddd6 Mon Sep 17 00:00:00 2001 From: David Cormier Date: Sun, 27 Oct 2013 17:05:44 -0400 Subject: [PATCH] Move completeNick method to inputBar directive --- js/websockets.js | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/js/websockets.js b/js/websockets.js index dc0f89b..8e2d2c4 100644 --- a/js/websockets.js +++ b/js/websockets.js @@ -641,33 +641,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', } } - $rootScope.completeNick = function() { - // input DOM node - var inputNode = document.getElementById('sendMessage'); - - // get current input - var inputText = inputNode.value; - - // get current caret position - var caretPos = inputNode.selectionStart; - - // create flat array of nicks - var activeBuffer = models.getActiveBuffer(); - - // complete nick - var nickComp = IrcUtils.completeNick(inputText, caretPos, - $rootScope.iterCandidate, activeBuffer.flatNicklist(), ':'); - - // remember iteration candidate - $rootScope.iterCandidate = nickComp.iterCandidate; - - // update current input - $scope.command = nickComp.text; - - // update current caret position - inputNode.focus(); - inputNode.setSelectionRange(nickComp.caretPos, nickComp.caretPos); - } $scope.handleKeyPress = function($event) { }; @@ -743,7 +716,6 @@ weechat.directive('inputBar', function() { } - // Send the message to the websocket $scope.sendMessage = function() { connection.sendMessage($scope.command);