From e48fe29cf83ada0181bbc78c265f51df5ec92976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Mon, 10 Feb 2014 20:42:19 +0000 Subject: [PATCH] Automatically scroll plugins into view --- directives/plugin.html | 2 +- js/glowingbear.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/directives/plugin.html b/directives/plugin.html index 2bca14d..c0669bb 100644 --- a/directives/plugin.html +++ b/directives/plugin.html @@ -4,7 +4,7 @@ Hide {{ plugin.name }} -
+
diff --git a/js/glowingbear.js b/js/glowingbear.js index 1682cd0..3a4e49c 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -810,6 +810,15 @@ weechat.directive('plugin', function() { */ $scope.displayedContent = $scope.plugin.content; $scope.plugin.visible = true; + + // Scroll embed content into view + var elems = $("." + $scope.plugin.$$hashKey); + if (elems.length == 1) { + var scroll = function() { + elems[0].scrollIntoViewIfNeeded(); + }; + setTimeout(scroll, 100); + } }; }