diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json index b1617f9b6c..94428d8160 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json +++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json @@ -15,12 +15,12 @@ }, "devDependencies": {}, "ignore": [], - "version": "1.1.11", - "_release": "1.1.11", + "version": "1.1.12", + "_release": "1.1.12", "_resolution": { "type": "version", - "tag": "1.1.11", - "commit": "6ce06fe70a6ae8cdc7c54db290fe192d4cf9656d" + "tag": "1.1.12", + "commit": "780eab96948c0418dd4e0e158569c4b8873708d6" }, "_source": "git://github.com/MediaBrowser/emby-webcomponents.git", "_target": "~1.1.5", diff --git a/dashboard-ui/bower_components/emby-webcomponents/appsettings.js b/dashboard-ui/bower_components/emby-webcomponents/appsettings.js index 24ece3ff47..40c663534a 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/appsettings.js +++ b/dashboard-ui/bower_components/emby-webcomponents/appsettings.js @@ -35,6 +35,47 @@ define(['appStorage'], function (appStorage) { return parseInt(get('preferredVideoBitrate') || '') || 1500000; }, + maxChromecastBitrate: function (val) { + + if (val != null) { + set('chromecastBitrate1', val); + } + + val = get('chromecastBitrate1'); + + return val ? parseInt(val) : null; + }, + syncOnlyOnWifi: function (val) { + + if (val != null) { + set('syncOnlyOnWifi', val.toString()); + } + + return get('syncOnlyOnWifi') != 'false'; + }, + syncPath: function (val) { + + if (val != null) { + set('syncPath', val); + } + + return get('syncPath'); + }, + + cameraUploadServers: function (val) { + + if (val != null) { + set('cameraUploadServers', val.join(',')); + } + + val = get('cameraUploadServers'); + + if (val) { + return val.split(','); + } + + return []; + }, set: set, get: get }; diff --git a/dashboard-ui/bower_components/iron-behaviors/.bower.json b/dashboard-ui/bower_components/iron-behaviors/.bower.json index 0b0736d6a6..85e8252b32 100644 --- a/dashboard-ui/bower_components/iron-behaviors/.bower.json +++ b/dashboard-ui/bower_components/iron-behaviors/.bower.json @@ -29,14 +29,14 @@ "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, "ignore": [], - "homepage": "https://github.com/polymerelements/iron-behaviors", + "homepage": "https://github.com/PolymerElements/iron-behaviors", "_release": "1.0.13", "_resolution": { "type": "version", "tag": "v1.0.13", "commit": "a7bc3428a6da2beed21987b3a8028206826a12bc" }, - "_source": "git://github.com/polymerelements/iron-behaviors.git", + "_source": "git://github.com/PolymerElements/iron-behaviors.git", "_target": "^1.0.0", - "_originalSource": "polymerelements/iron-behaviors" + "_originalSource": "PolymerElements/iron-behaviors" } \ No newline at end of file diff --git a/dashboard-ui/css/site.css b/dashboard-ui/css/site.css index 4ab0d0f5a2..c8eb8d467e 100644 --- a/dashboard-ui/css/site.css +++ b/dashboard-ui/css/site.css @@ -1620,18 +1620,6 @@ progress { max-width: 200px; } -.sessionUserInfo { - position: absolute; - right: 0; - bottom: 11px; - padding: .5em; - text-align: right; -} - - .sessionUserInfo img { - height: 24px; - } - .sessionNowPlayingInfo { position: absolute; left: 0; @@ -1672,7 +1660,7 @@ progress { color: #000; } -.activeSession:not(.playingSession) .sessionUserInfo, .activeSession:not(.playingSession) .sessionNowPlayingInfo { +.activeSession:not(.playingSession) .sessionNowPlayingInfo { bottom: 0; } @@ -1680,7 +1668,7 @@ progress { color: #fff; position: absolute; right: 10px; - bottom: 19px; + bottom: 39px; } .sessionTranscodingFramerate { @@ -1693,8 +1681,8 @@ progress { .sessionNowPlayingStreamInfo { color: #fff; position: absolute; - left: 10px; - top: 10px; + right: 10px; + bottom: 19px; } .activeSession .transcodingProgress { diff --git a/dashboard-ui/mypreferencesdisplay.html b/dashboard-ui/mypreferencesdisplay.html index 37fffe8c06..c3c470a307 100644 --- a/dashboard-ui/mypreferencesdisplay.html +++ b/dashboard-ui/mypreferencesdisplay.html @@ -10,60 +10,6 @@
-
-

- ${HeaderLanguage} -

- -
-
-
- - -
-
${LabelPreferredDisplayLanguageHelp}
- -
-
- -
-
-

