jellyfin-web/src/controllers/home.js
grafixeyehero 23677db990 Deminify part 2 (#509)
This de-minifies and de-uglifies `controllers` subdirectory
2019-11-06 13:43:39 +03:00

76 lines
2.1 KiB
JavaScript

define(["tabbedView", "globalize", "require", "emby-tabs", "emby-button", "emby-scroller"], function (TabbedView, globalize, require) {
"use strict";
function getTabs() {
return [{
name: globalize.translate("Home")
}, {
name: globalize.translate("Favorites")
}];
}
function getDefaultTabIndex() {
return 0;
}
function getRequirePromise(deps) {
return new Promise(function (resolve, reject) {
require(deps, resolve);
});
}
function getTabController(index) {
if (null == index) {
throw new Error("index cannot be null");
}
var depends = [];
switch (index) {
case 0:
depends.push("controllers/hometab");
break;
case 1:
depends.push("controllers/favorites");
}
var instance = this;
return getRequirePromise(depends).then(function (controllerFactory) {
var controller = instance.tabControllers[index];
if (!controller) {
controller = new controllerFactory(instance.view.querySelector(".tabContent[data-index='" + index + "']"), instance.params);
instance.tabControllers[index] = controller;
}
return controller;
});
}
function HomeView(view, params) {
TabbedView.call(this, view, params);
}
Object.assign(HomeView.prototype, TabbedView.prototype);
HomeView.prototype.getTabs = getTabs;
HomeView.prototype.getDefaultTabIndex = getDefaultTabIndex;
HomeView.prototype.getTabController = getTabController;
HomeView.prototype.setTitle = function () {
Emby.Page.setTitle(null);
};
HomeView.prototype.onPause = function () {
TabbedView.prototype.onPause.call(this);
document.querySelector(".skinHeader").classList.remove("noHomeButtonHeader");
};
HomeView.prototype.onResume = function (options) {
TabbedView.prototype.onResume.call(this, options);
document.querySelector(".skinHeader").classList.add("noHomeButtonHeader");
};
return HomeView;
});