From a5f1fa76811d2fff967772a3281ff959c7960e23 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 15 Mar 2014 00:14:07 -0400 Subject: [PATCH] support grouping behind boxsets --- dashboard-ui/css/site.css | 10 +- dashboard-ui/dashboard.html | 10 +- dashboard-ui/livetvrecording.html | 2 +- dashboard-ui/livetvtimer.html | 2 +- dashboard-ui/scripts/dashboardpage.js | 262 +++++++++--------------- dashboard-ui/scripts/librarymenu.js | 9 + dashboard-ui/scripts/livetvrecording.js | 2 +- dashboard-ui/scripts/livetvtimer.js | 2 +- dashboard-ui/scripts/movies.js | 3 +- 9 files changed, 121 insertions(+), 181 deletions(-) diff --git a/dashboard-ui/css/site.css b/dashboard-ui/css/site.css index f4f8423036..6cedf184e5 100644 --- a/dashboard-ui/css/site.css +++ b/dashboard-ui/css/site.css @@ -658,7 +658,7 @@ h1 .imageLink { /* Dashboard home */ .tblConnections td { - padding: 1em 0 1em 1.25em; + padding: 1em 0 1em .75em; vertical-align: top; } @@ -666,12 +666,8 @@ h1 .imageLink { padding-left: 0; } -.tblConnections img { - height: 48px; -} - -.nowPlayingText { - padding-left: .5em!important; +.tblConnections img:not(.clientNowPlayingImage) { + height: 28px; } .clientNowPlayingImage { diff --git a/dashboard-ui/dashboard.html b/dashboard-ui/dashboard.html index 0c5ccd6dc0..4267697acc 100644 --- a/dashboard-ui/dashboard.html +++ b/dashboard-ui/dashboard.html @@ -60,9 +60,11 @@ -
-

Active Devices

-
+
+

Active Connections

+
+ +
@@ -120,4 +122,4 @@
- + \ No newline at end of file diff --git a/dashboard-ui/livetvrecording.html b/dashboard-ui/livetvrecording.html index a3b5393d7a..a1375e3d20 100644 --- a/dashboard-ui/livetvrecording.html +++ b/dashboard-ui/livetvrecording.html @@ -57,7 +57,7 @@
-

+

diff --git a/dashboard-ui/livetvtimer.html b/dashboard-ui/livetvtimer.html index 857919903a..64f5753f71 100644 --- a/dashboard-ui/livetvtimer.html +++ b/dashboard-ui/livetvtimer.html @@ -32,7 +32,7 @@

- +

diff --git a/dashboard-ui/scripts/dashboardpage.js b/dashboard-ui/scripts/dashboardpage.js index 3d98d72cb4..297f6a4cd0 100644 --- a/dashboard-ui/scripts/dashboardpage.js +++ b/dashboard-ui/scripts/dashboardpage.js @@ -135,9 +135,9 @@ var html = ''; - var container = $('.connections', page); + var table = $('.tblConnections', page); - $('.sessionPosterItem', container).addClass('deadSession'); + $('.trSession', table).addClass('deadSession'); var deviceId = ApiClient.deviceId(); @@ -145,181 +145,103 @@ var connection = dashboardInfo.ActiveConnections[i]; - var itemId = 'session' + connection.Id; + var rowId = 'trSession' + connection.Id; - var elem = $('#' + itemId, page); + var elem = $('#' + rowId, page); if (elem.length) { DashboardPage.updateSession(elem, connection); continue; } - html += '
'; + html += ''; + + html += ''; + html += DashboardPage.getClientType(connection); + html += ''; + + html += ''; + + html += '
'; + if (deviceId == connection.DeviceId) { + html += connection.Client; + } else { + html += '' + connection.Client + ''; + } + html += '
'; + + html += '
' + connection.ApplicationVersion + '
'; + html += '
' + connection.DeviceName + '
'; + + html += '
'; + html += DashboardPage.getUsersHtml(connection); + html += '
'; + + html += ''; var nowPlayingItem = connection.NowPlayingItem; - var imageUrl = DashboardPage.getNowPlayingImage(nowPlayingItem); - var style = ""; - - if (imageUrl) { - style += 'background-image:url(\'' + imageUrl + '\');'; - } - - var onclick = connection.DeviceId == deviceId ? '' : ' onclick="RemoteControl.showMenu({sessionId:\'' + connection.Id + '\'});"'; - - html += ''; - - var defaultTextStyle = ''; - - if (nowPlayingItem) { - defaultTextStyle = "display:none;"; - } - html += '
Nothing currently playing
'; - - html += '
'; - - var itemNameStyle=''; - - if (!nowPlayingItem) { - itemNameStyle = "display:none;"; - } - html += '
' + (nowPlayingItem ? nowPlayingItem.Name : '') + '
'; - - var progressStyle=''; - - if (!nowPlayingItem) { - progressStyle = "display:none;"; - } - html += "
"; - - html += ''; - html += "
"; - html += "
"; - - html += ''; - - html += ''; - - html += '
' + DashboardPage.getSessionItemText(connection) + '
'; - - //html += ''; - //html += DashboardPage.getClientType(connection); - //html += ''; - - //html += ''; - - //html += '
'; - - //if (deviceId == connection.DeviceId) { - // html += connection.Client; - //} else { - // html += '' + connection.Client + ''; - //} - //html += '
'; - - //html += ''; - - //html += ''; - //html += DashboardPage.getNowPlayingImage(nowPlayingItem); - //html += ''; - - //html += ''; - //html += DashboardPage.getNowPlayingText(connection, nowPlayingItem); - //html += ''; + html += ''; + html += '
'; + html += DashboardPage.getNowPlayingImage(nowPlayingItem); html += '
'; + + html += '
'; + html += DashboardPage.getNowPlayingText(connection, nowPlayingItem); + html += '
'; + + html += ''; + + + html += ''; + } - container.append(html).trigger('create'); + table.append(html).trigger('create'); - $('.deadSession', container).remove(); - }, - - getPlaybackProgress: function (session) { - - if (session.NowPlayingItem) { - if (session.NowPlayingItem.RunTimeTicks) { - - var pct = (session.NowPlayingPositionTicks || 0) / session.NowPlayingItem.RunTimeTicks; - - return pct * 100; - } - } - - return 0; + $('.deadSession', table).remove(); }, getUsersHtml: function (session) { - var html = '
'; + var html = ''; if (session.UserId) { - html += session.UserName; + html += '
' + session.UserName + '
'; } html += session.AdditionalUsers.map(function (currentSession) { - return ', ' + currentSession.UserName; + return '
' + currentSession.UserName + '
'; }); - html += '
'; - return html; }, - updateSession: function (elem, session) { + updateSession: function (row, session) { - elem.removeClass('deadSession'); + row.removeClass('deadSession'); - $('.sessionItemText', elem).html(DashboardPage.getSessionItemText(session)); + $('.username', row).html(DashboardPage.getUsersHtml(session)); var nowPlayingItem = session.NowPlayingItem; - if (nowPlayingItem) { - $('.posterItemDefaultText', elem).hide(); - $('.posterItemProgress', elem).show(); - $('.posterItemName', elem).show().html(nowPlayingItem.Name); + $('.clientNowPlayingText', row).html(DashboardPage.getNowPlayingText(session, nowPlayingItem)).trigger('create'); - $('progress', elem).val(DashboardPage.getPlaybackProgress(session)); - } else { - $('.posterItemDefaultText', elem).show(); - $('.posterItemProgress', elem).hide(); - $('.posterItemName', elem).hide().html(''); - } + var imageRow = $('.nowPlayingImage', row); - var imageUrl = DashboardPage.getNowPlayingImage(nowPlayingItem); + var image = $('img', imageRow)[0]; - var image = $('.posterItemImage', elem)[0]; + var nowPlayingItemId = nowPlayingItem ? nowPlayingItem.Id : null; + var nowPlayingItemImageTag = nowPlayingItem ? nowPlayingItem.PrimaryImageTag : null; - if (imageUrl && imageUrl != image.getAttribute('data-imageurl')) { - - image.style.backgroundImage = 'url(\'' + imageUrl + '\')'; - image.setAttribute('data-imageurl', imageUrl); - - } else if (!imageUrl && image.getAttribute('data-imageurl')) { - - image.style.backgroundImage = null; - image.setAttribute('data-imageurl', ''); + if (!image || image.getAttribute('data-itemid') != nowPlayingItemId || image.getAttribute('data-tag') != nowPlayingItemImageTag) { + imageRow.html(DashboardPage.getNowPlayingImage(nowPlayingItem)); } }, - getSessionItemText: function (connection) { - - var html = ''; - - html += '
'; - html += DashboardPage.getUsersHtml(connection); - html += '
'; - - //html += '
' + connection.Client + '
'; - //html += '
' + connection.ApplicationVersion + '
'; - - html += '
' + connection.DeviceName + '
'; - - return html; - }, - - getClientImage: function (connection) { + getClientType: function (connection) { var clientLowered = connection.Client.toLowerCase(); @@ -345,81 +267,91 @@ imgUrl = 'css/images/clients/html5.png'; } - return imgUrl; + return "Dashboard"; } if (clientLowered == "mb-classic") { - return "css/images/clients/mbc.png"; + return "Media Browser Classic"; } if (clientLowered == "media browser theater") { - return "css/images/clients/mb.png"; + return "Media Browser Theater"; } if (clientLowered == "android") { - return "css/images/clients/android.png"; + return "Android"; } if (clientLowered == "roku") { - return "css/images/clients/roku.jpg"; + return "Roku"; } if (clientLowered == "ios") { - return "css/images/clients/ios.png"; + return "iOS"; } if (clientLowered == "windows rt") { - return "css/images/clients/windowsrt.png"; + return "Windows RT"; } if (clientLowered == "windows phone") { - return "css/images/clients/windowsphone.png"; + return "Windows Phone"; } if (clientLowered == "dlna") { - return "css/images/clients/dlna.png"; + return "Dlna"; } if (clientLowered == "mbkinect") { - return "css/images/clients/mbkinect.png"; + return "MB Kinect"; } if (clientLowered == "xbmc") { - return "css/images/clients/xbmc.png"; + return "Xbmc"; } - return "css/images/clients/mb.png"; + return connection.Client; }, getNowPlayingImage: function (item) { - if (item && item.ThumbItemId) { - return ApiClient.getImageUrl(item.ThumbItemId, { - type: "Thumb", - height: 300, - tag: item.ThumbImageTag - }); - } - - if (item && item.BackdropItemId) { - return ApiClient.getImageUrl(item.BackdropItemId, { - type: "Backdrop", - height: 300, - tag: item.BackdropImageTag - }); - } - if (item && item.PrimaryImageTag) { - return ApiClient.getImageUrl(item.Id, { + var url = ApiClient.getImageUrl(item.Id, { type: "Primary", - height: 300, + height: 100, tag: item.PrimaryImageTag }); + + url += "&xxx=" + new Date().getTime(); + + return "" + item.Name + ""; } return ""; }, + getNowPlayingText: function (connection, item) { + + var html = ""; + + if (item) { + + html += "
" + item.Name + "
"; + + html += "
"; + + if (item.RunTimeTicks) { + html += Dashboard.getDisplayTime(connection.NowPlayingPositionTicks || 0) + " / "; + + html += Dashboard.getDisplayTime(item.RunTimeTicks); + } + + html += "
"; + } + + return html; + }, + renderRunningTasks: function (dashboardInfo) { var page = $.mobile.activePage; diff --git a/dashboard-ui/scripts/librarymenu.js b/dashboard-ui/scripts/librarymenu.js index a640682a1b..29f00e8801 100644 --- a/dashboard-ui/scripts/librarymenu.js +++ b/dashboard-ui/scripts/librarymenu.js @@ -202,6 +202,15 @@ }); }); } + }).on('pageshow', ".libraryPage", function () { + + var page = this; + + var elem = $('.libraryViewNavInner .ui-btn-active:visible', page); + + if (elem.length) { + elem[0].scrollIntoView(); + } }); })(window, document, jQuery); \ No newline at end of file diff --git a/dashboard-ui/scripts/livetvrecording.js b/dashboard-ui/scripts/livetvrecording.js index ab58ae78d1..af5875d4c6 100644 --- a/dashboard-ui/scripts/livetvrecording.js +++ b/dashboard-ui/scripts/livetvrecording.js @@ -64,7 +64,7 @@ ApiClient.sendWebSocketMessage("Context", vals.join('|')); } - $('.status', page).html('Status:   ' + item.Status); + $('.recordingStatus', page).html('Status:   ' + item.Status); Dashboard.getCurrentUser().done(function (user) { diff --git a/dashboard-ui/scripts/livetvtimer.js b/dashboard-ui/scripts/livetvtimer.js index d442ca6478..fffd749b74 100644 --- a/dashboard-ui/scripts/livetvtimer.js +++ b/dashboard-ui/scripts/livetvtimer.js @@ -62,7 +62,7 @@ $('#chkPrePaddingRequired', page).checked(item.IsPrePaddingRequired).checkboxradio('refresh'); $('#chkPostPaddingRequired', page).checked(item.IsPostPaddingRequired).checkboxradio('refresh'); - $('.status', page).html('Status:   ' + item.Status); + $('.timerStatus', page).html('Status:   ' + item.Status); Dashboard.hideLoadingMsg(); } diff --git a/dashboard-ui/scripts/movies.js b/dashboard-ui/scripts/movies.js index 4cb13540e9..ce03f7cdb3 100644 --- a/dashboard-ui/scripts/movies.js +++ b/dashboard-ui/scripts/movies.js @@ -10,7 +10,8 @@ IncludeItemTypes: "Movie", Recursive: true, Fields: "PrimaryImageAspectRatio", - StartIndex: 0 + StartIndex: 0, + CollapseBoxSetItems: true }; function reloadItems(page) {