From 59e6ff41c09be7713b53e96adfadae4196874fa0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 27 Aug 2013 23:45:11 -0400 Subject: [PATCH] consolidated remote control presentation --- dashboard-ui/scripts/remotecontrol.js | 128 +++++++++++++------------- 1 file changed, 62 insertions(+), 66 deletions(-) diff --git a/dashboard-ui/scripts/remotecontrol.js b/dashboard-ui/scripts/remotecontrol.js index 61ff157596..82c9335d89 100644 --- a/dashboard-ui/scripts/remotecontrol.js +++ b/dashboard-ui/scripts/remotecontrol.js @@ -55,11 +55,13 @@ html += '

'; - html += ''; + html += ''; - html += ''; + html += ''; - html += ''; + html += ''; + + html += ''; html += ''; @@ -125,17 +127,7 @@ var promise; - if (command == "Browse") { - promise = ApiClient.sendBrowseCommand(sessionIds[0], { - - ItemId: item.Id, - ItemName: item.Name, - ItemType: item.Type, - Context: options.context - - }); - } - else if (command == "Play") { + if (command == "Play") { if (item.IsFolder) { @@ -144,12 +136,36 @@ return false; } - promise = ApiClient.sendPlayCommand(sessionIds[0], { + var playCommand = $('#fldPlayCommand', popup).val(); - ItemIds: [item.Id].join(','), - PlayCommand: $('#fldPlayCommand', popup).val() + if (playCommand == "Resume") { - }); + promise = ApiClient.sendPlayCommand(sessionIds[0], { + + ItemIds: [item.Id].join(','), + PlayCommand: 'PlayNow', + StartPositionTicks: item.UserData.PlaybackPositionTicks + }); + + } + else if (playCommand == "Browse") { + + promise = ApiClient.sendBrowseCommand(sessionIds[0], { + + ItemId: item.Id, + ItemName: item.Name, + ItemType: item.Type, + Context: options.context + + }); + } + else { + promise = ApiClient.sendPlayCommand(sessionIds[0], { + + ItemIds: [item.Id].join(','), + PlayCommand: playCommand + }); + } } else if (command == "PlayFromChapter") { @@ -165,15 +181,6 @@ }); } - else if (command == "Resume") { - promise = ApiClient.sendPlayCommand(sessionIds[0], { - - ItemIds: [item.Id].join(','), - PlayCommand: 'PlayNow', - StartPositionTicks: item.UserData.PlaybackPositionTicks - - }); - } else if (command == "Trailer" || command == "SpecialFeature" || command == "ThemeSong" || command == "ThemeVideo") { var id = $('.chkSelectItem:checked', popup).parents('.trItem').attr('data-id'); @@ -232,22 +239,23 @@ var themeVideosElem = $('.themeVideos', popup).hide(); var playButtonContainer = $('#playButtonContainer', popup).hide(); var queueButtonContainer = $('#queueButtonContainer', popup).hide(); - var okButtonContainer = $('#okButtonContainer', popup).hide(); + var resumeButtonContainer = $('#resumeButtonContainer', popup).hide(); + var browseButtonContainer = $('#browseButtonContainer', popup).hide(); var value = this.value; - if (value == "Browse") { + if (value == "Play") { - okButtonContainer.show(); - } - else if (value == "Play") { + browseButtonContainer.show(); + + if (item.Type != 'Person' && item.Type != 'Genre' && item.Type != 'Studio' && item.Type != 'Artist' && item.Type != 'GameGenre' && item.Type != 'MusicGenre') { + playButtonContainer.show(); + queueButtonContainer.show(); + } - playButtonContainer.show(); - queueButtonContainer.show(); - } - else if (value == "Resume") { - - playButtonContainer.show(); + if (!item.IsFolder && item.UserData && item.UserData.PlaybackPositionTicks) { + resumeButtonContainer.show(); + } } else if (value == "PlayFromChapter" && item.Chapters && item.Chapters.length) { @@ -330,7 +338,7 @@ } } - }); + }).trigger('change'); }); } @@ -408,39 +416,27 @@ html += '

'; html += ''; html += '';