Fixed scroll to found message
This commit is contained in:
parent
c82eb22a2b
commit
b9af8fe025
@ -221,7 +221,7 @@ angular.module('myApp.controllers', [])
|
|||||||
$scope.$on('history_focus', function (e, peerData) {
|
$scope.$on('history_focus', function (e, peerData) {
|
||||||
$modalStack.dismissAll();
|
$modalStack.dismissAll();
|
||||||
if (peerData.peerString == $scope.curDialog.peer && peerData.messageID == $scope.curDialog.messageID) {
|
if (peerData.peerString == $scope.curDialog.peer && peerData.messageID == $scope.curDialog.messageID) {
|
||||||
$scope.$broadcast('ui_history_focus');
|
$scope.$broadcast(peerData.messageID ? 'ui_history_change_scroll' : 'ui_history_focus');
|
||||||
} else {
|
} else {
|
||||||
$location.url('/im?p=' + peerData.peerString + (peerData.messageID ? '&m=' + peerData.messageID : ''));
|
$location.url('/im?p=' + peerData.peerString + (peerData.messageID ? '&m=' + peerData.messageID : ''));
|
||||||
}
|
}
|
||||||
|
@ -1806,15 +1806,18 @@ angular.module('myApp.services', [])
|
|||||||
}
|
}
|
||||||
|
|
||||||
function regroupWrappedHistory (history, limit) {
|
function regroupWrappedHistory (history, limit) {
|
||||||
|
if (!history || !history.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var start = 0,
|
var start = 0,
|
||||||
len = history.length,
|
len = history.length,
|
||||||
end = len,
|
end = len,
|
||||||
i, curDay, prevDay, curMessage, prevMessage;
|
i, curDay, prevDay, curMessage, prevMessage;
|
||||||
|
|
||||||
if (limit > 0) {
|
if (limit > 0) {
|
||||||
end = limit;
|
end = Math.min(limit, len);
|
||||||
} else if (limit < 0) {
|
} else if (limit < 0) {
|
||||||
start = end + limit;
|
start = Math.max(0, end + limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = start; i < end; i++) {
|
for (i = start; i < end; i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user