fix for rendering empty links section

This commit is contained in:
Luke Pulverenti 2013-04-14 11:14:10 -04:00
parent a664275cf5
commit 421c559c2b
5 changed files with 43 additions and 86 deletions

View File

@ -42,7 +42,7 @@
} else {
$('#btnPlayMenu', page).hide();
$('#playButtonShadow', page).hide();
$('#btnQueueMenu', page).hide();
$('#btnQueueMenu', page).hide();
}
Dashboard.hideLoadingMsg();
@ -50,7 +50,7 @@
}
function setInitialCollapsibleState(page, item) {
if (!item.MediaStreams || !item.MediaStreams.length) {
$('#mediaInfoCollapsible', page).hide();
} else {
@ -110,17 +110,7 @@
LibraryBrowser.renderGenres($('#itemGenres', page), item);
LibraryBrowser.renderStudios($('#itemStudios', page), item);
renderUserDataIcons(page, item);
renderLinks(page, item);
}
function renderLinks(page, item) {
if (item.ProviderIds) {
$('#itemLinks', page).html(LibraryBrowser.getLinksHtml(item));
} else {
$('#itemLinks', page).hide();
}
LibraryBrowser.renderLinks($('#itemLinks', page), item);
}
function renderUserDataIcons(page, item) {
@ -465,7 +455,7 @@
$('#castContent', page).html(html);
}
function play(startPosition) {
MediaPlayer.play([currentItem], startPosition);
@ -494,14 +484,14 @@
}
});
$('#btnQueueMenu', page).on('click', function () {
var pos = $('#queueMenuAnchor', page).offset();
$('#btnQueueMenu', page).on('click', function () {
var pos = $('#queueMenuAnchor', page).offset();
$('#queueMenu', page).popup("open", {
x: pos.left + 165,
y: pos.top + 20
});
});
$('#queueMenu', page).popup("open", {
x: pos.left + 165,
y: pos.top + 20
});
});
$('#btnPlay', page).on('click', function () {
@ -515,15 +505,15 @@
$('#playMenu', page).popup("close");
var userdata = currentItem.UserData || {};
play(userdata.PlaybackPositionTicks);
});
$('#btnQueue', page).on('click', function () {
$('#btnQueue', page).on('click', function () {
$('#queueMenu', page).popup("close");
Playlist.add(currentItem);
});
$('#queueMenu', page).popup("close");
Playlist.add(currentItem);
});
}).on('pageshow', "#itemDetailPage", function () {
@ -584,7 +574,7 @@
$('#castCollapsible', page).off('expand.lazyload');
$('#galleryCollapsible', page).off('expand.lazyload');
});
function itemDetailPage() {
var self = this;

View File

@ -52,17 +52,7 @@
LibraryBrowser.renderGenres($('#itemGenres', page), item);
LibraryBrowser.renderStudios($('#itemStudios', page), item);
renderUserDataIcons(page, item);
renderLinks(page, item);
}
function renderLinks(page, item) {
if (item.ProviderIds) {
$('#itemLinks', page).html(LibraryBrowser.getLinksHtml(item));
} else {
$('#itemLinks', page).hide();
}
LibraryBrowser.renderLinks($('#itemLinks', page), item);
}
function renderUserDataIcons(page, item) {

View File

@ -67,7 +67,7 @@
}
renderUserDataIcons(page, item);
renderLinks(page, item);
LibraryBrowser.renderLinks($('#itemLinks', page), item);
if (item.Type == "Person" && item.PremiereDate) {
@ -97,16 +97,6 @@
}
}
function renderLinks(page, item) {
if (item.ProviderIds) {
$('#itemLinks', page).html(LibraryBrowser.getLinksHtml(item));
} else {
$('#itemLinks', page).hide();
}
}
function renderUserDataIcons(page, item) {
$('#itemRatings', page).html(LibraryBrowser.getUserDataIconsHtml(item));
}

View File

