diff --git a/src/components/backdrop/backdrop.js b/src/components/backdrop/backdrop.js index 2187daac85..c648e8491d 100644 --- a/src/components/backdrop/backdrop.js +++ b/src/components/backdrop/backdrop.js @@ -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') { - url = getImageUrls([url], imageOptions)[0]; - } + 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 }; - }); \ No newline at end of file diff --git a/src/controllers/mypreferencesdisplay.js b/src/controllers/user/display.js similarity index 100% rename from src/controllers/mypreferencesdisplay.js rename to src/controllers/user/display.js diff --git a/src/controllers/mypreferenceshome.js b/src/controllers/user/home.js similarity index 100% rename from src/controllers/mypreferenceshome.js rename to src/controllers/user/home.js diff --git a/src/controllers/mypreferencescommon.js b/src/controllers/user/menu.js similarity index 93% rename from src/controllers/mypreferencescommon.js rename to src/controllers/user/menu.js index 5423c52948..6bac0011d2 100644 --- a/src/controllers/mypreferencescommon.js +++ b/src/controllers/user/menu.js @@ -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")) { diff --git a/src/controllers/mypreferenceslanguages.js b/src/controllers/user/playback.js similarity index 100% rename from src/controllers/mypreferenceslanguages.js rename to src/controllers/user/playback.js diff --git a/src/controllers/myprofile.js b/src/controllers/user/profile.js similarity index 100% rename from src/controllers/myprofile.js rename to src/controllers/user/profile.js diff --git a/src/controllers/mypreferencessubtitles.js b/src/controllers/user/subtitles.js similarity index 100% rename from src/controllers/mypreferencessubtitles.js rename to src/controllers/user/subtitles.js diff --git a/src/mypreferencesmenu.html b/src/mypreferencesmenu.html index 41a7dac1b0..0be133ef7b 100644 --- a/src/mypreferencesmenu.html +++ b/src/mypreferencesmenu.html @@ -30,7 +30,7 @@ - +
play_circle_filled
diff --git a/src/mypreferenceslanguages.html b/src/mypreferencesplayback.html similarity index 100% rename from src/mypreferenceslanguages.html rename to src/mypreferencesplayback.html diff --git a/src/scripts/routes.js b/src/scripts/routes.js index 5e030da4c6..680a99a80b 100644 --- a/src/scripts/routes.js +++ b/src/scripts/routes.js @@ -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",