in xf/src/xf.pages.js [142:214]
show: function(page, animationType) {
if (page === this.activePageName) {
return;
}
if (page === '') {
var pages = Dom.root.find(' .' + this.pageClass);
if (pages.size()) {
this.show(pages.first());
}
return;
}
var jqPage = (page instanceof Dom) ? page : Dom('.' + XF.pages.pageClass + '#' + page);
if (!_.isUndefined(jqPage.attr('data-device-type'))) {
if (jqPage.attr('data-device-type') !== XF.device.type.name) {
return;
}
}
// preventing animation when the page is already shown
if ((this.activePage && jqPage.attr('id') == this.activePage.attr('id')) || !jqPage.size()) {
return;
}
XF.log('pages: showing page "' + jqPage.attr('id') + '"');
var viewport = XF.device.getViewport();
var screenHeight = XF.device.getScreenHeight();
if (this.animations.next) {
animationType = (this.animations.types[this.animations.next] ? this.animations.next : this.animations.standardAnimation);
this.animations.next = null;
} else {
animationType = (this.animations.types[animationType] ? animationType : this.animations.standardAnimation);
}
var fromPage = this.activePage;
var toPage = jqPage;
this.activePage = toPage;
this.activePageName = jqPage.attr('id');
if (!XF.device.supports.cssAnimations) {
if (_.isFunction(this.animations.types[animationType]['fallback'])) {
_.bind(this.animations.types[animationType].fallback, this)(fromPage, toPage);
}
} else {
if (fromPage) {
viewport.addClass('xf-viewport-transitioning');
fromPage.height(viewport.height()).addClass('out ' + animationType);
toPage.height(viewport.height()).addClass('in ' + animationType + ' ' + this.activePageClass);
fromPage.animationEnd(function() {
fromPage.height('').removeClass(animationType + ' out in');
fromPage.removeClass(XF.pages.activePageClass);
});
toPage.animationEnd(function() {
toPage.height('').removeClass(animationType + ' out in');
viewport.removeClass('xf-viewport-transitioning');
});
} else {
// just making it active
this.activePage.addClass(this.activePageClass);
}
}
XF.trigger('ui:enhance', this.activePage);
// looking for components inside the page
XF.loadChildComponents(this.activePage);
}