Remove setting and calculate number of lines from display properties
This commit is contained in:
parent
56055d61c8
commit
8068be8de2
18
index.html
18
index.html
|
@ -245,16 +245,6 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</li>
|
</li>
|
||||||
<li class="">
|
|
||||||
<form class="form-inline" role="form">
|
|
||||||
<div class="checkbox">
|
|
||||||
<label>
|
|
||||||
lines fetched initially
|
|
||||||
<input type="text" ng-model="lines" class="input-sm col-md-3">
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<a ng-click="disconnect()" title="Disconnect from WeeChat">
|
<a ng-click="disconnect()" title="Disconnect from WeeChat">
|
||||||
|
@ -289,8 +279,12 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel
|
||||||
<table ng-class="{'notimestamp':notimestamp}">
|
<table ng-class="{'notimestamp':notimestamp}">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="bufferline">
|
<tr class="bufferline">
|
||||||
<a class="fetchmorelines" ng-click="fetchMoreLines()" ng-hide="loadingLines">Fetch more lines</a>
|
<td class="time"><span class="date"> </span></td>
|
||||||
<span ng-show="loadingLines">Fetching more lines...</span>
|
<td class="prefix"> </td>
|
||||||
|
<td class="message">
|
||||||
|
<a class="fetchmorelines" ng-click="fetchMoreLines()" ng-hide="loadingLines">Fetch more lines</a>
|
||||||
|
<span ng-show="loadingLines">Fetching more lines...</span>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tbody ng-repeat="bufferline in (bufferlines = activeBuffer().lines)">
|
<tbody ng-repeat="bufferline in (bufferlines = activeBuffer().lines)">
|
||||||
|
|
|
@ -535,7 +535,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
$store.bind($scope, "port", "9001");
|
$store.bind($scope, "port", "9001");
|
||||||
$store.bind($scope, "proto", "weechat");
|
$store.bind($scope, "proto", "weechat");
|
||||||
$store.bind($scope, "ssl", false);
|
$store.bind($scope, "ssl", false);
|
||||||
$store.bind($scope, "lines", "40");
|
|
||||||
$store.bind($scope, "savepassword", false);
|
$store.bind($scope, "savepassword", false);
|
||||||
if ($scope.savepassword) {
|
if ($scope.savepassword) {
|
||||||
$store.bind($scope, "password", "");
|
$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;
|
$rootScope.loadingLines = false;
|
||||||
$scope.fetchMoreLines = function() {
|
$scope.fetchMoreLines = function() {
|
||||||
connection.fetchMoreLines($scope.lines);
|
connection.fetchMoreLines($scope.lines);
|
||||||
|
|
Loading…
Reference in New Issue