From 626211b1af673d6da7cab9af5f6debba4f2e10dd Mon Sep 17 00:00:00 2001 From: David Cormier Date: Mon, 5 May 2014 22:20:44 -0400 Subject: [PATCH] bufferline: create and append prefix element Diminish watcher count in the template by removing ng-repeat. --- directives/bufferline.html | 2 +- js/glowingbear.js | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/directives/bufferline.html b/directives/bufferline.html index e7c88a5..1ba6df2 100644 --- a/directives/bufferline.html +++ b/directives/bufferline.html @@ -3,7 +3,7 @@ :: - +
diff --git a/js/glowingbear.js b/js/glowingbear.js index 4907525..6f7fb12 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -1245,9 +1245,14 @@ weechat.directive('bufferLine', function() { link: { pre: function preLink(scope, iElement, iAttrs, controller) { - - for (var part in scope.bufferline.prefix) { - + var prefix = ""; + for (var partNum in scope.bufferline.prefix) { + var part = scope.bufferline.prefix[partNum]; + prefix = angular.element("" + part.text + ""); + for (var classNum in part.classes) { + prefix.addClass(part.classes[classNum]); + } + iElement.find('td.prefix').append(prefix); } } }, @@ -1255,7 +1260,7 @@ weechat.directive('bufferLine', function() { controller: function($scope) { } - } + }; }); weechat.directive('inputBar', function() {