${HeaderNavigation} diff --git a/dashboard-ui/scripts/appsettings.js b/dashboard-ui/scripts/appsettings.js deleted file mode 100644 index ac898bf826..0000000000 --- a/dashboard-ui/scripts/appsettings.js +++ /dev/null @@ -1,130 +0,0 @@ -(function (window) { - - function update(key, val) { - appStorage.setItem(key, val); - - Events.trigger(AppSettings, 'settingupdated', [key]); - } - - window.AppSettings = { - - enableAutomaticBitrateDetection: function (val) { - - if (val != null) { - update('enableAutomaticBitrateDetection', val.toString()); - } - - var savedVal = appStorage.getItem('enableAutomaticBitrateDetection'); - - if (!savedVal) { - if (AppInfo.isNativeApp) { - //return false; - } - } - - return appStorage.getItem('enableAutomaticBitrateDetection') != 'false'; - }, - maxStreamingBitrate: function (val) { - - if (val != null) { - update('preferredVideoBitrate', val); - } - - return parseInt(appStorage.getItem('preferredVideoBitrate') || '') || 1500000; - }, - maxChromecastBitrate: function (val) { - - if (val != null) { - update('chromecastBitrate1', val); - } - - val = appStorage.getItem('chromecastBitrate1'); - - return val ? parseInt(val) : null; - }, - enableExternalPlayers: function (val) { - - if (val != null) { - update('externalplayers', val.toString()); - } - - return appStorage.getItem('externalplayers') == 'true'; - }, - enableCinemaMode: function (val) { - - if (val != null) { - update('enableCinemaMode', val.toString()); - } - - val = appStorage.getItem('enableCinemaMode'); - - if (val) { - return val != 'false'; - } - - if (browserInfo.mobile) { - return false; - } - - return true; - }, - enableFullScreen: function (val) { - - if (val != null) { - update('enableFullScreen', val.toString()); - } - - return appStorage.getItem('enableFullScreen') == 'true'; - }, - syncOnlyOnWifi: function (val) { - - if (val != null) { - update('syncOnlyOnWifi', val.toString()); - } - - return appStorage.getItem('syncOnlyOnWifi') != 'false'; - }, - syncPath: function (val) { - - if (val != null) { - update('syncPath', val); - } - - return appStorage.getItem('syncPath'); - }, - - displayLanguage: function (val) { - - if (val != null) { - update('displayLanguage', val); - } - - return appStorage.getItem('displayLanguage') || navigator.language || navigator.userLanguage || 'en-US'; - }, - - cameraUploadServers: function (val) { - - if (val != null) { - update('cameraUploadServers', val.join(',')); - } - - val = appStorage.getItem('cameraUploadServers'); - - if (val) { - return val.split(','); - } - - return []; - }, - - displayPreferencesKey: function () { - if (AppInfo.isNativeApp) { - return 'Emby Mobile'; - } - - return 'webclient'; - } - }; - - -})(window); \ No newline at end of file diff --git a/dashboard-ui/scripts/chromecast.js b/dashboard-ui/scripts/chromecast.js index 8d33ca287c..4d24bbfadb 100644 --- a/dashboard-ui/scripts/chromecast.js +++ b/dashboard-ui/scripts/chromecast.js @@ -1,4 +1,4 @@ -define([], function () { +define(['appSettings'], function (appSettings) { // Based on https://github.com/googlecast/CastVideos-chrome/blob/master/CastVideos.js var currentResolve; @@ -350,7 +350,7 @@ receiverName: receiverName }); - var bitrateSetting = AppSettings.maxChromecastBitrate(); + var bitrateSetting = appSettings.maxChromecastBitrate(); if (bitrateSetting) { message.maxBitrate = bitrateSetting; } diff --git a/dashboard-ui/scripts/dashboardpage.js b/dashboard-ui/scripts/dashboardpage.js index 95fb4030b0..56e0cee39b 100644 --- a/dashboard-ui/scripts/dashboardpage.js +++ b/dashboard-ui/scripts/dashboardpage.js @@ -330,22 +330,16 @@ html += '

'; - html += '
'; + html += '
' + DashboardPage.getSessionNowPlayingTime(session) + '
'; - var userImage = DashboardPage.getUserImage(session); - if (userImage) { - html += '
'; - html += ''; - } else { - html += '
'; - } - html += '
'; + html += '
' + DashboardPage.getSessionNowPlayingStreamInfo(session) + '
'; - html += '
'; - html += DashboardPage.getUsersHtml(session); - html += '
'; + //if (session.TranscodingInfo && session.TranscodingInfo.Framerate) { - html += '
'; + // html += '
' + session.TranscodingInfo.Framerate + ' fps
'; + //} else { + // html += '
'; + //} var nowPlayingName = DashboardPage.getNowPlayingName(session); @@ -372,33 +366,33 @@ html += '
'; - html += '
'; - - html += '
' + DashboardPage.getSessionNowPlayingStreamInfo(session) + '
'; - html += '
' + DashboardPage.getSessionNowPlayingTime(session) + '
'; - - if (session.TranscodingInfo && session.TranscodingInfo.Framerate) { - - html += '
' + session.TranscodingInfo.Framerate + ' fps
'; - } else { - html += '
'; - } - html += '
'; - html += '
'; // cardScalable html += ''; + html += '
'; + + var userImage = DashboardPage.getUserImage(session); + if (userImage) { + html += ''; + } else { + html += '
'; + } + + html += '
'; + html += DashboardPage.getUsersHtml(session) || ' '; + html += '
'; + html += '
'; + // cardBox html += ''; // card html += ''; - } - parentElement.append(html).createSessionItemMenus().trigger('create'); + parentElement.append(html); $('.deadSession', parentElement).remove(); }, @@ -407,7 +401,7 @@ var html = ''; - html += '
'; + //html += '
'; if (session.TranscodingInfo && session.TranscodingInfo.IsAudioDirect && session.TranscodingInfo.IsVideoDirect) { html += Globalize.translate('LabelPlayMethodDirectStream'); @@ -416,47 +410,47 @@ html += Globalize.translate('LabelPlayMethodTranscoding'); } else if (session.PlayState.PlayMethod == 'DirectStream') { - html += Globalize.translate('LabelPlayMethodDirectStream'); + html += Globalize.translate('LabelPlayMethodDirectPlay'); } else if (session.PlayState.PlayMethod == 'DirectPlay') { html += Globalize.translate('LabelPlayMethodDirectPlay'); } - html += '
'; + //html += '
'; - if (session.TranscodingInfo) { + //if (session.TranscodingInfo) { - html += '
'; + // html += '
'; - var line = []; + // var line = []; - if (session.TranscodingInfo.Container) { + // if (session.TranscodingInfo.Container) { - line.push(session.TranscodingInfo.Container); - } - if (session.TranscodingInfo.Bitrate) { + // line.push(session.TranscodingInfo.Container); + // } + // if (session.TranscodingInfo.Bitrate) { - if (session.TranscodingInfo.Bitrate > 1000000) { - line.push((session.TranscodingInfo.Bitrate / 1000000).toFixed(1) + ' Mbps'); - } else { - line.push(Math.floor(session.TranscodingInfo.Bitrate / 1000) + ' kbps'); - } - } - if (line.length) { + // if (session.TranscodingInfo.Bitrate > 1000000) { + // line.push((session.TranscodingInfo.Bitrate / 1000000).toFixed(1) + ' Mbps'); + // } else { + // line.push(Math.floor(session.TranscodingInfo.Bitrate / 1000) + ' kbps'); + // } + // } + // if (line.length) { - html += '
' + line.join(' ') + '
'; - } + // html += '
' + line.join(' ') + '
'; + // } - if (session.TranscodingInfo.VideoCodec) { + // if (session.TranscodingInfo.VideoCodec) { - html += '
' + Globalize.translate('LabelVideoCodec').replace('{0}', session.TranscodingInfo.VideoCodec) + '
'; - } - if (session.TranscodingInfo.AudioCodec && session.TranscodingInfo.AudioCodec != session.TranscodingInfo.Container) { + // html += '
' + Globalize.translate('LabelVideoCodec').replace('{0}', session.TranscodingInfo.VideoCodec) + '
'; + // } + // if (session.TranscodingInfo.AudioCodec && session.TranscodingInfo.AudioCodec != session.TranscodingInfo.Container) { - html += '
' + Globalize.translate('LabelAudioCodec').replace('{0}', session.TranscodingInfo.AudioCodec) + '
'; - } + // html += '
' + Globalize.translate('LabelAudioCodec').replace('{0}', session.TranscodingInfo.AudioCodec) + '
'; + // } - } + //} return html; }, @@ -587,7 +581,7 @@ $('.sessionNowPlayingStreamInfo', row).html(DashboardPage.getSessionNowPlayingStreamInfo(session)); $('.sessionNowPlayingTime', row).html(DashboardPage.getSessionNowPlayingTime(session)); - $('.sessionUserName', row).html(DashboardPage.getUsersHtml(session)); + $('.sessionUserName', row).html(DashboardPage.getUsersHtml(session) || ' '); $('.sessionAppSecondaryText', row).html(DashboardPage.getAppSecondaryText(session)); @@ -998,77 +992,6 @@ $(document).on('pageshow', "#dashboardPage", DashboardPage.onPageShow).on('pagebeforehide', "#dashboardPage", DashboardPage.onPageHide); -(function ($, document, window) { - - var showOverlayTimeout; - - function onHoverOut() { - - if (showOverlayTimeout) { - clearTimeout(showOverlayTimeout); - showOverlayTimeout = null; - } - - var elem = this.querySelector('.cardOverlayTarget'); - - if ($(elem).is(':visible')) { - require(["jquery", "velocity"], function ($, Velocity) { - - Velocity.animate(elem, { "height": "0" }, - { - complete: function () { - $(elem).hide(); - } - }); - }); - } - } - - $.fn.createSessionItemMenus = function () { - - function onShowTimerExpired(elem) { - - if ($('.itemSelectionPanel:visible', elem).length) { - return; - } - - var innerElem = $('.cardOverlayTarget', elem); - - innerElem.show().each(function () { - - this.style.height = 0; - - }).animate({ "height": "100%" }, "fast"); - } - - function onHoverIn() { - - if (showOverlayTimeout) { - clearTimeout(showOverlayTimeout); - showOverlayTimeout = null; - } - - var elem = this; - - showOverlayTimeout = setTimeout(function () { - - onShowTimerExpired(elem); - - }, 1000); - } - - if (AppInfo.isTouchPreferred) { - /* browser with either Touch Events of Pointer Events - running on touch-capable device */ - return this; - } - - return this.off('mouseenter', '.playingSession', onHoverIn).off('mouseleave', '.playingSession', onHoverOut).on('mouseenter', '.playingSession', onHoverIn).on('mouseleave', '.playingSession', onHoverOut); - }; - -})(jQuery, document, window); - - (function ($, document, window) { function getEntryHtml(entry) { diff --git a/dashboard-ui/scripts/externalplayer.js b/dashboard-ui/scripts/externalplayer.js index e3dad85ae1..c25e1251c3 100644 --- a/dashboard-ui/scripts/externalplayer.js +++ b/dashboard-ui/scripts/externalplayer.js @@ -1,8 +1,8 @@ -define(['paper-slider', 'paper-button'], function () { +define(['appSettings', 'paper-slider', 'paper-button'], function (appSettings) { function getDeviceProfile(serverAddress, deviceId, item, startPositionTicks, maxBitrate, mediaSourceId, audioStreamIndex, subtitleStreamIndex) { - var bitrateSetting = AppSettings.maxStreamingBitrate(); + var bitrateSetting = appSettings.maxStreamingBitrate(); var profile = {}; diff --git a/dashboard-ui/scripts/globalize.js b/dashboard-ui/scripts/globalize.js index 519dae53ec..d0657e3724 100644 --- a/dashboard-ui/scripts/globalize.js +++ b/dashboard-ui/scripts/globalize.js @@ -102,16 +102,10 @@ return new Promise(function (resolve, reject) { - if (AppInfo.isNativeApp) { + if (Dashboard.isConnectMode()) { resolve(navigator.language || navigator.userLanguage); - } else if (AppInfo.supportsUserDisplayLanguageSetting) { - - console.log('AppInfo.supportsUserDisplayLanguageSetting is true'); - - resolve(AppSettings.displayLanguage()); - } else { console.log('Getting culture from document'); diff --git a/dashboard-ui/scripts/indexpage.js b/dashboard-ui/scripts/indexpage.js index 3485efffec..9dfbc431d8 100644 --- a/dashboard-ui/scripts/indexpage.js +++ b/dashboard-ui/scripts/indexpage.js @@ -132,12 +132,20 @@ var homePageDismissValue = '14'; var homePageTourKey = 'homePageTour'; + function displayPreferencesKey() { + if (AppInfo.isNativeApp) { + return 'Emby Mobile'; + } + + return 'webclient'; + } + function dismissWelcome(page, userId) { getDisplayPreferences('home', userId).then(function (result) { result.CustomPrefs[homePageTourKey] = homePageDismissValue; - ApiClient.updateDisplayPreferences('home', result, userId, AppSettings.displayPreferencesKey()); + ApiClient.updateDisplayPreferences('home', result, userId, displayPreferencesKey()); }); } @@ -316,7 +324,7 @@ function getDisplayPreferences(key, userId) { - return ApiClient.getDisplayPreferences(key, userId, AppSettings.displayPreferencesKey()); + return ApiClient.getDisplayPreferences(key, userId, displayPreferencesKey()); } window.HomePage = { diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 913b607cc7..d423f7b3c6 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -1,4 +1,4 @@ -define(['playlistManager'], function (playlistManager) { +define(['playlistManager', 'appSettings'], function (playlistManager, appSettings) { var libraryBrowser = (function (window, document, screen) { @@ -666,7 +666,7 @@ showPlayMenu: function (positionTo, itemId, itemType, isFolder, mediaType, resumePositionTicks) { - var externalPlayers = AppInfo.supportsExternalPlayers && AppSettings.enableExternalPlayers(); + var externalPlayers = AppInfo.supportsExternalPlayers && appSettings.enableExternalPlayers(); if (!resumePositionTicks && mediaType != "Audio" && !isFolder) { diff --git a/dashboard-ui/scripts/librarylist.js b/dashboard-ui/scripts/librarylist.js index 18a7d9d468..3ac3972e30 100644 --- a/dashboard-ui/scripts/librarylist.js +++ b/dashboard-ui/scripts/librarylist.js @@ -1,4 +1,4 @@ -(function ($, document, window) { +define(['appSettings'], function (appSettings) { var showOverlayTimeout; @@ -338,7 +338,7 @@ } } - if (mediaType == 'Video' && AppInfo.supportsExternalPlayers && AppSettings.enableExternalPlayers()) { + if (mediaType == 'Video' && AppInfo.supportsExternalPlayers && appSettings.enableExternalPlayers()) { items.push({ name: Globalize.translate('ButtonPlayExternalPlayer'), id: 'externalplayer', @@ -1496,4 +1496,4 @@ Events.on(ConnectionManager, 'localusersignedin', clearRefreshTimes); Events.on(ConnectionManager, 'localusersignedout', clearRefreshTimes); -})(jQuery, document, window); \ No newline at end of file +}); \ No newline at end of file diff --git a/dashboard-ui/scripts/localsync.js b/dashboard-ui/scripts/localsync.js index 58cd5f985f..85fec41eb5 100644 --- a/dashboard-ui/scripts/localsync.js +++ b/dashboard-ui/scripts/localsync.js @@ -1,4 +1,4 @@ -(function () { +define(['appSettings'], function (appSettings) { var syncPromise; @@ -22,7 +22,7 @@ LocalSync.normalizeSyncOptions(options); - options.cameraUploadServers = AppSettings.cameraUploadServers(); + options.cameraUploadServers = appSettings.cameraUploadServers(); syncPromise = new MediaBrowser.MultiServerSync(ConnectionManager).sync(options).then(function () { @@ -39,7 +39,7 @@ }, normalizeSyncOptions: function (options) { - + }, getSyncStatus: function () { @@ -50,4 +50,5 @@ return 'Idle'; } }; -})(); \ No newline at end of file + +}); \ No newline at end of file diff --git a/dashboard-ui/scripts/mediaplayer-video.js b/dashboard-ui/scripts/mediaplayer-video.js index 090210c00d..572b02777d 100644 --- a/dashboard-ui/scripts/mediaplayer-video.js +++ b/dashboard-ui/scripts/mediaplayer-video.js @@ -1,4 +1,4 @@ -(function () { +define(['appSettings'], function (appSettings) { function createVideoPlayer(self) { @@ -152,7 +152,7 @@ })[0]; var videoWidth = videoStream ? videoStream.Width : null; - var options = qualityoptions.getVideoQualityOptions(AppSettings.maxStreamingBitrate(), videoWidth); + var options = qualityoptions.getVideoQualityOptions(appSettings.maxStreamingBitrate(), videoWidth); if (isStatic) { options[0].name = "Direct"; @@ -602,8 +602,8 @@ self.onQualityOptionSelected = function (bitrate) { - AppSettings.maxStreamingBitrate(bitrate); - AppSettings.enableAutomaticBitrateDetection(false); + appSettings.maxStreamingBitrate(bitrate); + appSettings.enableAutomaticBitrateDetection(false); self.changeStream(self.getCurrentTicks(), { Bitrate: bitrate @@ -1271,4 +1271,4 @@ createVideoPlayer(MediaPlayer); -})(); \ No newline at end of file +}); \ No newline at end of file diff --git a/dashboard-ui/scripts/mediaplayer.js b/dashboard-ui/scripts/mediaplayer.js index 1f7b176ba0..12f28bf8fd 100644 --- a/dashboard-ui/scripts/mediaplayer.js +++ b/dashboard-ui/scripts/mediaplayer.js @@ -1,4 +1,4 @@ -(function (document, setTimeout, clearTimeout, screen, setInterval, window) { +define(['appSettings'], function (appSettings) { function mediaPlayer() { @@ -189,7 +189,7 @@ require(['browserdeviceprofile', 'qualityoptions'], function (profile, qualityoptions) { - var bitrateSetting = AppSettings.maxStreamingBitrate(); + var bitrateSetting = appSettings.maxStreamingBitrate(); if (!maxHeight) { maxHeight = qualityoptions.getVideoQualityOptions(bitrateSetting).filter(function (q) { @@ -514,8 +514,8 @@ } else if (smart && firstItem.Type == "Episode" && items.length == 1) { - promise = ApiClient.getCurrentUser().then(function(user) { - + promise = ApiClient.getCurrentUser().then(function (user) { + if (!user.Configuration.EnableNextEpisodeAutoPlay) { return null; } @@ -600,7 +600,7 @@ Dashboard.showLoadingMsg(); } - if (options.startPositionTicks || firstItem.MediaType !== 'Video' || !AppSettings.enableCinemaMode()) { + if (options.startPositionTicks || firstItem.MediaType !== 'Video' || !appSettings.enableCinemaMode()) { self.playInternal(firstItem, options.startPositionTicks, function () { self.setPlaylistState(0, items); @@ -825,14 +825,14 @@ var bitrateDetectionKey = ApiClient.serverAddress(); - if (item.MediaType == 'Video' && AppSettings.enableAutomaticBitrateDetection() && (new Date().getTime() - (self.lastBitrateDetections[bitrateDetectionKey] || 0)) > 300000) { + if (item.MediaType == 'Video' && appSettings.enableAutomaticBitrateDetection() && (new Date().getTime() - (self.lastBitrateDetections[bitrateDetectionKey] || 0)) > 300000) { Dashboard.showLoadingMsg(); ApiClient.detectBitrate().then(function (bitrate) { console.log('Max bitrate auto detected to ' + bitrate); self.lastBitrateDetections[bitrateDetectionKey] = new Date().getTime(); - AppSettings.maxStreamingBitrate(bitrate); + appSettings.maxStreamingBitrate(bitrate); onBitrateDetected(); @@ -1732,5 +1732,4 @@ window.MediaController.registerPlayer(window.MediaPlayer); window.MediaController.setActivePlayer(window.MediaPlayer, window.MediaPlayer.getTargetsInternal()[0]); - -})(document, setTimeout, clearTimeout, screen, setInterval, window); \ No newline at end of file +}); \ No newline at end of file diff --git a/dashboard-ui/scripts/mypreferencesdisplay.js b/dashboard-ui/scripts/mypreferencesdisplay.js index 4628b40c54..56c0f6d02d 100644 --- a/dashboard-ui/scripts/mypreferencesdisplay.js +++ b/dashboard-ui/scripts/mypreferencesdisplay.js @@ -9,8 +9,6 @@ $('#selectThemeSong', page).val(appStorage.getItem('enableThemeSongs-' + user.Id) || ''); $('#selectBackdrop', page).val(appStorage.getItem('enableBackdrops-' + user.Id) || ''); - $('#selectLanguage', page).val(AppSettings.displayLanguage()); - Dashboard.hideLoadingMsg(); } @@ -20,8 +18,6 @@ user.Configuration.DisplayUnairedEpisodes = page.querySelector('.chkDisplayUnairedEpisodes').checked; user.Configuration.GroupMoviesIntoBoxSets = page.querySelector('.chkGroupMoviesIntoCollections').checked; - AppSettings.displayLanguage(page.querySelector('#selectLanguage').value); - appStorage.setItem('enableThemeSongs-' + user.Id, $('#selectThemeSong', page).val()); appStorage.setItem('enableBackdrops-' + user.Id, $('#selectBackdrop', page).val()); @@ -98,12 +94,6 @@ $('.fldEnableBackdrops', page).show(); - if (AppInfo.supportsUserDisplayLanguageSetting) { - $('.languageSection', page).show(); - } else { - $('.languageSection', page).hide(); - } - }); pageIdOn('pagebeforehide', "displayPreferencesPage", function () { diff --git a/dashboard-ui/scripts/mypreferenceshome.js b/dashboard-ui/scripts/mypreferenceshome.js index 2a62ca146e..4f548ae8bd 100644 --- a/dashboard-ui/scripts/mypreferenceshome.js +++ b/dashboard-ui/scripts/mypreferenceshome.js @@ -154,6 +154,13 @@ }); } + function displayPreferencesKey() { + if (AppInfo.isNativeApp) { + return 'Emby Mobile'; + } + + return 'webclient'; + } function saveUser(page, user, displayPreferences) { user.Configuration.DisplayCollectionsView = page.querySelector('.chkDisplayCollectionView').checked; @@ -200,7 +207,7 @@ displayPreferences.CustomPrefs.home2 = $('#selectHomeSection3', page).val(); displayPreferences.CustomPrefs.home3 = $('#selectHomeSection4', page).val(); - return ApiClient.updateDisplayPreferences('home', displayPreferences, user.Id, AppSettings.displayPreferencesKey()).then(function () { + return ApiClient.updateDisplayPreferences('home', displayPreferences, user.Id, displayPreferencesKey()).then(function () { return ApiClient.updateUserConfiguration(user.Id, user.Configuration); }); @@ -218,7 +225,7 @@ ApiClient.getUser(userId).then(function (user) { - ApiClient.getDisplayPreferences('home', user.Id, AppSettings.displayPreferencesKey()).then(function (displayPreferences) { + ApiClient.getDisplayPreferences('home', user.Id, displayPreferencesKey()).then(function (displayPreferences) { saveUser(page, user, displayPreferences).then(function () { @@ -308,7 +315,7 @@ ApiClient.getUser(userId).then(function (user) { - ApiClient.getDisplayPreferences('home', user.Id, AppSettings.displayPreferencesKey()).then(function (result) { + ApiClient.getDisplayPreferences('home', user.Id, displayPreferencesKey()).then(function (result) { loadForm(page, user, result); @@ -319,7 +326,7 @@ pageIdOn('pagebeforehide', "homeScreenPreferencesPage", function () { var page = this; - + if (AppInfo.enableAutoSave) { save(page); } diff --git a/dashboard-ui/scripts/mypreferenceslanguages.js b/dashboard-ui/scripts/mypreferenceslanguages.js index 83111efa24..2d58c8cd96 100644 --- a/dashboard-ui/scripts/mypreferenceslanguages.js +++ b/dashboard-ui/scripts/mypreferenceslanguages.js @@ -1,4 +1,4 @@ -(function ($, window, document) { +define(['appSettings'], function (appSettings) { function populateLanguages(select, languages) { @@ -31,12 +31,12 @@ $('#selectSubtitlePlaybackMode', page).val(user.Configuration.SubtitleMode || "").trigger('change'); page.querySelector('.chkPlayDefaultAudioTrack').checked = user.Configuration.PlayDefaultAudioTrack || false; - page.querySelector('.chkEnableCinemaMode').checked = AppSettings.enableCinemaMode(); - page.querySelector('.chkExternalVideoPlayer').checked = AppSettings.enableExternalPlayers(); + page.querySelector('.chkEnableCinemaMode').checked = appSettings.enableCinemaMode(); + page.querySelector('.chkExternalVideoPlayer').checked = appSettings.enableExternalPlayers(); require(['qualityoptions'], function (qualityoptions) { - var bitrateOptions = qualityoptions.getVideoQualityOptions(AppSettings.maxStreamingBitrate()).map(function (i) { + var bitrateOptions = qualityoptions.getVideoQualityOptions(appSettings.maxStreamingBitrate()).map(function (i) { return ''; @@ -47,13 +47,13 @@ $('#selectMaxBitrate', page).html(bitrateOptions); $('#selectMaxChromecastBitrate', page).html(bitrateOptions); - if (AppSettings.enableAutomaticBitrateDetection()) { + if (appSettings.enableAutomaticBitrateDetection()) { $('#selectMaxBitrate', page).val(''); } else { - $('#selectMaxBitrate', page).val(AppSettings.maxStreamingBitrate()); + $('#selectMaxBitrate', page).val(appSettings.maxStreamingBitrate()); } - $('#selectMaxChromecastBitrate', page).val(AppSettings.maxChromecastBitrate()); + $('#selectMaxChromecastBitrate', page).val(appSettings.maxChromecastBitrate()); Dashboard.hideLoadingMsg(); }); @@ -95,23 +95,23 @@ user.Configuration.SubtitleMode = $('#selectSubtitlePlaybackMode', page).val(); user.Configuration.PlayDefaultAudioTrack = page.querySelector('.chkPlayDefaultAudioTrack').checked; user.Configuration.EnableNextEpisodeAutoPlay = page.querySelector('.chkEpisodeAutoPlay').checked; - - AppSettings.enableCinemaMode(page.querySelector('.chkEnableCinemaMode').checked); + appSettings.enableCinemaMode(page.querySelector('.chkEnableCinemaMode').checked); return ApiClient.updateUserConfiguration(user.Id, user.Configuration); } function save(page) { - AppSettings.enableExternalPlayers(page.querySelector('.chkExternalVideoPlayer').checked); + + appSettings.enableExternalPlayers(page.querySelector('.chkExternalVideoPlayer').checked); if ($('#selectMaxBitrate', page).val()) { - AppSettings.maxStreamingBitrate($('#selectMaxBitrate', page).val()); - AppSettings.enableAutomaticBitrateDetection(false); + appSettings.maxStreamingBitrate($('#selectMaxBitrate', page).val()); + appSettings.enableAutomaticBitrateDetection(false); } else { - AppSettings.enableAutomaticBitrateDetection(true); + appSettings.enableAutomaticBitrateDetection(true); } - AppSettings.maxChromecastBitrate($('#selectMaxChromecastBitrate', page).val()); + appSettings.maxChromecastBitrate($('#selectMaxChromecastBitrate', page).val()); var userId = getParameterByName('userId') || Dashboard.getCurrentUserId(); @@ -196,4 +196,4 @@ } }); -})(jQuery, window, document); \ No newline at end of file +}); \ No newline at end of file diff --git a/dashboard-ui/scripts/mysyncsettings.js b/dashboard-ui/scripts/mysyncsettings.js index 6cdf133453..5898561ed4 100644 --- a/dashboard-ui/scripts/mysyncsettings.js +++ b/dashboard-ui/scripts/mysyncsettings.js @@ -1,11 +1,11 @@ -(function ($, window, document) { +define(['appSettings'], function (appSettings) { function loadForm(page, user) { - page.querySelector('#txtSyncPath').value = AppSettings.syncPath(); - page.querySelector('#chkWifi').checked = AppSettings.syncOnlyOnWifi(); + page.querySelector('#txtSyncPath').value = appSettings.syncPath(); + page.querySelector('#chkWifi').checked = appSettings.syncOnlyOnWifi(); - var uploadServers = AppSettings.cameraUploadServers(); + var uploadServers = appSettings.cameraUploadServers(); page.querySelector('.uploadServerList').innerHTML = ConnectionManager.getSavedServers().map(function (s) { @@ -21,10 +21,10 @@ function saveUser(page, user) { - AppSettings.syncPath(page.querySelector('#txtSyncPath').value); - AppSettings.syncOnlyOnWifi(page.querySelector('#chkWifi').checked); + appSettings.syncPath(page.querySelector('#txtSyncPath').value); + appSettings.syncOnlyOnWifi(page.querySelector('#chkWifi').checked); - AppSettings.cameraUploadServers($(".chkUploadServer", page).get().filter(function (i) { + appSettings.cameraUploadServers($(".chkUploadServer", page).get().filter(function (i) { return i.checked; @@ -92,4 +92,4 @@ } }); -})(jQuery, window, document); \ No newline at end of file +}); \ No newline at end of file diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index b1d687d232..83eea9f4fc 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -1500,7 +1500,6 @@ var AppInfo = {}; AppInfo.enableBackButton = isIOS && (window.navigator.standalone || AppInfo.isNativeApp); AppInfo.supportsSyncPathSetting = isCordova && isAndroid; - AppInfo.supportsUserDisplayLanguageSetting = Dashboard.isConnectMode() && !isCordova; if (isCordova && isIOS) { AppInfo.moreIcon = 'more-horiz'; @@ -1903,6 +1902,8 @@ var AppInfo = {}; define("toast", [embyWebComponentsBowerPath + "/toast/toast"], returnFirstDependency); define("scrollHelper", [embyWebComponentsBowerPath + "/scrollhelper"], returnFirstDependency); + define("appSettings", [embyWebComponentsBowerPath + "/appsettings"], updateAppSettings); + // alias define("historyManager", [], function () { return { @@ -1935,6 +1936,39 @@ var AppInfo = {}; define('dialogText', ['globalize'], getDialogText()); } + function updateAppSettings(appSettings) { + + appSettings.enableExternalPlayers = function (val) { + + if (val != null) { + appSettings.set('externalplayers', val.toString()); + } + + return appSettings.get('externalplayers') == 'true'; + }; + + appSettings.enableCinemaMode = function (val) { + + if (val != null) { + appSettings.set('enableCinemaMode', val.toString()); + } + + val = appSettings.get('enableCinemaMode'); + + if (val) { + return val != 'false'; + } + + if (browserInfo.mobile) { + return false; + } + + return true; + }; + + return appSettings; + } + function getDialogText() { return function (globalize) { return { @@ -2067,7 +2101,6 @@ var AppInfo = {}; deps.push('connectionmanagerfactory'); deps.push('credentialprovider'); - deps.push('scripts/appsettings'); deps.push('scripts/extensions'); require(deps, function (connectionManagerExports, credentialProviderFactory) {