mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 15:45:55 +08:00
Reset the list scroll postition when changing pages (Closes #144)
This commit is contained in:
parent
90d59e108f
commit
0fcd7cf122
|
@ -582,6 +582,29 @@ Selector.prototype.scrollToFocused = function ()
|
|||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {boolean=} bFast = false
|
||||
* @return {boolean}
|
||||
*/
|
||||
Selector.prototype.scrollToTop = function (bFast)
|
||||
{
|
||||
if (!this.oContentVisible || !this.oContentScrollable)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bFast)
|
||||
{
|
||||
this.oContentScrollable.scrollTop(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.oContentScrollable.stop().animate({'scrollTop': 0}, 200);
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
Selector.prototype.eventClickFunction = function (oItem, oEvent)
|
||||
{
|
||||
var
|
||||
|
|
|
@ -218,8 +218,13 @@ function WebMailDataStorage()
|
|||
this.messageListThreadUids([]);
|
||||
}, this);
|
||||
|
||||
this.messageListEndSearch = ko.observable('');
|
||||
this.messageListEndFolder = ko.observable('');
|
||||
this.messageListEndSearch = ko.observable('');
|
||||
this.messageListEndPage = ko.observable(1);
|
||||
|
||||
this.messageListEndHash = ko.computed(function () {
|
||||
return this.messageListEndFolder() + '|' + this.messageListEndSearch() + '|' + this.messageListEndPage();
|
||||
}, this);
|
||||
|
||||
this.messageListPageCount = ko.computed(function () {
|
||||
var iPage = Math.ceil(this.messageListCount() / this.messagesPerPage());
|
||||
|
@ -1133,9 +1138,10 @@ WebMailDataStorage.prototype.setMessageList = function (oData, bCached)
|
|||
|
||||
oRainLoopData.messageListCount(iCount);
|
||||
oRainLoopData.messageListSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
|
||||
oRainLoopData.messageListEndSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
|
||||
oRainLoopData.messageListEndFolder(Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : '');
|
||||
oRainLoopData.messageListPage(Math.ceil((iOffset / oRainLoopData.messagesPerPage()) + 1));
|
||||
oRainLoopData.messageListEndFolder(Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : '');
|
||||
oRainLoopData.messageListEndSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
|
||||
oRainLoopData.messageListEndPage(oRainLoopData.messageListPage());
|
||||
|
||||
oRainLoopData.messageList(aList);
|
||||
oRainLoopData.messageListIsNotCompleted(false);
|
||||
|
|
|
@ -208,6 +208,10 @@ function MailBoxMessageListViewModel()
|
|||
return oMessage ? oMessage.generateUid() : '';
|
||||
});
|
||||
|
||||
oData.messageListEndHash.subscribe(function (mValue) {
|
||||
this.selector.scrollToTop();
|
||||
}, this);
|
||||
|
||||
oData.layout.subscribe(function (mValue) {
|
||||
this.selector.autoSelect(Enums.Layout.NoPreview !== mValue);
|
||||
}, this);
|
||||
|
|
|
@ -4578,6 +4578,29 @@ Selector.prototype.scrollToFocused = function ()
|
|||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {boolean=} bFast = false
|
||||
* @return {boolean}
|
||||
*/
|
||||
Selector.prototype.scrollToTop = function (bFast)
|
||||
{
|
||||
if (!this.oContentVisible || !this.oContentScrollable)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bFast)
|
||||
{
|
||||
this.oContentScrollable.scrollTop(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.oContentScrollable.stop().animate({'scrollTop': 0}, 200);
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
Selector.prototype.eventClickFunction = function (oItem, oEvent)
|
||||
{
|
||||
var
|
||||
|
@ -12201,6 +12224,10 @@ function MailBoxMessageListViewModel()
|
|||
return oMessage ? oMessage.generateUid() : '';
|
||||
});
|
||||
|
||||
oData.messageListEndHash.subscribe(function (mValue) {
|
||||
this.selector.scrollToTop();
|
||||
}, this);
|
||||
|
||||
oData.layout.subscribe(function (mValue) {
|
||||
this.selector.autoSelect(Enums.Layout.NoPreview !== mValue);
|
||||
}, this);
|
||||
|
@ -15294,8 +15321,13 @@ function WebMailDataStorage()
|
|||
this.messageListThreadUids([]);
|
||||
}, this);
|
||||
|
||||
this.messageListEndSearch = ko.observable('');
|
||||
this.messageListEndFolder = ko.observable('');
|
||||
this.messageListEndSearch = ko.observable('');
|
||||
this.messageListEndPage = ko.observable(1);
|
||||
|
||||
this.messageListEndHash = ko.computed(function () {
|
||||
return this.messageListEndFolder() + '|' + this.messageListEndSearch() + '|' + this.messageListEndPage();
|
||||
}, this);
|
||||
|
||||
this.messageListPageCount = ko.computed(function () {
|
||||
var iPage = Math.ceil(this.messageListCount() / this.messagesPerPage());
|
||||
|
@ -16209,9 +16241,10 @@ WebMailDataStorage.prototype.setMessageList = function (oData, bCached)
|
|||
|
||||
oRainLoopData.messageListCount(iCount);
|
||||
oRainLoopData.messageListSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
|
||||
oRainLoopData.messageListEndSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
|
||||
oRainLoopData.messageListEndFolder(Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : '');
|
||||
oRainLoopData.messageListPage(Math.ceil((iOffset / oRainLoopData.messagesPerPage()) + 1));
|
||||
oRainLoopData.messageListEndFolder(Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : '');
|
||||
oRainLoopData.messageListEndSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
|
||||
oRainLoopData.messageListEndPage(oRainLoopData.messageListPage());
|
||||
|
||||
oRainLoopData.messageList(aList);
|
||||
oRainLoopData.messageListIsNotCompleted(false);
|
||||
|
|
16
rainloop/v/0.0.0/static/js/app.min.js
vendored
16
rainloop/v/0.0.0/static/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue