From 8068be8de20ceb70efda39b142f03ac479c5317b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Mon, 10 Feb 2014 20:17:51 +0000 Subject: [PATCH] Remove setting and calculate number of lines from display properties --- index.html | 18 ++++++------------ js/glowingbear.js | 10 +++++++++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/index.html b/index.html index fe10c2e..41f8137 100644 --- a/index.html +++ b/index.html @@ -245,16 +245,6 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel -
  • -
    -
    - -
    -
    -
  • @@ -289,8 +279,12 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel - Fetch more lines - Fetching more lines... + + + diff --git a/js/glowingbear.js b/js/glowingbear.js index e53e2ef..148957b 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -535,7 +535,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $store.bind($scope, "port", "9001"); $store.bind($scope, "proto", "weechat"); $store.bind($scope, "ssl", false); - $store.bind($scope, "lines", "40"); $store.bind($scope, "savepassword", false); if ($scope.savepassword) { $store.bind($scope, "password", ""); @@ -594,6 +593,15 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', } }; + + // Calculate number of lines to fetch + $scope.lines = function() { + var lineHeight = document.querySelector(".bufferline").clientHeight; + // I would have used document.querySelector("#bufferlines").clientHeight and added 5 to the total result, but that provides incorrect values on mobile + var areaHeight = document.body.clientHeight; + return Math.ceil(areaHeight/lineHeight); + }(); + $rootScope.loadingLines = false; $scope.fetchMoreLines = function() { connection.fetchMoreLines($scope.lines);
    + Fetch more lines + Fetching more lines... +