@ -439,53 +439,50 @@
},
getLinksHtml: function (item) {
renderLinks: function (linksElem, item) {
var html = 'Links:  ';
var links = [];
if (item.HomePageUrl) {
links.push('<a class="ui-link" href="' + item.HomePageUrl + '" target="_blank">Website</a>');
}
if (item.ProviderIds.Imdb) {
var providerIds = item.ProviderIds || {};
if (providerIds.Imdb) {
if (item.Type == "Movie" || item.Type == "Episode")
links.push('<a class="ui-link" href="http://www.imdb.com/title/' + item.ProviderIds.Imdb + '" target="_blank">IMDb</a>');
links.push('<a class="ui-link" href="http://www.imdb.com/title/' + providerIds.Imdb + '" target="_blank">IMDb</a>');
else if (item.Type == "Person")
links.push('<a class="ui-link" href="http://www.imdb.com/name/' + item.ProviderIds.Imdb + '" target="_blank">IMDb</a>');
links.push('<a class="ui-link" href="http://www.imdb.com/name/' + providerIds.Imdb + '" target="_blank">IMDb</a>');
}
if (item.ProviderIds.Tmdb) {
if (providerIds.Tmdb) {
if (item.Type == "Movie")
links.push('<a class="ui-link" href="http://www.themoviedb.org/movie/' + item.ProviderIds.Tmdb + '" target="_blank">TMDB</a>');
links.push('<a class="ui-link" href="http://www.themoviedb.org/movie/' + providerIds.Tmdb + '" target="_blank">TMDB</a>');
else if (item.Type == "Person")
links.push('<a class="ui-link" href="http://www.themoviedb.org/person/' + item.ProviderIds.Tmdb + '" target="_blank">TMDB</a>');
links.push('<a class="ui-link" href="http://www.themoviedb.org/person/' + providerIds.Tmdb + '" target="_blank">TMDB</a>');
}
if (item.ProviderIds.Tvdb)
links.push('<a class="ui-link" href="http://thetvdb.com/index.php?tab=series&id=' + item.ProviderIds.Tvdb + '" target="_blank">TVDB</a>');
if (item.ProviderIds.Tvcom) {
if (providerIds.Tvdb)
links.push('<a class="ui-link" href="http://thetvdb.com/index.php?tab=series&id=' + providerIds.Tvdb + '" target="_blank">TVDB</a>');
if (providerIds.Tvcom) {
if (item.Type == "Episode")
links.push('<a class="ui-link" href="http://www.tv.com/shows/' + item.ProviderIds.Tvcom + '" target="_blank">TV.com</a>');
links.push('<a class="ui-link" href="http://www.tv.com/shows/' + providerIds.Tvcom + '" target="_blank">TV.com</a>');
else if (item.Type == "Person")
links.push('<a class="ui-link" href="http://www.tv.com/people/' + item.ProviderIds.Tvcom + '" target="_blank">TV.com</a>');
links.push('<a class="ui-link" href="http://www.tv.com/people/' + providerIds.Tvcom + '" target="_blank">TV.com</a>');
}
if (item.ProviderIds.Musicbrainz)
links.push('<a class="ui-link" href="http://musicbrainz.org/release/' + item.ProviderIds.Musicbrainz + '" target="_blank">MusicBrainz</a>');
if (item.ProviderIds.Gamesdb)
links.push('<a class="ui-link" href="http://www.games-db.com/Game/' + item.ProviderIds.Gamesdb + '" target="_blank">GamesDB</a>');
if (providerIds.Musicbrainz)
links.push('<a class="ui-link" href="http://musicbrainz.org/release/' + providerIds.Musicbrainz + '" target="_blank">MusicBrainz</a>');
if (providerIds.Gamesdb)
links.push('<a class="ui-link" href="http://www.games-db.com/Game/' + providerIds.Gamesdb + '" target="_blank">GamesDB</a>');
html += links.join('&nbsp;&nbsp;/&nbsp;&nbsp;');
return html;
},
if (links.length) {
renderLinks: function (item, page) {
var html = 'Links:&nbsp;&nbsp;' + links.join('&nbsp;&nbsp;/&nbsp;&nbsp;');
if (item.ProviderIds) {
$('#itemLinks', page).html(LibraryBrowser.getLinksHtml(item));
$(linksElem).html(html);
} else {
$('#itemLinks', page).hide();
$(linksElem).hide();
}
},
@ -563,7 +560,7 @@
var itemId = item.Id;
var type = item.Type;
if (type == "Person") {
itemId = item.Name;
}

View File

@ -52,17 +52,7 @@
LibraryBrowser.renderGenres($('#itemGenres', page), item);
LibraryBrowser.renderStudios($('#itemStudios', page), item);
renderUserDataIcons(page, item);
renderLinks(page, item);
}
function renderLinks(page, item) {
if (item.ProviderIds) {
$('#itemLinks', page).html(LibraryBrowser.getLinksHtml(item));
} else {
$('#itemLinks', page).hide();
}
LibraryBrowser.renderLinks($('#itemLinks', page), item);
}
function renderUserDataIcons(page, item) {