From f4ee683100901bdc6f4432a8306ca9a26d3226da Mon Sep 17 00:00:00 2001 From: David Cormier Date: Thu, 6 Feb 2014 21:21:49 -0500 Subject: [PATCH] Only retrieve plugin content when 'Show Content' is pressed --- directives/plugin.html | 19 ++++++++++--------- js/glowingbear.js | 29 +++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/directives/plugin.html b/directives/plugin.html index 2b6fe6e..2bca14d 100644 --- a/directives/plugin.html +++ b/directives/plugin.html @@ -1,17 +1,18 @@ -
+
-
+ +
-
+
diff --git a/js/glowingbear.js b/js/glowingbear.js index 8ad8845..7899a08 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -764,13 +764,38 @@ weechat.config(['$routeProvider', weechat.directive('plugin', function() { - + /* + * Plugin directive + * Shows additional plugin content + */ return { templateUrl: 'directives/plugin.html', scope: { - data: '=data', + plugin: '=data', }, + + controller: function($scope) { + + $scope.displayedContent = ""; + + $scope.hideContent = function() { + $scope.plugin.visible = false; + } + + $scope.showContent = function() { + /* + * Shows the plugin content. + * displayedContent is bound to the DOM. + * Actual plugin content is only fetched when + * content is shown. + */ + $scope.displayedContent = $scope.plugin.content; + $scope.plugin.visible = true; + } + + } + } });