mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Reset the list scroll postition when changing pages (Closes #144)
This commit is contained in:
parent
90d59e108f
commit
0fcd7cf122
5 changed files with 80 additions and 14 deletions
|
|
@ -582,6 +582,29 @@ Selector.prototype.scrollToFocused = function ()
|
||||||
return false;
|
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)
|
Selector.prototype.eventClickFunction = function (oItem, oEvent)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
|
|
|
||||||
|
|
@ -218,8 +218,13 @@ function WebMailDataStorage()
|
||||||
this.messageListThreadUids([]);
|
this.messageListThreadUids([]);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.messageListEndSearch = ko.observable('');
|
|
||||||
this.messageListEndFolder = 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 () {
|
this.messageListPageCount = ko.computed(function () {
|
||||||
var iPage = Math.ceil(this.messageListCount() / this.messagesPerPage());
|
var iPage = Math.ceil(this.messageListCount() / this.messagesPerPage());
|
||||||
|
|
@ -1133,9 +1138,10 @@ WebMailDataStorage.prototype.setMessageList = function (oData, bCached)
|
||||||
|
|
||||||
oRainLoopData.messageListCount(iCount);
|
oRainLoopData.messageListCount(iCount);
|
||||||
oRainLoopData.messageListSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
|
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.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.messageList(aList);
|
||||||
oRainLoopData.messageListIsNotCompleted(false);
|
oRainLoopData.messageListIsNotCompleted(false);
|
||||||
|
|
|
||||||
|
|
@ -208,6 +208,10 @@ function MailBoxMessageListViewModel()
|
||||||
return oMessage ? oMessage.generateUid() : '';
|
return oMessage ? oMessage.generateUid() : '';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
oData.messageListEndHash.subscribe(function (mValue) {
|
||||||
|
this.selector.scrollToTop();
|
||||||
|
}, this);
|
||||||
|
|
||||||
oData.layout.subscribe(function (mValue) {
|
oData.layout.subscribe(function (mValue) {
|
||||||
this.selector.autoSelect(Enums.Layout.NoPreview !== mValue);
|
this.selector.autoSelect(Enums.Layout.NoPreview !== mValue);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
|
||||||
|
|
@ -4578,6 +4578,29 @@ Selector.prototype.scrollToFocused = function ()
|
||||||
return false;
|
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)
|
Selector.prototype.eventClickFunction = function (oItem, oEvent)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
|
|
@ -12201,6 +12224,10 @@ function MailBoxMessageListViewModel()
|
||||||
return oMessage ? oMessage.generateUid() : '';
|
return oMessage ? oMessage.generateUid() : '';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
oData.messageListEndHash.subscribe(function (mValue) {
|
||||||
|
this.selector.scrollToTop();
|
||||||
|
}, this);
|
||||||
|
|
||||||
oData.layout.subscribe(function (mValue) {
|
oData.layout.subscribe(function (mValue) {
|
||||||
this.selector.autoSelect(Enums.Layout.NoPreview !== mValue);
|
this.selector.autoSelect(Enums.Layout.NoPreview !== mValue);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
@ -15294,8 +15321,13 @@ function WebMailDataStorage()
|
||||||
this.messageListThreadUids([]);
|
this.messageListThreadUids([]);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.messageListEndSearch = ko.observable('');
|
|
||||||
this.messageListEndFolder = 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 () {
|
this.messageListPageCount = ko.computed(function () {
|
||||||
var iPage = Math.ceil(this.messageListCount() / this.messagesPerPage());
|
var iPage = Math.ceil(this.messageListCount() / this.messagesPerPage());
|
||||||
|
|
@ -16209,9 +16241,10 @@ WebMailDataStorage.prototype.setMessageList = function (oData, bCached)
|
||||||
|
|
||||||
oRainLoopData.messageListCount(iCount);
|
oRainLoopData.messageListCount(iCount);
|
||||||
oRainLoopData.messageListSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
|
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.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.messageList(aList);
|
||||||
oRainLoopData.messageListIsNotCompleted(false);
|
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…
Add table
Add a link
Reference in a new issue