mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
fixes #513 - Fix flickering on dashboard now playing page
This commit is contained in:
parent
aaec13cc11
commit
3431c8544e
2 changed files with 48 additions and 30 deletions
|
@ -44,7 +44,9 @@
|
||||||
|
|
||||||
<div data-role="collapsible" data-content-theme="c" data-collapsed="false" style="margin-top: 2em;">
|
<div data-role="collapsible" data-content-theme="c" data-collapsed="false" style="margin-top: 2em;">
|
||||||
<h3>Active Connections</h3>
|
<h3>Active Connections</h3>
|
||||||
<div id="divConnections">
|
<div>
|
||||||
|
<table class="tblConnections" style="border-collapse: collapse;">
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -75,21 +75,26 @@
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
if (!dashboardInfo.ActiveConnections.length) {
|
var table = $('.tblConnections', page);
|
||||||
html += '<p>There are no users currently connected.</p>';
|
|
||||||
$('#divConnections', page).html(html).trigger('create');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
html += '<table class="tblConnections" style="border-collapse:collapse;">';
|
$('.trSession', table).addClass('deadSession');
|
||||||
|
|
||||||
for (var i = 0, length = dashboardInfo.ActiveConnections.length; i < length; i++) {
|
for (var i = 0, length = dashboardInfo.ActiveConnections.length; i < length; i++) {
|
||||||
|
|
||||||
var connection = dashboardInfo.ActiveConnections[i];
|
var connection = dashboardInfo.ActiveConnections[i];
|
||||||
|
|
||||||
html += '<tr>';
|
var rowId = 'trSession' + connection.Id;
|
||||||
|
|
||||||
html += '<td style="text-align:center;">';
|
var elem = $('#' + rowId, page);
|
||||||
|
|
||||||
|
if (elem.length) {
|
||||||
|
DashboardPage.updateSession(elem, connection);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
html += '<tr class="trSession" id="' + rowId + '">';
|
||||||
|
|
||||||
|
html += '<td class="clientType" style="text-align:center;">';
|
||||||
html += DashboardPage.getClientType(connection);
|
html += DashboardPage.getClientType(connection);
|
||||||
html += '</td>';
|
html += '</td>';
|
||||||
|
|
||||||
|
@ -99,25 +104,40 @@
|
||||||
html += '<div>' + connection.DeviceName + '</div>';
|
html += '<div>' + connection.DeviceName + '</div>';
|
||||||
html += '</td>';
|
html += '</td>';
|
||||||
|
|
||||||
html += '<td>';
|
html += '<td class="username">';
|
||||||
html += connection.UserName || '';
|
html += connection.UserName || '';
|
||||||
html += '</td>';
|
html += '</td>';
|
||||||
|
|
||||||
html += '<td>';
|
var nowPlayingItem = connection.NowPlayingItem;
|
||||||
html += DashboardPage.getNowPlayingImage(connection.NowPlayingItem);
|
|
||||||
|
html += '<td class="nowPlayingImage">';
|
||||||
|
html += DashboardPage.getNowPlayingImage(nowPlayingItem);
|
||||||
html += '</td>';
|
html += '</td>';
|
||||||
|
|
||||||
html += '<td>';
|
html += '<td class="nowPlayingText">';
|
||||||
html += DashboardPage.getNowPlayingText(connection, connection.NowPlayingItem);
|
html += DashboardPage.getNowPlayingText(connection, nowPlayingItem);
|
||||||
html += '</td>';
|
html += '</td>';
|
||||||
|
|
||||||
html += '</tr>';
|
html += '</tr>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '</table>';
|
table.append(html).trigger('create');
|
||||||
|
|
||||||
$('#divConnections', page).html(html);
|
$('.deadSession', table).remove();
|
||||||
|
},
|
||||||
|
|
||||||
|
updateSession: function(row, session) {
|
||||||
|
|
||||||
|
row.removeClass('deadSession');
|
||||||
|
|
||||||
|
$('.username', row).html(session.UserName || '');
|
||||||
|
|
||||||
|
var nowPlayingItem = session.NowPlayingItem;
|
||||||
|
|
||||||
|
$('.nowPlayingText', row).html(DashboardPage.getNowPlayingText(session, nowPlayingItem)).trigger('create');
|
||||||
|
|
||||||
|
$('.nowPlayingImage', row).html(DashboardPage.getNowPlayingImage(nowPlayingItem));
|
||||||
},
|
},
|
||||||
|
|
||||||
getClientType: function (connection) {
|
getClientType: function (connection) {
|
||||||
|
@ -190,10 +210,7 @@
|
||||||
|
|
||||||
getNowPlayingImage: function (item) {
|
getNowPlayingImage: function (item) {
|
||||||
|
|
||||||
if (item) {
|
if (item && item.PrimaryImageTag) {
|
||||||
|
|
||||||
if (item.PrimaryImageTag) {
|
|
||||||
|
|
||||||
var url = ApiClient.getImageUrl(item.Id, {
|
var url = ApiClient.getImageUrl(item.Id, {
|
||||||
type: "Primary",
|
type: "Primary",
|
||||||
height: 100,
|
height: 100,
|
||||||
|
@ -202,7 +219,6 @@
|
||||||
|
|
||||||
return "<img class='clientNowPlayingImage' src='" + url + "' alt='" + item.Name + "' title='" + item.Name + "' />";
|
return "<img class='clientNowPlayingImage' src='" + url + "' alt='" + item.Name + "' title='" + item.Name + "' />";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
},
|
},
|
||||||
|
@ -213,7 +229,7 @@
|
||||||
|
|
||||||
if (item) {
|
if (item) {
|
||||||
|
|
||||||
html += "<div>" + item.Name + "</div>";
|
html += "<div><a href='itemdetails.html?id=" + item.Id + "'>" + item.Name + "</a></div>";
|
||||||
|
|
||||||
html += "<div>";
|
html += "<div>";
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue