diff --git a/index.html b/index.html index bbbef49..249a2b8 100644 --- a/index.html +++ b/index.html @@ -36,6 +36,7 @@ + @@ -264,7 +265,7 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel -
+
  • diff --git a/js/glowingbear.js b/js/glowingbear.js index 8102930..e2f48fc 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -539,6 +539,17 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', return connection.fetchMoreLines(numLines); }; + $scope.infiniteScroll = function() { + // Check if we are already fetching + if ($rootScope.loadingLines) { + return; + } + var buffer = models.getActiveBuffer(); + if (!buffer.allLinesFetched) { + $scope.fetchMoreLines(); + } + }; + $rootScope.updateBufferBottom = function(bottom) { var eob = document.getElementById("end-of-buffer"); var bl = document.getElementById('bufferlines'); diff --git a/js/whenscrolled-directive.js b/js/whenscrolled-directive.js new file mode 100644 index 0000000..39a43e5 --- /dev/null +++ b/js/whenscrolled-directive.js @@ -0,0 +1,21 @@ +(function() { +'use strict'; + +var weechat = angular.module('weechat'); +weechat.directive('whenScrolled', function() { + return function(scope, elm, attr) { + var raw = elm[0]; + + var fun = function() { + if (raw.scrollTop === 0) { + scope.$apply(attr.whenScrolled); + } + }; + + elm.bind('scroll', function() { + _.debounce(fun, 200)(); + }); + }; +}); + +})();