mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #188 from vitorsemeano/webpack_part3
Conversion to webpack - part3 - routes isolation, module resolution, refactoring appStorage
This commit is contained in:
commit
9aa027dcfb
77 changed files with 598 additions and 1053 deletions
|
@ -1,6 +1,11 @@
|
|||
define(["apiclientcore", "localassetmanager"], function(ApiClient, localassetmanager) {
|
||||
//TODO: (vitorsemeano) modify this lines for webpack
|
||||
define(["bower_components/apiclient/apiclientcore", "localassetmanager"], function(ApiClient, localassetmanager) {
|
||||
"use strict";
|
||||
|
||||
if ("cordova" !== window.appMode && "android" !== window.appMode) {
|
||||
return ApiClient;
|
||||
}
|
||||
|
||||
function isLocalId(str) {
|
||||
return startsWith(str, localPrefix)
|
||||
}
|
53
src/bower_components/apiclient/appStorage.js
vendored
Normal file
53
src/bower_components/apiclient/appStorage.js
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
define([], function() {
|
||||
"use strict";
|
||||
|
||||
function onCachePutFail(e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
function updateCache(instance) {
|
||||
if (instance.cache) {
|
||||
instance.cache.put("data", new Response(JSON.stringify(instance.localData))).catch(onCachePutFail);
|
||||
}
|
||||
}
|
||||
|
||||
function onCacheOpened(result) {
|
||||
this.cache = result;
|
||||
this.localData = {};
|
||||
}
|
||||
|
||||
function MyStore() {
|
||||
|
||||
this.setItem = function(name, value) {
|
||||
localStorage.setItem(name, value);
|
||||
|
||||
if (this.localData && this.localData[name] !== value) {
|
||||
this.localData[name] = value;
|
||||
updateCache(this);
|
||||
}
|
||||
};
|
||||
|
||||
this.getItem = function(name) {
|
||||
return localStorage.getItem(name);
|
||||
};
|
||||
|
||||
this.removeItem = function(name) {
|
||||
localStorage.removeItem(name);
|
||||
|
||||
if (this.localData) {
|
||||
delete this.localData[name];
|
||||
updateCache(this);
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
if (self.caches) {
|
||||
self.caches.open("embydata").then(onCacheOpened.bind(this));
|
||||
}
|
||||
} catch (err) {
|
||||
console.log("Error opening cache: " + err);
|
||||
}
|
||||
}
|
||||
|
||||
return new MyStore;
|
||||
});
|
3
src/bower_components/apiclient/package.json
vendored
Normal file
3
src/bower_components/apiclient/package.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"main": "apiclient.js"
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
define([], function() {
|
||||
"use strict";
|
||||
|
||||
function MyStore() {}
|
||||
|
||||
function updateCache(instance) {
|
||||
instance.cache.put("data", new Response(JSON.stringify(instance.localData)))
|
||||
}
|
||||
return MyStore.prototype.init = function() {
|
||||
var instance = this;
|
||||
return caches.open("embydata").then(function(result) {
|
||||
instance.cache = result, instance.localData = {}
|
||||
})
|
||||
}, MyStore.prototype.setItem = function(name, value) {
|
||||
if (this.localData) {
|
||||
this.localData[name] !== value && (this.localData[name] = value, updateCache(this))
|
||||
}
|
||||
}, MyStore.prototype.getItem = function(name) {
|
||||
if (this.localData) return this.localData[name]
|
||||
}, MyStore.prototype.removeItem = function(name) {
|
||||
this.localData && (this.localData[name] = null, delete this.localData[name], updateCache(this))
|
||||
}, new MyStore
|
||||
});
|
|
@ -1,37 +0,0 @@
|
|||
define([], function() {
|
||||
"use strict";
|
||||
|
||||
function onCachePutFail(e) {
|
||||
console.log(e)
|
||||
}
|
||||
|
||||
function updateCache(instance) {
|
||||
var cache = instance.cache;
|
||||
cache && cache.put("data", new Response(JSON.stringify(instance.localData))).catch(onCachePutFail)
|
||||
}
|
||||
|
||||
function onCacheOpened(result) {
|
||||
this.cache = result, this.localData = {}
|
||||
}
|
||||
|
||||
function MyStore() {
|
||||
try {
|
||||
self.caches && caches.open("embydata").then(onCacheOpened.bind(this))
|
||||
} catch (err) {
|
||||
console.log("Error opening cache: " + err)
|
||||
}
|
||||
}
|
||||
return MyStore.prototype.setItem = function(name, value) {
|
||||
localStorage.setItem(name, value);
|
||||
var localData = this.localData;
|
||||
if (localData) {
|
||||
localData[name] !== value && (localData[name] = value, updateCache(this))
|
||||
}
|
||||
}, MyStore.prototype.getItem = function(name) {
|
||||
return localStorage.getItem(name)
|
||||
}, MyStore.prototype.removeItem = function(name) {
|
||||
localStorage.removeItem(name);
|
||||
var localData = this.localData;
|
||||
localData && (localData[name] = null, delete localData[name], updateCache(this))
|
||||
}, new MyStore
|
||||
});
|
|
@ -1,14 +0,0 @@
|
|||
define([], function() {
|
||||
"use strict";
|
||||
|
||||
function MyStore() {
|
||||
this.localData = {}
|
||||
}
|
||||
return MyStore.prototype.setItem = function(name, value) {
|
||||
this.localData[name] = value
|
||||
}, MyStore.prototype.getItem = function(name) {
|
||||
return this.localData[name]
|
||||
}, MyStore.prototype.removeItem = function(name) {
|
||||
this.localData[name] = null
|
||||
}, new MyStore
|
||||
});
|
|
@ -14,31 +14,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
|||
},
|
||||
showSettings: function () {
|
||||
show('/settings/settings.html');
|
||||
},
|
||||
showSearch: function () {
|
||||
skinManager.getCurrentSkin().search();
|
||||
},
|
||||
showGenre: function (options) {
|
||||
skinManager.getCurrentSkin().showGenre(options);
|
||||
},
|
||||
showGuide: function () {
|
||||
skinManager.getCurrentSkin().showGuide({
|
||||
serverId: connectionManager.currentApiClient().serverId()
|
||||
});
|
||||
},
|
||||
showLiveTV: function () {
|
||||
skinManager.getCurrentSkin().showLiveTV({
|
||||
serverId: connectionManager.currentApiClient().serverId()
|
||||
});
|
||||
},
|
||||
showRecordedTV: function () {
|
||||
skinManager.getCurrentSkin().showRecordedTV();
|
||||
},
|
||||
showFavorites: function () {
|
||||
skinManager.getCurrentSkin().showFavorites();
|
||||
},
|
||||
showNowPlaying: function () {
|
||||
skinManager.getCurrentSkin().showNowPlaying();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -125,13 +100,11 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
|||
sendRouteToViewManager(ctx, next, route, controllerFactory);
|
||||
};
|
||||
|
||||
require(route.dependencies || [], function () {
|
||||
if (route.controller) {
|
||||
require([route.controller], onInitComplete);
|
||||
} else {
|
||||
onInitComplete();
|
||||
}
|
||||
});
|
||||
if (route.controller) {
|
||||
require([`controllers/${route.controller}`], onInitComplete);
|
||||
} else {
|
||||
onInitComplete();
|
||||
}
|
||||
}
|
||||
|
||||
function cancelCurrentLoadRequest() {
|
||||
|
@ -363,8 +336,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
|||
|
||||
firstConnectionResult = result;
|
||||
|
||||
loading.hide();
|
||||
|
||||
options = options || {};
|
||||
|
||||
page({
|
||||
|
@ -372,6 +343,8 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
|||
hashbang: options.hashbang !== false,
|
||||
enableHistory: enableHistory()
|
||||
});
|
||||
}).finally(function () {
|
||||
loading.hide();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -438,11 +411,7 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
|||
|
||||
console.log('appRouter - user is authenticated');
|
||||
|
||||
if (ctx.isBack && (route.isDefaultRoute || route.startup) && !isCurrentRouteStartup) {
|
||||
handleBackToDefault();
|
||||
return;
|
||||
}
|
||||
else if (route.isDefaultRoute) {
|
||||
if (route.isDefaultRoute) {
|
||||
console.log('appRouter - loading skin home page');
|
||||
loadUserSkinWithOptions(ctx);
|
||||
return;
|
||||
|
@ -501,30 +470,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
|||
var isHandlingBackToDefault;
|
||||
var isDummyBackToHome;
|
||||
|
||||
function handleBackToDefault() {
|
||||
|
||||
if (!appHost.supports('exitmenu') && appHost.supports('exit')) {
|
||||
appHost.exit();
|
||||
return;
|
||||
}
|
||||
|
||||
isDummyBackToHome = true;
|
||||
skinManager.loadUserSkin();
|
||||
|
||||
if (isHandlingBackToDefault) {
|
||||
return;
|
||||
}
|
||||
|
||||
// This must result in a call to either
|
||||
// skinManager.loadUserSkin();
|
||||
// Logout
|
||||
// Or exit app
|
||||
skinManager.getCurrentSkin().showBackMenu().then(function () {
|
||||
|
||||
isHandlingBackToDefault = false;
|
||||
});
|
||||
}
|
||||
|
||||
function loadContent(ctx, route, html, request) {
|
||||
|
||||
html = globalize.translateDocument(html, route.dictionary);
|
||||
|
@ -670,30 +615,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
|||
return currentRouteInfo ? currentRouteInfo.route : null;
|
||||
}
|
||||
|
||||
function goHome() {
|
||||
|
||||
var skin = skinManager.getCurrentSkin();
|
||||
|
||||
if (skin.getHomeRoute) {
|
||||
var homePath = skin.getHomeRoute();
|
||||
return show(pluginManager.mapRoute(skin, homePath));
|
||||
} else {
|
||||
var homeRoute = skin.getRoutes().filter(function (r) {
|
||||
return r.type === 'home';
|
||||
})[0];
|
||||
|
||||
return show(pluginManager.mapRoute(skin, homeRoute));
|
||||
}
|
||||
}
|
||||
|
||||
function getRouteUrl(item, options) {
|
||||
if (item === 'settings') {
|
||||
return 'settings/settings.html';
|
||||
}
|
||||
|
||||
return skinManager.getCurrentSkin().getRouteUrl(item, options);
|
||||
}
|
||||
|
||||
function showItem(item, serverId, options) {
|
||||
|
||||
if (typeof (item) === 'string') {
|
||||
|
@ -714,20 +635,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
|||
}
|
||||
}
|
||||
|
||||
function setTitle(title) {
|
||||
skinManager.getCurrentSkin().setTitle(title);
|
||||
}
|
||||
|
||||
function showVideoOsd() {
|
||||
var skin = skinManager.getCurrentSkin();
|
||||
|
||||
var homeRoute = skin.getRoutes().filter(function (r) {
|
||||
return r.type === 'video-osd';
|
||||
})[0];
|
||||
|
||||
return show(pluginManager.mapRoute(skin, homeRoute));
|
||||
}
|
||||
|
||||
var allRoutes = [];
|
||||
|
||||
function addRoute(path, newRoute) {
|
||||
|
@ -834,15 +741,11 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
|||
appRouter.canGoBack = canGoBack;
|
||||
appRouter.current = current;
|
||||
appRouter.beginConnectionWizard = beginConnectionWizard;
|
||||
appRouter.goHome = goHome;
|
||||
appRouter.showItem = showItem;
|
||||
appRouter.setTitle = setTitle;
|
||||
appRouter.setTransparency = setTransparency;
|
||||
appRouter.getRoutes = getRoutes;
|
||||
appRouter.getRouteUrl = getRouteUrl;
|
||||
appRouter.pushState = pushState;
|
||||
appRouter.enableNativeHistory = enableNativeHistory;
|
||||
appRouter.showVideoOsd = showVideoOsd;
|
||||
appRouter.handleAnchorClick = page.handleAnchorClick;
|
||||
appRouter.TransparencyLevel = {
|
||||
None: 0,
|
3
src/components/backdrop/package.json
Normal file
3
src/components/backdrop/package.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"main": "backdrop.js"
|
||||
}
|
3
src/components/dialog/package.json
Normal file
3
src/components/dialog/package.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"main": "dialog.js"
|
||||
}
|
3
src/components/dialoghelper/package.json
Normal file
3
src/components/dialoghelper/package.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"main": "dialogHelper.js"
|
||||
}
|
3
src/components/emby-input/package.json
Normal file
3
src/components/emby-input/package.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"main": "emby-input.js"
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
if (!Array.prototype.filter) {
|
||||
Array.prototype.filter = function (fun /*, thisp*/) {
|
||||
"use strict";
|
||||
|
||||
if (this == null)
|
||||
throw new TypeError();
|
||||
|
||||
var t = Object(this);
|
||||
var len = t.length >>> 0;
|
||||
if (typeof fun != "function")
|
||||
throw new TypeError();
|
||||
|
||||
var res = [];
|
||||
var thisp = arguments[1];
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (i in t) {
|
||||
var val = t[i]; // in case fun mutates this
|
||||
if (fun.call(thisp, val, i, t))
|
||||
res.push(val);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
if (!Function.prototype.bind) {
|
||||
Function.prototype.bind = function (oThis) {
|
||||
if (typeof this !== 'function') {
|
||||
// closest thing possible to the ECMAScript 5
|
||||
// internal IsCallable function
|
||||
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
|
||||
}
|
||||
|
||||
var aArgs = Array.prototype.slice.call(arguments, 1),
|
||||
fToBind = this,
|
||||
fNOP = function () { },
|
||||
fBound = function () {
|
||||
return fToBind.apply(this instanceof fNOP
|
||||
? this
|
||||
: oThis,
|
||||
aArgs.concat(Array.prototype.slice.call(arguments)));
|
||||
};
|
||||
|
||||
if (this.prototype) {
|
||||
// Function.prototype doesn't have a prototype property
|
||||
fNOP.prototype = this.prototype;
|
||||
}
|
||||
fBound.prototype = new fNOP();
|
||||
|
||||
return fBound;
|
||||
};
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
if (typeof Object.assign != 'function') {
|
||||
(function () {
|
||||
Object.assign = function (target) {
|
||||
'use strict';
|
||||
if (target === undefined || target === null) {
|
||||
throw new TypeError('Cannot convert undefined or null to object');
|
||||
}
|
||||
|
||||
var output = Object(target);
|
||||
for (var index = 1; index < arguments.length; index++) {
|
||||
var source = arguments[index];
|
||||
if (source !== undefined && source !== null) {
|
||||
for (var nextKey in source) {
|
||||
if (source.hasOwnProperty(nextKey)) {
|
||||
output[nextKey] = source[nextKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return output;
|
||||
};
|
||||
})();
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
|
||||
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
|
||||
|
||||
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
|
||||
|
||||
// MIT license
|
||||
|
||||
(function () {
|
||||
var lastTime = 0;
|
||||
var vendors = ['ms', 'moz', 'webkit', 'o'];
|
||||
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
|
||||
window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
|
||||
window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame']
|
||||
|| window[vendors[x] + 'CancelRequestAnimationFrame'];
|
||||
}
|
||||
|
||||
if (!window.requestAnimationFrame)
|
||||
window.requestAnimationFrame = function (callback, element) {
|
||||
var currTime = new Date().getTime();
|
||||
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
|
||||
var id = window.setTimeout(function () { callback(currTime + timeToCall); },
|
||||
timeToCall);
|
||||
lastTime = currTime + timeToCall;
|
||||
return id;
|
||||
};
|
||||
|
||||
if (!window.cancelAnimationFrame)
|
||||
window.cancelAnimationFrame = function (id) {
|
||||
clearTimeout(id);
|
||||
};
|
||||
}());
|
|
@ -1,148 +1,9 @@
|
|||
define(['apphost', 'userSettings', 'browser', 'events', 'pluginManager', 'backdrop', 'globalize', 'require', 'appSettings'], function (appHost, userSettings, browser, events, pluginManager, backdrop, globalize, require, appSettings) {
|
||||
'use strict';
|
||||
|
||||
var currentSkin;
|
||||
|
||||
function getCurrentSkin() {
|
||||
return currentSkin;
|
||||
}
|
||||
|
||||
function getRequirePromise(deps) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
require(deps, resolve);
|
||||
});
|
||||
}
|
||||
|
||||
function loadSkin(id) {
|
||||
var newSkin = pluginManager.plugins().filter(function (p) {
|
||||
return p.id === id;
|
||||
})[0];
|
||||
|
||||
if (!newSkin) {
|
||||
newSkin = pluginManager.plugins().filter(function (p) {
|
||||
return p.id === 'defaultskin';
|
||||
})[0];
|
||||
}
|
||||
|
||||
var unloadPromise;
|
||||
|
||||
if (currentSkin) {
|
||||
if (currentSkin.id === newSkin.id) {
|
||||
// Nothing to do, it's already the active skin
|
||||
return Promise.resolve(currentSkin);
|
||||
}
|
||||
unloadPromise = unloadSkin(currentSkin);
|
||||
} else {
|
||||
unloadPromise = Promise.resolve();
|
||||
}
|
||||
|
||||
return unloadPromise.then(function () {
|
||||
var deps = newSkin.getDependencies();
|
||||
|
||||
console.log('Loading skin dependencies');
|
||||
|
||||
return getRequirePromise(deps).then(function () {
|
||||
|
||||
console.log('Skin dependencies loaded');
|
||||
|
||||
var strings = newSkin.getTranslations ? newSkin.getTranslations() : [];
|
||||
|
||||
return globalize.loadStrings({
|
||||
|
||||
name: newSkin.id,
|
||||
strings: strings
|
||||
|
||||
}).then(function () {
|
||||
|
||||
globalize.defaultModule(newSkin.id);
|
||||
return loadSkinHeader(newSkin);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function unloadSkin(skin) {
|
||||
|
||||
unloadTheme();
|
||||
backdrop.clear();
|
||||
|
||||
console.log('Unloading skin: ' + skin.name);
|
||||
|
||||
// TODO: unload css
|
||||
return skin.unload().then(function () {
|
||||
document.dispatchEvent(new CustomEvent("skinunload", {
|
||||
detail: {
|
||||
name: skin.name
|
||||
}
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
function loadSkinHeader(skin) {
|
||||
return getSkinHeader(skin).then(function (headerHtml) {
|
||||
document.querySelector('.skinHeader').innerHTML = headerHtml;
|
||||
|
||||
currentSkin = skin;
|
||||
skin.load();
|
||||
|
||||
return skin;
|
||||
});
|
||||
}
|
||||
|
||||
var cacheParam = new Date().getTime();
|
||||
|
||||
function getSkinHeader(skin) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
if (!skin.getHeaderTemplate) {
|
||||
resolve('');
|
||||
return;
|
||||
}
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
var url = skin.getHeaderTemplate();
|
||||
url += url.indexOf('?') === -1 ? '?' : '&';
|
||||
url += 'v=' + cacheParam;
|
||||
|
||||
xhr.open('GET', url, true);
|
||||
|
||||
xhr.onload = function (e) {
|
||||
if (this.status < 400) {
|
||||
resolve(this.response);
|
||||
} else {
|
||||
resolve('');
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
});
|
||||
}
|
||||
|
||||
function loadUserSkin(options) {
|
||||
|
||||
var skin = userSettings.get('skin', false) || 'defaultskin';
|
||||
|
||||
loadSkin(skin).then(function (skin) {
|
||||
|
||||
options = options || {};
|
||||
if (options.start) {
|
||||
Emby.Page.invokeShortcut(options.start);
|
||||
} else {
|
||||
Emby.Page.goHome();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
events.on(userSettings, 'change', function (e, name) {
|
||||
if (name === 'skin' || name === 'language') {
|
||||
loadUserSkin();
|
||||
}
|
||||
});
|
||||
|
||||
var themeStyleElement;
|
||||
var currentThemeId;
|
||||
|
||||
function unloadTheme() {
|
||||
var elem = themeStyleElement;
|
||||
if (elem) {
|
||||
|
@ -153,20 +14,61 @@ define(['apphost', 'userSettings', 'browser', 'events', 'pluginManager', 'backdr
|
|||
}
|
||||
}
|
||||
|
||||
function getThemes() {
|
||||
function loadUserSkin(options) {
|
||||
options = options || {};
|
||||
|
||||
if (currentSkin.getThemes) {
|
||||
return currentSkin.getThemes();
|
||||
if (options.start) {
|
||||
Emby.Page.invokeShortcut(options.start);
|
||||
} else {
|
||||
Emby.Page.goHome();
|
||||
}
|
||||
};
|
||||
|
||||
return [];
|
||||
}
|
||||
function getThemes() {
|
||||
return [{
|
||||
name: "Apple TV",
|
||||
id: "appletv"
|
||||
}, {
|
||||
name: "Blue Radiance",
|
||||
id: "blueradiance"
|
||||
}, {
|
||||
name: "Dark",
|
||||
id: "dark",
|
||||
isDefault: true,
|
||||
isDefaultServerDashboard: true
|
||||
}, {
|
||||
name: "Dark (green accent)",
|
||||
id: "dark-green"
|
||||
}, {
|
||||
name: "Dark (red accent)",
|
||||
id: "dark-red"
|
||||
}, {
|
||||
name: "Light",
|
||||
id: "light"
|
||||
}, {
|
||||
name: "Light (blue accent)",
|
||||
id: "light-blue"
|
||||
}, {
|
||||
name: "Light (green accent)",
|
||||
id: "light-green"
|
||||
}, {
|
||||
name: "Light (pink accent)",
|
||||
id: "light-pink"
|
||||
}, {
|
||||
name: "Light (purple accent)",
|
||||
id: "light-purple"
|
||||
}, {
|
||||
name: "Light (red accent)",
|
||||
id: "light-red"
|
||||
}, {
|
||||
name: "Windows Media Center",
|
||||
id: "wmc"
|
||||
}];
|
||||
};
|
||||
|
||||
var skinManager = {
|
||||
getCurrentSkin: getCurrentSkin,
|
||||
loadSkin: loadSkin,
|
||||
loadUserSkin: loadUserSkin,
|
||||
getThemes: getThemes
|
||||
getThemes: getThemes,
|
||||
loadUserSkin: loadUserSkin
|
||||
};
|
||||
|
||||
function getThemeStylesheetInfo(id, requiresRegistration, isDefaultProperty) {
|
|
@ -24,10 +24,10 @@ define(["tabbedView", "globalize", "require", "emby-tabs", "emby-button", "emby-
|
|||
var depends = [];
|
||||
switch (index) {
|
||||
case 0:
|
||||
depends.push("./hometab");
|
||||
depends.push("controllers/hometab");
|
||||
break;
|
||||
case 1:
|
||||
depends.push("./favorites")
|
||||
depends.push("controllers/favorites")
|
||||
}
|
||||
var instance = this;
|
||||
return getRequirePromise(depends).then(function(controllerFactory) {
|
|
@ -87,9 +87,23 @@ define(["appSettings", "dom", "connectionManager", "loading", "cardStyle", "emby
|
|||
}), view.addEventListener("viewshow", function(e) {
|
||||
loading.show();
|
||||
var apiClient = getApiClient();
|
||||
apiClient.getPublicUsers().then(function(users) {
|
||||
users.length ? users.length && users[0].EnableAutoLogin ? authenticateUserByName(view, apiClient, users[0].Name, "") : (showVisualForm(), loadUserList(view, apiClient, users)) : (view.querySelector("#txtManualName").value = "", showManualForm(view, !1, !1)), loading.hide()
|
||||
apiClient.getPublicUsers().then(function(users) {debugger;
|
||||
if (users.length) {
|
||||
if (users[0].EnableAutoLogin) {
|
||||
authenticateUserByName(view, apiClient, users[0].Name, "");
|
||||
} else {
|
||||
showVisualForm();
|
||||
loadUserList(view, apiClient, users);
|
||||
}
|
||||
} else {
|
||||
view.querySelector("#txtManualName").value = "";
|
||||
showManualForm(view, false, false);
|
||||
}
|
||||
|
||||
}).finally(function () {
|
||||
loading.hide();
|
||||
});
|
||||
|
||||
apiClient.getJSON(apiClient.getUrl("Branding/Configuration")).then(function(options) {
|
||||
view.querySelector(".disclaimer").textContent = options.LoginDisclaimer || ""
|
||||
});
|
|
@ -1,4 +1,4 @@
|
|||
define(["scripts/userpasswordpage", "loading", "libraryMenu", "apphost", "emby-linkbutton"], function (Userpasswordpage, loading, libraryMenu, appHost) {
|
||||
define(["controllers/userpasswordpage", "loading", "libraryMenu", "apphost", "emby-linkbutton"], function (Userpasswordpage, loading, libraryMenu, appHost) {
|
||||
"use strict";
|
||||
|
||||
function reloadUser(page) {
|
434
src/scripts/routes.js
Normal file
434
src/scripts/routes.js
Normal file
|
@ -0,0 +1,434 @@
|
|||
define([
|
||||
"emby-button",
|
||||
"emby-input",
|
||||
"scripts/livetvcomponents",
|
||||
"paper-icon-button-light",
|
||||
"emby-itemscontainer",
|
||||
"emby-collapse",
|
||||
"emby-select",
|
||||
"livetvcss",
|
||||
"emby-checkbox",
|
||||
"emby-slider",
|
||||
"listViewStyle",
|
||||
"dashboardcss"], function () {
|
||||
|
||||
function defineRoute(newRoute) {
|
||||
var path = newRoute.path;
|
||||
console.log("Defining route: " + path);
|
||||
newRoute.dictionary = "core";
|
||||
Emby.Page.addRoute(path, newRoute);
|
||||
}
|
||||
|
||||
console.log("Defining core routes");
|
||||
|
||||
defineRoute({
|
||||
path: "/addplugin.html",
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "addpluginpage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/autoorganizelog.html",
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/channelsettings.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/addserver.html",
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: "addserver"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/dashboard.html",
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "dashboardpage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/dashboardgeneral.html",
|
||||
controller: "dashboardgeneral",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/dashboardhosting.html",
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "dashboardhosting"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/devices/devices.html",
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "devices"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/devices/device.html",
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "device"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/dlnaprofile.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/dlnaprofiles.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/dlnasettings.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/edititemmetadata.html",
|
||||
controller: "edititemmetadata",
|
||||
autoFocus: false
|
||||
});
|
||||
defineRoute({
|
||||
path: "/encodingsettings.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/forgotpassword.html",
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: "forgotpassword"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/forgotpasswordpin.html",
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: "forgotpasswordpin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/home.html",
|
||||
autoFocus: false,
|
||||
controller: "home",
|
||||
transition: "fade",
|
||||
type: "home"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/list/list.html",
|
||||
autoFocus: false,
|
||||
controller: "list",
|
||||
transition: "fade"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/index.html",
|
||||
autoFocus: false,
|
||||
isDefaultRoute: true
|
||||
});
|
||||
defineRoute({
|
||||
path: "/itemdetails.html",
|
||||
controller: "itemdetailpage",
|
||||
autoFocus: false,
|
||||
transition: "fade"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/library.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/librarydisplay.html",
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "librarydisplay"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/librarysettings.html",
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "librarysettings"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/livetv.html",
|
||||
controller: "livetvsuggested",
|
||||
autoFocus: false,
|
||||
transition: "fade"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/livetvguideprovider.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/livetvseriestimer.html",
|
||||
autoFocus: false,
|
||||
controller: "livetvseriestimer"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/livetvsettings.html",
|
||||
autoFocus: false
|
||||
});
|
||||
defineRoute({
|
||||
path: "/livetvstatus.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/livetvtuner.html",
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "livetvtuner"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/log.html",
|
||||
roles: "admin",
|
||||
controller: "logpage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/login.html",
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: "loginpage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/metadataadvanced.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/metadataimages.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/metadatanfo.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/movies.html",
|
||||
autoFocus: false,
|
||||
controller: "moviesrecommended",
|
||||
transition: "fade"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/music.html",
|
||||
controller: "musicrecommended",
|
||||
autoFocus: false,
|
||||
transition: "fade"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/mypreferencesdisplay.html",
|
||||
autoFocus: false,
|
||||
transition: "fade",
|
||||
controller: "mypreferencesdisplay"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/mypreferenceshome.html",
|
||||
autoFocus: false,
|
||||
transition: "fade",
|
||||
controller: "mypreferenceshome"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/mypreferencessubtitles.html",
|
||||
autoFocus: false,
|
||||
transition: "fade",
|
||||
controller: "mypreferencessubtitles"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/mypreferenceslanguages.html",
|
||||
autoFocus: false,
|
||||
transition: "fade",
|
||||
controller: "mypreferenceslanguages"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/mypreferencesmenu.html",
|
||||
autoFocus: false,
|
||||
transition: "fade",
|
||||
controller: "mypreferencescommon"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/myprofile.html",
|
||||
autoFocus: false,
|
||||
transition: "fade",
|
||||
controller: "myprofile"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/notificationsetting.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/notificationsettings.html",
|
||||
controller: "notificationsettings",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/nowplaying.html",
|
||||
controller: "nowplayingpage",
|
||||
autoFocus: false,
|
||||
transition: "fade",
|
||||
fullscreen: true,
|
||||
supportsThemeMedia: true,
|
||||
enableMediaControl: false
|
||||
});
|
||||
defineRoute({
|
||||
path: "/playbackconfiguration.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/plugincatalog.html",
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "plugincatalogpage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/plugins.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/scheduledtask.html",
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "scheduledtaskpage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/scheduledtasks.html",
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "scheduledtaskspage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/search.html",
|
||||
controller: "searchpage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/selectserver.html",
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: "selectserver"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/serveractivity.html",
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "serveractivity"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/serversecurity.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/streamingsettings.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/support.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/tv.html",
|
||||
autoFocus: false,
|
||||
controller: "tvrecommended",
|
||||
transition: "fade"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/useredit.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/userlibraryaccess.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/usernew.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/userparentalcontrol.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/userpassword.html",
|
||||
autoFocus: false,
|
||||
controller: "userpasswordpage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/userprofiles.html",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/wizardremoteaccess.html",
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
controller: "wizardremoteaccess"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/wizardfinish.html",
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
controller: "wizardfinishpage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/wizardlibrary.html",
|
||||
autoFocus: false,
|
||||
anonymous: true
|
||||
});
|
||||
defineRoute({
|
||||
path: "/wizardsettings.html",
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
controller: "wizardsettings"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/wizardstart.html",
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
controller: "wizardstart"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/wizarduser.html",
|
||||
controller: "wizarduserpage",
|
||||
autoFocus: false,
|
||||
anonymous: true
|
||||
});
|
||||
defineRoute({
|
||||
path: "/videoosd.html",
|
||||
transition: "fade",
|
||||
controller: "videoosd",
|
||||
autoFocus: false,
|
||||
type: "video-osd",
|
||||
supportsThemeMedia: true,
|
||||
fullscreen: true,
|
||||
enableMediaControl: false
|
||||
});
|
||||
defineRoute({
|
||||
path: "/configurationpage",
|
||||
autoFocus: false,
|
||||
enableCache: false,
|
||||
enableContentQueryString: true,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/",
|
||||
isDefaultRoute: true,
|
||||
autoFocus: false,
|
||||
});
|
||||
});
|
|
@ -357,16 +357,6 @@ var AppInfo = {};
|
|||
return layoutManager;
|
||||
}
|
||||
|
||||
function getAppStorage(basePath) {
|
||||
try {
|
||||
localStorage.setItem("_test", "0");
|
||||
localStorage.removeItem("_test");
|
||||
return basePath + "/appstorage-localstorage";
|
||||
} catch (e) {
|
||||
return basePath + "/appstorage-memory";
|
||||
}
|
||||
}
|
||||
|
||||
function createWindowHeadroom(Headroom) {
|
||||
var headroom = new Headroom([], {});
|
||||
headroom.init();
|
||||
|
@ -426,7 +416,7 @@ var AppInfo = {};
|
|||
|
||||
function initRequireWithBrowser(browser) {
|
||||
var bowerPath = getBowerPath();
|
||||
var apiClientBowerPath = bowerPath + "/emby-apiclient";
|
||||
var apiClientBowerPath = bowerPath + "/apiclient";
|
||||
var componentsPath = "components";
|
||||
|
||||
define("filesystem", [componentsPath + "/filesystem"], returnFirstDependency);
|
||||
|
@ -439,12 +429,7 @@ var AppInfo = {};
|
|||
|
||||
define("shell", [componentsPath + "/shell"], returnFirstDependency);
|
||||
|
||||
if ("cordova" === self.appMode || "android" === self.appMode) {
|
||||
define("apiclientcore", ["bower_components/emby-apiclient/apiclient"], returnFirstDependency);
|
||||
define("apiclient", ["bower_components/emby-apiclient/apiclientex"], returnFirstDependency);
|
||||
} else {
|
||||
define("apiclient", ["bower_components/emby-apiclient/apiclient"], returnFirstDependency);
|
||||
}
|
||||
define("apiclient", ["bower_components/apiclient/apiclient"], returnFirstDependency);
|
||||
|
||||
if ("registerElement" in document) {
|
||||
define("registerElement", []);
|
||||
|
@ -506,22 +491,6 @@ var AppInfo = {};
|
|||
promises.push(require(["fetch"]));
|
||||
}
|
||||
|
||||
if ("function" != typeof Object.assign) {
|
||||
promises.push(require(["objectassign"]));
|
||||
}
|
||||
|
||||
if (!Array.prototype.filter) {
|
||||
promises.push(require(["arraypolyfills"]));
|
||||
}
|
||||
|
||||
if (!Function.prototype.bind) {
|
||||
promises.push(require(["functionbind"]));
|
||||
}
|
||||
|
||||
if (!window.requestAnimationFrame) {
|
||||
promises.push(require(["raf"]));
|
||||
}
|
||||
|
||||
Promise.all(promises).then(function () {
|
||||
createConnectionManager().then(function () {
|
||||
console.log("initAfterDependencies promises resolved");
|
||||
|
@ -575,514 +544,6 @@ var AppInfo = {};
|
|||
});
|
||||
}
|
||||
|
||||
function defineRoute(newRoute, dictionary) {
|
||||
var baseRoute = Emby.Page.baseUrl();
|
||||
var path = newRoute.path;
|
||||
path = path.replace(baseRoute, "");
|
||||
console.log("Defining route: " + path);
|
||||
newRoute.dictionary = newRoute.dictionary || dictionary || "core";
|
||||
Emby.Page.addRoute(path, newRoute);
|
||||
}
|
||||
|
||||
function defineCoreRoutes(appHost) {
|
||||
console.log("Defining core routes");
|
||||
defineRoute({
|
||||
path: "/addplugin.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "scripts/addpluginpage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/autoorganizelog.html",
|
||||
dependencies: [],
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/channelsettings.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/addserver.html",
|
||||
dependencies: ["emby-button", "emby-input"],
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: "scripts/addserver"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/dashboard.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "scripts/dashboardpage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/dashboardgeneral.html",
|
||||
controller: "dashboard/dashboardgeneral",
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/dashboardhosting.html",
|
||||
dependencies: ["emby-input", "emby-button"],
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "dashboard/dashboardhosting"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/devices/devices.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "devices/devices"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/devices/device.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "devices/device"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/dlnaprofile.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/dlnaprofiles.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/dlnaserversettings.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/dlnasettings.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/edititemmetadata.html",
|
||||
dependencies: [],
|
||||
controller: "scripts/edititemmetadata",
|
||||
autoFocus: false
|
||||
});
|
||||
defineRoute({
|
||||
path: "/encodingsettings.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/forgotpassword.html",
|
||||
dependencies: ["emby-input", "emby-button"],
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: "scripts/forgotpassword"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/forgotpasswordpin.html",
|
||||
dependencies: ["emby-input", "emby-button"],
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: "scripts/forgotpasswordpin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/home.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
controller: "home/home",
|
||||
transition: "fade",
|
||||
type: "home"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/list/list.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
controller: "list/list",
|
||||
transition: "fade"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/index.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
isDefaultRoute: true
|
||||
});
|
||||
defineRoute({
|
||||
path: "/itemdetails.html",
|
||||
dependencies: ["emby-button", "scripts/livetvcomponents", "paper-icon-button-light", "emby-itemscontainer"],
|
||||
controller: "scripts/itemdetailpage",
|
||||
autoFocus: false,
|
||||
transition: "fade"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/library.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/librarydisplay.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "dashboard/librarydisplay"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/librarysettings.html",
|
||||
dependencies: ["emby-collapse", "emby-input", "emby-button", "emby-select"],
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "dashboard/librarysettings"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/livetv.html",
|
||||
dependencies: ["emby-button", "livetvcss"],
|
||||
controller: "scripts/livetvsuggested",
|
||||
autoFocus: false,
|
||||
transition: "fade"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/livetvguideprovider.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/livetvseriestimer.html",
|
||||
dependencies: ["emby-checkbox", "emby-input", "emby-button", "emby-collapse", "scripts/livetvcomponents", "scripts/livetvseriestimer", "livetvcss"],
|
||||
autoFocus: false,
|
||||
controller: "scripts/livetvseriestimer"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/livetvsettings.html",
|
||||
dependencies: [],
|
||||
autoFocus: false
|
||||
});
|
||||
defineRoute({
|
||||
path: "/livetvstatus.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/livetvtuner.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "dashboard/livetvtuner"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/log.html",
|
||||
dependencies: ["emby-checkbox"],
|
||||
roles: "admin",
|
||||
controller: "dashboard/logpage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/login.html",
|
||||
dependencies: ["emby-button", "emby-input"],
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: "scripts/loginpage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/metadataadvanced.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/metadataimages.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/metadatanfo.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/movies.html",
|
||||
dependencies: ["emby-button"],
|
||||
autoFocus: false,
|
||||
controller: "scripts/moviesrecommended",
|
||||
transition: "fade"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/music.html",
|
||||
dependencies: [],
|
||||
controller: "scripts/musicrecommended",
|
||||
autoFocus: false,
|
||||
transition: "fade"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/mypreferencesdisplay.html",
|
||||
dependencies: ["emby-checkbox", "emby-button", "emby-select"],
|
||||
autoFocus: false,
|
||||
transition: "fade",
|
||||
controller: "scripts/mypreferencesdisplay"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/mypreferenceshome.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
transition: "fade",
|
||||
controller: "scripts/mypreferenceshome"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/mypreferencessubtitles.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
transition: "fade",
|
||||
controller: "scripts/mypreferencessubtitles"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/mypreferenceslanguages.html",
|
||||
dependencies: ["emby-button", "emby-checkbox", "emby-select"],
|
||||
autoFocus: false,
|
||||
transition: "fade",
|
||||
controller: "scripts/mypreferenceslanguages"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/mypreferencesmenu.html",
|
||||
dependencies: ["emby-button"],
|
||||
autoFocus: false,
|
||||
transition: "fade",
|
||||
controller: "scripts/mypreferencescommon"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/myprofile.html",
|
||||
dependencies: ["emby-button", "emby-collapse", "emby-checkbox", "emby-input"],
|
||||
autoFocus: false,
|
||||
transition: "fade",
|
||||
controller: "scripts/myprofile"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/notificationsetting.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/notificationsettings.html",
|
||||
controller: "scripts/notificationsettings",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/nowplaying.html",
|
||||
dependencies: ["paper-icon-button-light", "emby-slider", "emby-button", "emby-input", "emby-itemscontainer"],
|
||||
controller: "scripts/nowplayingpage",
|
||||
autoFocus: false,
|
||||
transition: "fade",
|
||||
fullscreen: true,
|
||||
supportsThemeMedia: true,
|
||||
enableMediaControl: false
|
||||
});
|
||||
defineRoute({
|
||||
path: "/playbackconfiguration.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/plugincatalog.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "scripts/plugincatalogpage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/plugins.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/scheduledtask.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "scripts/scheduledtaskpage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/scheduledtasks.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "scripts/scheduledtaskspage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/search.html",
|
||||
dependencies: [],
|
||||
controller: "scripts/searchpage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/selectserver.html",
|
||||
dependencies: ["listViewStyle", "emby-button"],
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: "scripts/selectserver"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/serveractivity.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin",
|
||||
controller: "dashboard/serveractivity"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/serversecurity.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/streamingsettings.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/support.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/tv.html",
|
||||
dependencies: ["paper-icon-button-light", "emby-button"],
|
||||
autoFocus: false,
|
||||
controller: "scripts/tvrecommended",
|
||||
transition: "fade"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/useredit.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/userlibraryaccess.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/usernew.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/userparentalcontrol.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/userpassword.html",
|
||||
dependencies: ["emby-input", "emby-button", "emby-checkbox"],
|
||||
autoFocus: false,
|
||||
controller: "scripts/userpasswordpage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/userprofiles.html",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/wizardremoteaccess.html",
|
||||
dependencies: ["dashboardcss"],
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
controller: "dashboard/wizardremoteaccess"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/wizardfinish.html",
|
||||
dependencies: ["emby-button", "dashboardcss"],
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
controller: "dashboard/wizardfinishpage"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/wizardlibrary.html",
|
||||
dependencies: ["dashboardcss"],
|
||||
autoFocus: false,
|
||||
anonymous: true
|
||||
});
|
||||
defineRoute({
|
||||
path: "/wizardsettings.html",
|
||||
dependencies: ["dashboardcss"],
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
controller: "dashboard/wizardsettings"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/wizardstart.html",
|
||||
dependencies: ["dashboardcss"],
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
controller: "dashboard/wizardstart"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/wizarduser.html",
|
||||
dependencies: ["dashboardcss", "emby-input"],
|
||||
controller: "scripts/wizarduserpage",
|
||||
autoFocus: false,
|
||||
anonymous: true
|
||||
});
|
||||
defineRoute({
|
||||
path: "/videoosd.html",
|
||||
dependencies: [],
|
||||
transition: "fade",
|
||||
controller: "scripts/videoosd",
|
||||
autoFocus: false,
|
||||
type: "video-osd",
|
||||
supportsThemeMedia: true,
|
||||
fullscreen: true,
|
||||
enableMediaControl: false
|
||||
});
|
||||
defineRoute({
|
||||
path: "/configurationpage",
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
enableCache: false,
|
||||
enableContentQueryString: true,
|
||||
roles: "admin"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/",
|
||||
isDefaultRoute: true,
|
||||
autoFocus: false,
|
||||
dependencies: []
|
||||
});
|
||||
}
|
||||
|
||||
function getPluginPageContentPath() {
|
||||
if (window.ApiClient) {
|
||||
return ApiClient.getUrl("web/ConfigurationPage");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function loadPlugins(externalPlugins, appHost, browser, shell) {
|
||||
console.log("Loading installed plugins");
|
||||
var list = [
|
||||
|
@ -1127,7 +588,7 @@ var AppInfo = {};
|
|||
console.log("Begin onAppReady");
|
||||
|
||||
// ensure that appHost is loaded in this point
|
||||
require(['apphost'], function (appHost) {
|
||||
require(['apphost', 'appRouter'], function (appHost, appRouter) {
|
||||
var isInBackground = -1 !== self.location.href.toString().toLowerCase().indexOf("start=backgroundsync");
|
||||
|
||||
window.Emby = {};
|
||||
|
@ -1142,11 +603,9 @@ var AppInfo = {};
|
|||
require(['css!devices/ios/ios.css']);
|
||||
}
|
||||
|
||||
require(['appRouter', 'scripts/themeloader', 'libraryMenu'], function (pageObjects) {
|
||||
window.Emby.Page = pageObjects;
|
||||
|
||||
defineCoreRoutes(appHost);
|
||||
window.Emby.Page = appRouter;
|
||||
|
||||
require(['scripts/themeloader', 'libraryMenu', 'scripts/routes'], function () {
|
||||
Emby.Page.start({
|
||||
click: false,
|
||||
hashbang: true
|
||||
|
@ -1238,7 +697,7 @@ var AppInfo = {};
|
|||
(function () {
|
||||
var urlArgs = "v=" + (window.dashboardVersion || new Date().getDate());
|
||||
var bowerPath = getBowerPath();
|
||||
var apiClientBowerPath = bowerPath + "/emby-apiclient";
|
||||
var apiClientBowerPath = bowerPath + "/apiclient";
|
||||
var componentsPath = "components";
|
||||
var paths = {
|
||||
velocity: bowerPath + "/velocity/velocity.min",
|
||||
|
@ -1258,7 +717,7 @@ var AppInfo = {};
|
|||
libraryBrowser: "scripts/librarybrowser",
|
||||
events: apiClientBowerPath + "/events",
|
||||
credentialprovider: apiClientBowerPath + "/credentials",
|
||||
connectionManagerFactory: bowerPath + "/emby-apiclient/connectionmanager",
|
||||
connectionManagerFactory: bowerPath + "/apiclient/connectionmanager",
|
||||
visibleinviewport: componentsPath + "/visibleinviewport",
|
||||
browserdeviceprofile: componentsPath + "/browserdeviceprofile",
|
||||
browser: componentsPath + "/browser",
|
||||
|
@ -1272,7 +731,7 @@ var AppInfo = {};
|
|||
itemHelper: componentsPath + "/itemhelper",
|
||||
itemShortcuts: componentsPath + "/shortcuts",
|
||||
playQueueManager: componentsPath + "/playback/playqueuemanager",
|
||||
autoPlayDetect: componentsPath + "/playback/autoplaydetect",
|
||||
autoPlayDetect: componentsPath + "/playback/autoPlayDetect",
|
||||
nowPlayingHelper: componentsPath + "/playback/nowplayinghelper",
|
||||
pluginManager: componentsPath + "/pluginmanager",
|
||||
packageManager: componentsPath + "/packagemanager"
|
||||
|
@ -1372,7 +831,7 @@ var AppInfo = {};
|
|||
});
|
||||
|
||||
paths.apphost = "components/apphost";
|
||||
paths.appStorage = getAppStorage(apiClientBowerPath);
|
||||
define('appStorage', [apiClientBowerPath + '/appStorage'], returnFirstDependency);
|
||||
|
||||
requirejs.config({
|
||||
waitSeconds: 0,
|
||||
|
@ -1391,10 +850,6 @@ var AppInfo = {};
|
|||
define("dashboardcss", ["css!css/dashboard"], returnFirstDependency);
|
||||
define("slideshow", [componentsPath + "/slideshow/slideshow"], returnFirstDependency);
|
||||
define("fetch", [bowerPath + "/fetch/fetch"], returnFirstDependency);
|
||||
define("raf", [componentsPath + "/polyfills/raf"], returnFirstDependency);
|
||||
define("functionbind", [componentsPath + "/polyfills/bind"], returnFirstDependency);
|
||||
define("arraypolyfills", [componentsPath + "/polyfills/array"], returnFirstDependency);
|
||||
define("objectassign", [componentsPath + "/polyfills/objectassign"], returnFirstDependency);
|
||||
define("clearButtonStyle", ["css!" + componentsPath + "/clearbutton"], returnFirstDependency);
|
||||
define("userdataButtons", [componentsPath + "/userdatabuttons/userdatabuttons"], returnFirstDependency);
|
||||
define("emby-playstatebutton", [componentsPath + "/userdatabuttons/emby-playstatebutton"], returnFirstDependency);
|
||||
|
@ -1446,63 +901,7 @@ var AppInfo = {};
|
|||
define("serverNotifications", [componentsPath + "/apiInput/apiInput"], returnFirstDependency);
|
||||
define("headroom-window", ["headroom"], createWindowHeadroom);
|
||||
define("appFooter-shared", ["appFooter"], createSharedAppFooter);
|
||||
define("skinManager", [componentsPath + "/skinmanager"], function (skinManager) {
|
||||
skinManager.loadUserSkin = function (options) {
|
||||
require(["appRouter"], function (appRouter) {
|
||||
options = options || {};
|
||||
|
||||
if (options.start) {
|
||||
appRouter.invokeShortcut(options.start);
|
||||
} else {
|
||||
appRouter.goHome();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
skinManager.getThemes = function () {
|
||||
return [{
|
||||
name: "Apple TV",
|
||||
id: "appletv"
|
||||
}, {
|
||||
name: "Blue Radiance",
|
||||
id: "blueradiance"
|
||||
}, {
|
||||
name: "Dark",
|
||||
id: "dark",
|
||||
isDefault: true,
|
||||
isDefaultServerDashboard: true
|
||||
}, {
|
||||
name: "Dark (green accent)",
|
||||
id: "dark-green"
|
||||
}, {
|
||||
name: "Dark (red accent)",
|
||||
id: "dark-red"
|
||||
}, {
|
||||
name: "Light",
|
||||
id: "light"
|
||||
}, {
|
||||
name: "Light (blue accent)",
|
||||
id: "light-blue"
|
||||
}, {
|
||||
name: "Light (green accent)",
|
||||
id: "light-green"
|
||||
}, {
|
||||
name: "Light (pink accent)",
|
||||
id: "light-pink"
|
||||
}, {
|
||||
name: "Light (purple accent)",
|
||||
id: "light-purple"
|
||||
}, {
|
||||
name: "Light (red accent)",
|
||||
id: "light-red"
|
||||
}, {
|
||||
name: "Windows Media Center",
|
||||
id: "wmc"
|
||||
}];
|
||||
};
|
||||
|
||||
return skinManager;
|
||||
});
|
||||
define("skinManager", [componentsPath + "/skinManager"], returnFirstDependency);
|
||||
define("connectionManager", [], function () {
|
||||
return ConnectionManager;
|
||||
});
|
||||
|
@ -1511,7 +910,7 @@ var AppInfo = {};
|
|||
return window.ApiClient;
|
||||
};
|
||||
});
|
||||
define("appRouter", [componentsPath + "/router", "itemHelper"], function (appRouter, itemHelper) {
|
||||
define("appRouter", [componentsPath + "/appRouter", "itemHelper"], function (appRouter, itemHelper) {
|
||||
function showItem(item, serverId, options) {
|
||||
if ("string" == typeof item) {
|
||||
require(["connectionManager"], function (connectionManager) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue