mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
move all user preference controllers to folder
This commit is contained in:
parent
0c1c855eb8
commit
27944af119
@ -2,7 +2,6 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'css!./style']
|
||||
'use strict';
|
||||
|
||||
function enableAnimation(elem) {
|
||||
|
||||
if (browser.slow) {
|
||||
return false;
|
||||
}
|
||||
@ -11,7 +10,6 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'css!./style']
|
||||
}
|
||||
|
||||
function enableRotation() {
|
||||
|
||||
if (browser.tv) {
|
||||
return false;
|
||||
}
|
||||
@ -25,17 +23,13 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'css!./style']
|
||||
}
|
||||
|
||||
function Backdrop() {
|
||||
|
||||
}
|
||||
|
||||
Backdrop.prototype.load = function (url, parent, existingBackdropImage) {
|
||||
|
||||
var img = new Image();
|
||||
|
||||
var self = this;
|
||||
|
||||
img.onload = function () {
|
||||
|
||||
if (self.isDestroyed) {
|
||||
return;
|
||||
}
|
||||
@ -75,6 +69,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'css!./style']
|
||||
|
||||
internalBackdrop(true);
|
||||
};
|
||||
|
||||
img.src = url;
|
||||
};
|
||||
|
||||
@ -87,14 +82,12 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'css!./style']
|
||||
};
|
||||
|
||||
Backdrop.prototype.destroy = function () {
|
||||
|
||||
this.isDestroyed = true;
|
||||
this.cancelAnimation();
|
||||
};
|
||||
|
||||
var backdropContainer;
|
||||
function getBackdropContainer() {
|
||||
|
||||
if (!backdropContainer) {
|
||||
backdropContainer = document.querySelector('.backdropContainer');
|
||||
}
|
||||
@ -109,7 +102,6 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'css!./style']
|
||||
}
|
||||
|
||||
function clearBackdrop(clearAll) {
|
||||
|
||||
clearRotation();
|
||||
|
||||
if (currentLoadingBackdrop) {
|
||||
@ -123,6 +115,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'css!./style']
|
||||
if (clearAll) {
|
||||
hasExternalBackdrop = false;
|
||||
}
|
||||
|
||||
internalBackdrop(false);
|
||||
}
|
||||
|
||||
@ -133,8 +126,8 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'css!./style']
|
||||
}
|
||||
return backgroundContainer;
|
||||
}
|
||||
function setBackgroundContainerBackgroundEnabled() {
|
||||
|
||||
function setBackgroundContainerBackgroundEnabled() {
|
||||
if (hasInternalBackdrop || hasExternalBackdrop) {
|
||||
getBackgroundContainer().classList.add('withBackdrop');
|
||||
} else {
|
||||
@ -160,7 +153,6 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'css!./style']
|
||||
|
||||
var currentLoadingBackdrop;
|
||||
function setBackdropImage(url) {
|
||||
|
||||
if (currentLoadingBackdrop) {
|
||||
currentLoadingBackdrop.destroy();
|
||||
currentLoadingBackdrop = null;
|
||||
@ -183,29 +175,23 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'css!./style']
|
||||
|
||||
var standardWidths = [480, 720, 1280, 1440, 1920];
|
||||
function getBackdropMaxWidth() {
|
||||
|
||||
var width = dom.getWindowSize().innerWidth;
|
||||
var roundScreenTo = 100;
|
||||
|
||||
if (standardWidths.indexOf(width) !== -1) {
|
||||
return width;
|
||||
}
|
||||
|
||||
var roundScreenTo = 100;
|
||||
width = Math.floor(width / roundScreenTo) * roundScreenTo;
|
||||
|
||||
return Math.min(width, 1920);
|
||||
}
|
||||
|
||||
function getItemImageUrls(item, imageOptions) {
|
||||
|
||||
imageOptions = imageOptions || {};
|
||||
|
||||
var apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
|
||||
if (item.BackdropImageTags && item.BackdropImageTags.length > 0) {
|
||||
|
||||
return item.BackdropImageTags.map(function (imgTag, index) {
|
||||
|
||||
return apiClient.getScaledImageUrl(item.BackdropItemId || item.Id, Object.assign(imageOptions, {
|
||||
type: "Backdrop",
|
||||
tag: imgTag,
|
||||
@ -216,9 +202,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'css!./style']
|
||||
}
|
||||
|
||||
if (item.ParentBackdropItemId && item.ParentBackdropImageTags && item.ParentBackdropImageTags.length) {
|
||||
|
||||
return item.ParentBackdropImageTags.map(function (imgTag, index) {
|
||||
|
||||
return apiClient.getScaledImageUrl(item.ParentBackdropItemId, Object.assign(imageOptions, {
|
||||
type: "Backdrop",
|
||||
tag: imgTag,
|
||||
@ -232,17 +216,13 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'css!./style']
|
||||
}
|
||||
|
||||
function getImageUrls(items, imageOptions) {
|
||||
|
||||
var list = [];
|
||||
|
||||
var onImg = function (img) {
|
||||
list.push(img);
|
||||
};
|
||||
|
||||
for (var i = 0, length = items.length; i < length; i++) {
|
||||
|
||||
var itemImages = getItemImageUrls(items[i], imageOptions);
|
||||
|
||||
itemImages.forEach(onImg);
|
||||
}
|
||||
|
||||
@ -262,12 +242,12 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'css!./style']
|
||||
|
||||
// If you don't care about the order of the elements inside
|
||||
// the array, you should sort both arrays here.
|
||||
|
||||
for (var i = 0; i < a.length; ++i) {
|
||||
if (a[i] !== b[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -275,20 +255,16 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'css!./style']
|
||||
var currentRotatingImages = [];
|
||||
var currentRotationIndex = -1;
|
||||
function setBackdrops(items, imageOptions, enableImageRotation) {
|
||||
|
||||
var images = getImageUrls(items, imageOptions);
|
||||
|
||||
if (images.length) {
|
||||
|
||||
startRotation(images, enableImageRotation);
|
||||
|
||||
} else {
|
||||
clearBackdrop();
|
||||
}
|
||||
}
|
||||
|
||||
function startRotation(images, enableImageRotation) {
|
||||
|
||||
if (arraysEqual(images, currentRotatingImages)) {
|
||||
return;
|
||||
}
|
||||
@ -301,11 +277,11 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'css!./style']
|
||||
if (images.length > 1 && enableImageRotation !== false && enableRotation()) {
|
||||
rotationInterval = setInterval(onRotationInterval, 24000);
|
||||
}
|
||||
|
||||
onRotationInterval();
|
||||
}
|
||||
|
||||
function onRotationInterval() {
|
||||
|
||||
if (playbackManager.isPlayingLocally(['Video'])) {
|
||||
return;
|
||||
}
|
||||
@ -324,35 +300,29 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'css!./style']
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
|
||||
rotationInterval = null;
|
||||
currentRotatingImages = [];
|
||||
currentRotationIndex = -1;
|
||||
}
|
||||
|
||||
function setBackdrop(url, imageOptions) {
|
||||
|
||||
if (url) {
|
||||
if (typeof url !== 'string') {
|
||||
if (url && typeof url !== 'string') {
|
||||
url = getImageUrls([url], imageOptions)[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (url) {
|
||||
clearRotation();
|
||||
|
||||
setBackdropImage(url);
|
||||
|
||||
} else {
|
||||
clearBackdrop();
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
setBackdrops: setBackdrops,
|
||||
setBackdrop: setBackdrop,
|
||||
clear: clearBackdrop,
|
||||
externalBackdrop: externalBackdrop
|
||||
};
|
||||
|
||||
});
|
@ -14,7 +14,7 @@ define(["apphost", "connectionManager", "listViewStyle", "emby-button"], functio
|
||||
page.querySelector(".lnkMyProfile").setAttribute("href", "myprofile.html?userId=" + userId);
|
||||
page.querySelector(".lnkDisplayPreferences").setAttribute("href", "mypreferencesdisplay.html?userId=" + userId);
|
||||
page.querySelector(".lnkHomePreferences").setAttribute("href", "mypreferenceshome.html?userId=" + userId);
|
||||
page.querySelector(".lnkLanguagePreferences").setAttribute("href", "mypreferenceslanguages.html?userId=" + userId);
|
||||
page.querySelector(".lnkPlaybackPreferences").setAttribute("href", "mypreferencesplayback.html?userId=" + userId);
|
||||
page.querySelector(".lnkSubtitlePreferences").setAttribute("href", "mypreferencessubtitles.html?userId=" + userId);
|
||||
|
||||
if (appHost.supports("multiserver")) {
|
@ -30,7 +30,7 @@
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a is="emby-linkbutton" data-ripple="false" href="#" class="lnkLanguagePreferences listItem-border">
|
||||
<a is="emby-linkbutton" data-ripple="false" href="#" class="lnkPlaybackPreferences listItem-border">
|
||||
<div class="listItem">
|
||||
<i class="md-icon listItemIcon listItemIcon-transparent">play_circle_filled</i>
|
||||
<div class="listItemBody">
|
||||
|
@ -229,41 +229,41 @@ define([
|
||||
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"
|
||||
controller: "user/menu"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/myprofile.html",
|
||||
autoFocus: false,
|
||||
transition: "fade",
|
||||
controller: "myprofile"
|
||||
controller: "user/profile"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/mypreferencesdisplay.html",
|
||||
autoFocus: false,
|
||||
transition: "fade",
|
||||
controller: "user/display"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/mypreferenceshome.html",
|
||||
autoFocus: false,
|
||||
transition: "fade",
|
||||
controller: "user/home"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/mypreferencesplayback.html",
|
||||
autoFocus: false,
|
||||
transition: "fade",
|
||||
controller: "user/playback"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/mypreferencessubtitles.html",
|
||||
autoFocus: false,
|
||||
transition: "fade",
|
||||
controller: "user/subtitles"
|
||||
});
|
||||
defineRoute({
|
||||
path: "/notificationsetting.html",
|
||||
|
Loading…
Reference in New Issue
Block a user