mirror of
https://github.com/edward-shen/MMM-pages.git
synced 2024-11-21 17:54:29 -08:00
cleanup animatePageChange
This commit is contained in:
parent
62c0e5900f
commit
cb4700fc19
1 changed files with 15 additions and 15 deletions
30
MMM-pages.js
30
MMM-pages.js
|
@ -197,12 +197,6 @@ Module.register('MMM-pages', {
|
||||||
* Optional and only used when we want to switch to a hidden page
|
* Optional and only used when we want to switch to a hidden page
|
||||||
*/
|
*/
|
||||||
animatePageChange: function (targetPageName) {
|
animatePageChange: function (targetPageName) {
|
||||||
const self = this;
|
|
||||||
const modulesToShow = (typeof targetPageName !== 'undefined') ? this.config.hiddenPages[targetPageName] : this.config.fixed.concat(this.config.modules[this.curPage]);
|
|
||||||
|
|
||||||
// Hides all modules not on the current page. This hides any module not
|
|
||||||
// meant to be shown.
|
|
||||||
|
|
||||||
let lockStringObj = { lockString: self.identifier };
|
let lockStringObj = { lockString: self.identifier };
|
||||||
if (!this.config.useLockString) {
|
if (!this.config.useLockString) {
|
||||||
// Passing in an undefined object is equivalent to not passing it in at
|
// Passing in an undefined object is equivalent to not passing it in at
|
||||||
|
@ -210,22 +204,28 @@ Module.register('MMM-pages', {
|
||||||
lockStringObj = undefined;
|
lockStringObj = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hides all modules not on the current page. This hides any module not
|
||||||
|
// meant to be shown.
|
||||||
|
|
||||||
|
const self = this;
|
||||||
|
let modulesToShow;
|
||||||
|
if (typeof targetPageName !== 'undefined') {
|
||||||
|
modulesToShow = this.config.hiddenPages[targetPageName];
|
||||||
|
} else {
|
||||||
|
modulesToShow = this.config.fixed.concat(this.config.modules[this.curPage]);
|
||||||
|
}
|
||||||
|
const animationTime = self.config.animationTime / 2;
|
||||||
|
|
||||||
MM.getModules()
|
MM.getModules()
|
||||||
.exceptWithClass(modulesToShow)
|
.exceptWithClass(modulesToShow)
|
||||||
.enumerate(module => module.hide(
|
.enumerate(module => module.hide(animationTime, lockStringObj));
|
||||||
self.config.animationTime / 2,
|
|
||||||
lockStringObj
|
|
||||||
));
|
|
||||||
|
|
||||||
// Shows all modules meant to be on the current page, after a small delay.
|
// Shows all modules meant to be on the current page, after a small delay.
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
MM.getModules()
|
MM.getModules()
|
||||||
.withClass(modulesToShow)
|
.withClass(modulesToShow)
|
||||||
.enumerate(module => module.show(
|
.enumerate(module => module.show(animationTime, lockStringObj));
|
||||||
self.config.animationTime / 2,
|
}, animationTime);
|
||||||
lockStringObj
|
|
||||||
));
|
|
||||||
}, this.config.animationTime / 2);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue