diff --git a/dashboard-ui/scripts/Itemdetailpage.js b/dashboard-ui/scripts/Itemdetailpage.js index 9d4d3a203a..3fc249bc4c 100644 --- a/dashboard-ui/scripts/Itemdetailpage.js +++ b/dashboard-ui/scripts/Itemdetailpage.js @@ -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; diff --git a/dashboard-ui/scripts/boxset.js b/dashboard-ui/scripts/boxset.js index 2219c7896f..0f9df757fc 100644 --- a/dashboard-ui/scripts/boxset.js +++ b/dashboard-ui/scripts/boxset.js @@ -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) { diff --git a/dashboard-ui/scripts/itembynamedetailpage.js b/dashboard-ui/scripts/itembynamedetailpage.js index 5b94501b2c..0ae5e9814f 100644 --- a/dashboard-ui/scripts/itembynamedetailpage.js +++ b/dashboard-ui/scripts/itembynamedetailpage.js @@ -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)); } diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index cbccc7f8af..197727c871 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -439,53 +439,50 @@ }, - getLinksHtml: function (item) { + renderLinks: function (linksElem, item) { - var html = 'Links:  '; var links = []; if (item.HomePageUrl) { links.push('Website'); } - if (item.ProviderIds.Imdb) { + var providerIds = item.ProviderIds || {}; + + if (providerIds.Imdb) { if (item.Type == "Movie" || item.Type == "Episode") - links.push('IMDb'); + links.push('IMDb'); else if (item.Type == "Person") - links.push('IMDb'); + links.push('IMDb'); } - if (item.ProviderIds.Tmdb) { + if (providerIds.Tmdb) { if (item.Type == "Movie") - links.push('TMDB'); + links.push('TMDB'); else if (item.Type == "Person") - links.push('TMDB'); + links.push('TMDB'); } - if (item.ProviderIds.Tvdb) - links.push('TVDB'); - if (item.ProviderIds.Tvcom) { + if (providerIds.Tvdb) + links.push('TVDB'); + if (providerIds.Tvcom) { if (item.Type == "Episode") - links.push('TV.com'); + links.push('TV.com'); else if (item.Type == "Person") - links.push('TV.com'); + links.push('TV.com'); } - if (item.ProviderIds.Musicbrainz) - links.push('MusicBrainz'); - if (item.ProviderIds.Gamesdb) - links.push('GamesDB'); + if (providerIds.Musicbrainz) + links.push('MusicBrainz'); + if (providerIds.Gamesdb) + links.push('GamesDB'); - html += links.join('  /  '); - return html; - }, + if (links.length) { - renderLinks: function (item, page) { + var html = 'Links:  ' + links.join('  /  '); - 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; } diff --git a/dashboard-ui/scripts/tvseries.js b/dashboard-ui/scripts/tvseries.js index ddbcd55160..36e0448bb4 100644 --- a/dashboard-ui/scripts/tvseries.js +++ b/dashboard-ui/scripts/tvseries.js @@ -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) {