2013-04-10 14:14:25 -07:00
( function ( $ , document , LibraryBrowser , window ) {
2013-02-20 18:33:05 -07:00
2013-04-10 14:14:25 -07:00
var currentItem ;
2013-02-20 18:33:05 -07:00
2013-04-10 14:14:25 -07:00
function reload ( page ) {
2013-03-06 16:28:43 -07:00
2013-02-20 18:33:05 -07:00
var id = getParameterByName ( 'id' ) ;
Dashboard . showLoadingMsg ( ) ;
2013-04-10 14:14:25 -07:00
ApiClient . getItem ( Dashboard . getCurrentUserId ( ) , id ) . done ( function ( item ) {
2013-02-20 18:33:05 -07:00
2013-04-10 14:14:25 -07:00
currentItem = item ;
2013-02-20 18:33:05 -07:00
2013-04-22 07:44:11 -07:00
renderHeader ( page , item ) ;
2013-04-10 14:14:25 -07:00
$ ( '#itemImage' , page ) . html ( LibraryBrowser . getDetailImageHtml ( item ) ) ;
2013-05-04 21:49:49 -07:00
2013-05-14 21:05:52 -07:00
LibraryBrowser . renderName ( item , $ ( '.itemName' , page ) ) ;
LibraryBrowser . renderParentName ( item , $ ( '.parentName' , page ) ) ;
2013-04-10 14:14:25 -07:00
2013-04-23 07:46:27 -07:00
var context = getContext ( item ) ;
setInitialCollapsibleState ( page , item , context ) ;
renderDetails ( page , item , context ) ;
2013-05-14 21:05:52 -07:00
LibraryBrowser . renderDetailPageBackdrop ( page , item ) ;
2013-02-20 18:33:05 -07:00
2013-07-29 08:05:09 -07:00
if ( item . LocationType == "Offline" ) {
$ ( '#offlineIndicator' , page ) . show ( ) ;
} else {
$ ( '#offlineIndicator' , page ) . hide ( ) ;
}
if ( MediaPlayer . canPlay ( item ) && item . LocationType !== "Offline" ) {
2013-05-04 14:20:27 -07:00
$ ( '#playButtonContainer' , page ) . show ( ) ;
2013-04-10 14:14:25 -07:00
} else {
2013-05-04 14:20:27 -07:00
$ ( '#playButtonContainer' , page ) . hide ( ) ;
2013-04-10 14:14:25 -07:00
}
2013-04-17 18:32:38 -07:00
2013-05-04 21:49:49 -07:00
Dashboard . getCurrentUser ( ) . done ( function ( user ) {
2013-08-06 09:48:27 -07:00
if ( user . Configuration . IsAdministrator ) {
2013-05-04 21:49:49 -07:00
$ ( '#editButtonContainer' , page ) . show ( ) ;
} else {
$ ( '#editButtonContainer' , page ) . hide ( ) ;
}
} ) ;
2013-04-30 20:28:26 -07:00
$ ( ".autoNumeric" ) . autoNumeric ( 'init' ) ;
2013-04-29 18:49:05 -07:00
2013-05-10 05:18:07 -07:00
if ( ApiClient . isWebSocketOpen ( ) ) {
2013-05-21 20:59:55 -07:00
ApiClient . sendWebSocketMessage ( "Context" , [ item . Type , item . Id , item . Name , context ] . join ( '|' ) ) ;
2013-05-10 05:18:07 -07:00
}
2013-04-10 14:14:25 -07:00
Dashboard . hideLoadingMsg ( ) ;
} ) ;
}
2013-04-24 13:28:42 -07:00
2013-04-23 07:46:27 -07:00
function getContext ( item ) {
// should return either movies, tv, music or games
2013-04-24 13:28:42 -07:00
2013-04-23 07:46:27 -07:00
if ( item . Type == "Episode" || item . Type == "Series" || item . Type == "Season" ) {
return "tv" ;
}
if ( item . Type == "Movie" || item . Type == "Trailer" || item . Type == "BoxSet" ) {
return "movies" ;
}
2013-05-27 18:59:26 -07:00
if ( item . Type == "Audio" || item . Type == "MusicAlbum" || item . Type == "MusicArtist" || item . Type == "Artist" || item . Type == "MusicVideo" ) {
2013-04-23 07:46:27 -07:00
return "music" ;
}
if ( item . MediaType == "Game" ) {
return "games" ;
}
return "" ;
}
2013-03-25 21:44:12 -07:00
2013-04-22 07:44:11 -07:00
function renderHeader ( page , item ) {
2013-04-28 11:47:19 -07:00
$ ( '.itemTabs' , page ) . hide ( ) ;
2013-04-22 08:10:54 -07:00
if ( item . Type == "MusicAlbum" ) {
$ ( '#albumTabs' , page ) . show ( ) ;
}
2013-05-27 18:59:26 -07:00
if ( item . Type == "MusicVideo" ) {
$ ( '#musicVideoTabs' , page ) . show ( ) ;
}
2013-04-22 07:44:11 -07:00
if ( item . Type == "Audio" ) {
$ ( '#songTabs' , page ) . show ( ) ;
}
if ( item . Type == "Movie" ) {
$ ( '#movieTabs' , page ) . show ( ) ;
}
2013-04-24 13:28:42 -07:00
if ( item . MediaType == "Game" ) {
$ ( '#gameTabs' , page ) . show ( ) ;
2013-04-28 11:47:19 -07:00
}
if ( item . Type == "GamePlatform" ) {
$ ( '#gameSystemTabs' , page ) . show ( ) ;
2013-04-24 13:28:42 -07:00
}
2013-04-22 07:44:11 -07:00
if ( item . Type == "BoxSet" ) {
$ ( '#boxsetTabs' , page ) . show ( ) ;
}
2013-04-28 11:47:19 -07:00
2013-04-22 07:44:11 -07:00
if ( item . Type == "Trailer" ) {
$ ( '#trailerTabs' , page ) . show ( ) ;
}
2013-04-28 11:47:19 -07:00
2013-04-22 07:44:11 -07:00
if ( item . Type == "Episode" || item . Type == "Season" || item . Type == "Series" ) {
$ ( '#tvShowsTabs' , page ) . show ( ) ;
}
}
2013-04-23 07:46:27 -07:00
function setInitialCollapsibleState ( page , item , context ) {
2013-04-14 08:14:10 -07:00
2013-05-14 21:05:52 -07:00
if ( item . ChildCount ) {
2013-05-18 15:48:19 -07:00
$ ( '#childrenCollapsible' , page ) . removeClass ( 'hide' ) ;
2013-04-22 07:44:11 -07:00
renderChildren ( page , item ) ;
2013-04-22 20:56:11 -07:00
}
else {
2013-05-18 15:48:19 -07:00
$ ( '#childrenCollapsible' , page ) . addClass ( 'hide' ) ;
2013-04-22 07:44:11 -07:00
}
2013-05-15 20:39:15 -07:00
if ( item . MediaStreams && item . MediaStreams . length ) {
2013-04-22 07:44:11 -07:00
renderMediaInfo ( page , item ) ;
2013-03-26 16:57:18 -07:00
}
2013-03-25 21:44:12 -07:00
if ( ! item . Chapters || ! item . Chapters . length ) {
2013-03-26 14:32:01 -07:00
$ ( '#scenesCollapsible' , page ) . hide ( ) ;
} else {
2013-03-26 15:53:06 -07:00
$ ( '#scenesCollapsible' , page ) . show ( ) ;
2013-05-11 23:05:51 -07:00
renderScenes ( page , item , 6 ) ;
2013-03-25 21:44:12 -07:00
}
2013-08-23 19:53:30 -07:00
if ( ! item . LocalTrailerCount && ! item . RemoteTrailers . length ) {
2013-05-18 15:48:19 -07:00
$ ( '#trailersCollapsible' , page ) . addClass ( 'hide' ) ;
2013-03-26 14:32:01 -07:00
} else {
2013-05-18 15:48:19 -07:00
$ ( '#trailersCollapsible' , page ) . removeClass ( 'hide' ) ;
2013-04-22 07:44:11 -07:00
renderTrailers ( page , item ) ;
2013-03-26 11:51:52 -07:00
}
if ( ! item . SpecialFeatureCount || item . SpecialFeatureCount == 0 ) {
2013-05-18 15:48:19 -07:00
$ ( '#specialsCollapsible' , page ) . addClass ( 'hide' ) ;
2013-03-26 14:32:01 -07:00
} else {
2013-05-18 15:48:19 -07:00
$ ( '#specialsCollapsible' , page ) . removeClass ( 'hide' ) ;
2013-05-11 23:05:51 -07:00
renderSpecials ( page , item , 6 ) ;
2013-03-26 11:51:52 -07:00
}
2013-03-26 22:20:46 -07:00
if ( ! item . People || ! item . People . length ) {
$ ( '#castCollapsible' , page ) . hide ( ) ;
} else {
$ ( '#castCollapsible' , page ) . show ( ) ;
2013-05-11 23:05:51 -07:00
renderCast ( page , item , context , 10 ) ;
2013-03-26 22:20:46 -07:00
}
2013-04-24 09:03:10 -07:00
2013-06-12 14:46:50 -07:00
if ( ! item . PartCount || item . PartCount < 2 ) {
$ ( '#additionalPartsCollapsible' , page ) . addClass ( 'hide' ) ;
} else {
$ ( '#additionalPartsCollapsible' , page ) . removeClass ( 'hide' ) ;
renderAdditionalParts ( page , item ) ;
}
2013-04-24 09:03:10 -07:00
$ ( '#themeSongsCollapsible' , page ) . hide ( ) ;
2013-04-28 11:30:58 -07:00
$ ( '#themeVideosCollapsible' , page ) . hide ( ) ;
2013-04-24 09:03:10 -07:00
2013-07-16 09:03:28 -07:00
if ( ! item . SoundtrackIds || ! item . SoundtrackIds . length ) {
$ ( '#soundtracksCollapsible' , page ) . hide ( ) ;
} else {
$ ( '#soundtracksCollapsible' , page ) . show ( ) ;
renderSoundtracks ( page , item ) ;
}
2013-07-29 12:12:21 -07:00
if ( item . Type == "MusicAlbum" ) {
renderMusicVideos ( page , item ) ;
} else {
2013-07-30 14:02:28 -07:00
$ ( '#musicVideosCollapsible' , page ) . hide ( ) ;
2013-07-29 12:12:21 -07:00
}
2013-05-19 10:35:00 -07:00
renderThemeSongs ( page , item ) ;
renderThemeVideos ( page , item ) ;
2013-05-11 23:05:51 -07:00
renderCriticReviews ( page , item , 1 ) ;
2013-04-10 14:14:25 -07:00
}
2013-03-25 21:44:12 -07:00
2013-04-23 07:46:27 -07:00
function renderDetails ( page , item , context ) {
2013-02-20 18:33:05 -07:00
2013-05-19 10:35:00 -07:00
renderSimilarItems ( page , item ) ;
renderSiblingLinks ( page , item ) ;
2013-02-20 18:33:05 -07:00
if ( item . Taglines && item . Taglines . length ) {
$ ( '#itemTagline' , page ) . html ( item . Taglines [ 0 ] ) . show ( ) ;
} else {
$ ( '#itemTagline' , page ) . hide ( ) ;
}
2013-05-14 21:05:52 -07:00
LibraryBrowser . renderOverview ( $ ( '.itemOverview' , page ) , item ) ;
2013-02-20 18:33:05 -07:00
2013-05-05 21:50:40 -07:00
if ( item . CommunityRating || item . CriticRating ) {
2013-05-14 21:05:52 -07:00
$ ( '.itemCommunityRating' , page ) . html ( LibraryBrowser . getRatingHtml ( item ) ) . show ( ) ;
2013-02-20 18:33:05 -07:00
} else {
2013-05-14 21:05:52 -07:00
$ ( '.itemCommunityRating' , page ) . hide ( ) ;
2013-02-20 18:33:05 -07:00
}
2013-05-08 13:58:52 -07:00
if ( item . Type != "Episode" && item . Type != "Movie" ) {
2013-05-04 12:53:13 -07:00
var premiereDateElem = $ ( '#itemPremiereDate' , page ) . show ( ) ;
LibraryBrowser . renderPremiereDate ( premiereDateElem , item ) ;
} else {
$ ( '#itemPremiereDate' , page ) . hide ( ) ;
}
2013-05-04 14:20:27 -07:00
2013-04-12 08:25:00 -07:00
LibraryBrowser . renderBudget ( $ ( '#itemBudget' , page ) , item ) ;
2013-04-18 07:05:38 -07:00
LibraryBrowser . renderRevenue ( $ ( '#itemRevenue' , page ) , item ) ;
2013-04-12 08:25:00 -07:00
2013-05-14 21:05:52 -07:00
$ ( '.itemMiscInfo' , page ) . html ( LibraryBrowser . getMiscInfoHtml ( item ) ) ;
2013-02-20 18:33:05 -07:00
2013-05-14 21:05:52 -07:00
LibraryBrowser . renderGenres ( $ ( '.itemGenres' , page ) , item , context ) ;
LibraryBrowser . renderStudios ( $ ( '.itemStudios' , page ) , item , context ) ;
2013-04-10 14:14:25 -07:00
renderUserDataIcons ( page , item ) ;
2013-05-14 21:05:52 -07:00
LibraryBrowser . renderLinks ( $ ( '.itemExternalLinks' , page ) , item ) ;
$ ( '.criticRatingScore' , page ) . html ( ( item . CriticRating || '0' ) + '%' ) ;
2013-05-06 20:00:24 -07:00
2013-05-05 21:50:40 -07:00
if ( item . CriticRatingSummary ) {
$ ( '#criticRatingSummary' , page ) . show ( ) ;
2013-05-14 21:05:52 -07:00
$ ( '.criticRatingSummaryText' , page ) . html ( item . CriticRatingSummary ) ;
2013-05-05 21:50:40 -07:00
} else {
$ ( '#criticRatingSummary' , page ) . hide ( ) ;
}
2013-05-06 20:00:24 -07:00
renderTags ( page , item ) ;
2013-05-14 22:04:12 -07:00
2013-05-19 10:35:00 -07:00
renderSeriesAirTime ( page , item , context ) ;
2013-05-16 20:24:41 -07:00
if ( item . Players ) {
$ ( '#players' , page ) . show ( ) . html ( item . Players + ' Player' ) ;
} else {
$ ( '#players' , page ) . hide ( ) ;
}
2013-07-22 16:59:28 -07:00
if ( ( item . Type == "Audio" || item . Type == "MusicVideo" ) && item . Artists && item . Artists . length ) {
2013-05-16 20:24:41 -07:00
$ ( '#artist' , page ) . show ( ) . html ( 'Artist: <a class="textlink" href="itembynamedetails.html?context=music&artist=' + ApiClient . encodeName ( item . Artists [ 0 ] ) + '">' + item . Artists [ 0 ] + '</a>' ) . trigger ( 'create' ) ;
} else {
$ ( '#artist' , page ) . hide ( ) ;
}
2013-05-19 10:35:00 -07:00
2013-05-28 13:01:33 -07:00
var detailsSection = $ ( '#detailsSection' , page ) ;
var elem = $ ( '.detailSectionContent' , detailsSection ) [ 0 ] ;
var text = elem . textContent || elem . innerText ;
if ( ! text . trim ( ) ) {
detailsSection . addClass ( 'hide' ) ;
} else {
detailsSection . removeClass ( 'hide' ) ;
}
if ( item . Path ) {
$ ( '.itemPath' , page ) . show ( ) . html ( 'Path: ' + '<span style="font-size:13px;">' + item . Path + '</span>' ) ;
} else {
$ ( '.itemPath' , page ) . hide ( ) ;
}
2013-05-15 06:57:13 -07:00
}
2013-07-29 12:12:21 -07:00
2013-07-16 09:03:28 -07:00
function renderSoundtracks ( page , item ) {
2013-07-29 12:12:21 -07:00
2013-07-16 09:03:28 -07:00
if ( item . Type == "MusicAlbum" ) {
$ ( '#soundtracksHeader' , page ) . html ( "This album is the soundtrack for ..." ) ;
} else {
$ ( '#soundtracksHeader' , page ) . html ( "Soundtrack(s)" ) ;
}
ApiClient . getItems ( Dashboard . getCurrentUserId ( ) , {
Ids : item . SoundtrackIds . join ( "," ) ,
ItemFields : "PrimaryImageAspectRatio,ItemCounts,DisplayMediaType,DateCreated,UserData,AudioInfo" ,
SortBy : "SortName"
} ) . done ( function ( result ) {
var html = LibraryBrowser . getPosterViewHtml ( {
items : result . Items ,
useAverageAspectRatio : true ,
showNewIndicator : true ,
shape : item . Type == "MusicAlbum" ? "portrait" : "square"
} ) ;
$ ( '#soundtracksContent' , page ) . html ( html ) ;
} ) ;
}
2013-05-15 15:55:24 -07:00
2013-05-19 10:35:00 -07:00
function renderSiblingLinks ( page , item ) {
$ ( '.lnkSibling' , page ) . addClass ( 'hide' ) ;
if ( ( item . Type != "Episode" && item . Type != "Season" && item . Type != "Audio" ) || item . IndexNumber == null ) {
return ;
}
var friendly = item . Type == "Audio" ? "song" : item . Type . toLowerCase ( ) ;
ApiClient . getItems ( Dashboard . getCurrentUserId ( ) , {
AdjacentTo : item . Id ,
ParentId : item . ParentId
} ) . done ( function ( result ) {
for ( var i = 0 , length = result . Items . length ; i < length ; i ++ ) {
var curr = result . Items [ i ] ;
if ( curr . IndexNumber == null ) {
continue ;
}
if ( curr . IndexNumber < item . IndexNumber ) {
$ ( '.lnkPreviousItem' , page ) . removeClass ( 'hide' ) . attr ( 'href' , 'itemdetails.html?id=' + curr . Id ) . html ( '← Previous ' + friendly ) ;
}
else if ( curr . IndexNumber > item . IndexNumber ) {
$ ( '.lnkNextItem' , page ) . removeClass ( 'hide' ) . attr ( 'href' , 'itemdetails.html?id=' + curr . Id ) . html ( 'Next ' + friendly + ' →' ) ;
}
}
} ) ;
}
function renderSimilarItems ( page , item ) {
2013-05-15 15:55:24 -07:00
2013-05-25 16:52:41 -07:00
var promise ;
2013-05-15 15:55:24 -07:00
2013-05-25 16:52:41 -07:00
var options = {
userId : Dashboard . getCurrentUserId ( ) ,
2013-06-03 19:02:49 -07:00
limit : item . Type == "MusicAlbum" ? 6 : 8 ,
fields : "PrimaryImageAspectRatio,DateCreated,UserData"
2013-05-25 16:52:41 -07:00
} ;
2013-05-28 13:01:33 -07:00
2013-05-25 16:52:41 -07:00
if ( item . Type == "Movie" ) {
promise = ApiClient . getSimilarMovies ( item . Id , options ) ;
}
else if ( item . Type == "Trailer" ) {
promise = ApiClient . getSimilarTrailers ( item . Id , options ) ;
}
else if ( item . Type == "MusicAlbum" ) {
promise = ApiClient . getSimilarAlbums ( item . Id , options ) ;
}
else if ( item . Type == "Series" ) {
promise = ApiClient . getSimilarShows ( item . Id , options ) ;
}
else if ( item . MediaType == "Game" ) {
promise = ApiClient . getSimilarGames ( item . Id , options ) ;
} else {
2013-05-15 15:55:24 -07:00
$ ( '#similarCollapsible' , page ) . hide ( ) ;
return ;
}
2013-05-25 16:52:41 -07:00
promise . done ( function ( result ) {
2013-05-15 15:55:24 -07:00
if ( ! result . Items . length ) {
$ ( '#similarCollapsible' , page ) . hide ( ) ;
return ;
}
var elem = $ ( '#similarCollapsible' , page ) . show ( ) ;
$ ( '.detailSectionHeader' , elem ) . html ( 'If you like ' + item . Name + ', check these out...' ) ;
var html = LibraryBrowser . getPosterViewHtml ( {
items : result . Items ,
2013-05-16 13:46:18 -07:00
useAverageAspectRatio : item . MediaType != "Game" ,
2013-05-15 15:55:24 -07:00
showNewIndicator : true ,
shape : item . Type == "MusicAlbum" ? "square" : "portrait"
} ) ;
$ ( '#similarContent' , page ) . html ( html ) ;
} ) ;
}
2013-05-15 06:57:13 -07:00
function renderSeriesAirTime ( page , item , context ) {
2013-05-15 15:55:24 -07:00
2013-05-15 06:57:13 -07:00
if ( item . Type != "Series" ) {
$ ( '#seriesAirTime' , page ) . hide ( ) ;
return ;
}
2013-06-04 09:48:23 -07:00
var html = '' ;
2013-05-15 15:55:24 -07:00
2013-05-18 10:07:20 -07:00
if ( item . AirDays && item . AirDays . length ) {
2013-06-04 09:48:23 -07:00
html += item . AirDays . length == 7 ? 'daily' : item . AirDays . map ( function ( a ) {
2013-05-15 06:57:13 -07:00
return a + "s" ;
} ) . join ( ',' ) ;
}
2013-05-15 15:55:24 -07:00
2013-05-15 06:57:13 -07:00
if ( item . Studios . length ) {
html += ' on <a class="textlink" href="itembynamedetails.html?context=' + context + '&studio=' + ApiClient . encodeName ( item . Studios [ 0 ] . Name ) + '">' + item . Studios [ 0 ] . Name + '</a>' ;
}
if ( item . AirTime ) {
html += ' at ' + item . AirTime ;
}
2013-06-04 09:48:23 -07:00
if ( html ) {
html = ( item . Status == 'Ended' ? 'Aired ' : 'Airs ' ) + html ;
2013-06-12 14:46:50 -07:00
2013-06-04 09:48:23 -07:00
$ ( '#seriesAirTime' , page ) . show ( ) . html ( html ) . trigger ( 'create' ) ;
} else {
$ ( '#seriesAirTime' , page ) . hide ( ) ;
}
2013-05-06 20:00:24 -07:00
}
function renderTags ( page , item ) {
if ( item . Tags && item . Tags . length ) {
var html = '' ;
for ( var i = 0 , length = item . Tags . length ; i < length ; i ++ ) {
html += '<div class="itemTag">' + item . Tags [ i ] + '</div>' ;
}
2013-05-14 21:05:52 -07:00
$ ( '.itemTags' , page ) . show ( ) . html ( html ) ;
2013-05-06 20:00:24 -07:00
} else {
2013-05-14 21:05:52 -07:00
$ ( '.itemTags' , page ) . hide ( ) ;
2013-05-06 20:00:24 -07:00
}
2013-04-10 14:14:25 -07:00
}
2013-03-25 21:44:12 -07:00
2013-04-22 07:44:11 -07:00
function renderChildren ( page , item ) {
2013-06-12 14:46:50 -07:00
2013-06-04 20:40:17 -07:00
var sortBy = item . Type == "BoxSet" ? "ProductionYear,SortName" : "SortName" ;
2013-05-15 15:55:24 -07:00
2013-04-22 07:44:11 -07:00
ApiClient . getItems ( Dashboard . getCurrentUserId ( ) , {
ParentId : getParameterByName ( 'id' ) ,
2013-05-15 06:57:13 -07:00
SortBy : sortBy ,
2013-04-25 20:31:10 -07:00
Fields : "PrimaryImageAspectRatio,ItemCounts,DisplayMediaType,DateCreated,UserData,AudioInfo"
2013-04-22 07:44:11 -07:00
} ) . done ( function ( result ) {
2013-04-22 13:06:43 -07:00
if ( item . Type == "MusicAlbum" ) {
2013-04-22 07:44:11 -07:00
2013-05-14 21:05:52 -07:00
$ ( '#childrenContent' , page ) . html ( LibraryBrowser . getSongTableHtml ( result . Items , { showArtist : true } ) ) . trigger ( 'create' ) ;
2013-04-22 13:06:43 -07:00
} else {
2013-04-28 11:47:19 -07:00
2013-05-04 11:21:29 -07:00
var shape = "smallPoster" ;
2013-05-04 14:20:27 -07:00
2013-05-04 11:21:29 -07:00
if ( item . Type == "Season" ) {
shape = "smallBackdrop" ;
}
2013-04-28 11:47:19 -07:00
2013-04-22 13:06:43 -07:00
var html = LibraryBrowser . getPosterDetailViewHtml ( {
items : result . Items ,
2013-04-28 11:47:19 -07:00
useAverageAspectRatio : true ,
shape : shape
2013-04-22 13:06:43 -07:00
} ) ;
$ ( '#childrenContent' , page ) . html ( html ) ;
}
2013-04-22 07:44:11 -07:00
} ) ;
if ( item . Type == "Season" ) {
$ ( '#childrenTitle' , page ) . html ( 'Episodes (' + item . ChildCount + ')' ) ;
}
else if ( item . Type == "Series" ) {
$ ( '#childrenTitle' , page ) . html ( 'Seasons (' + item . ChildCount + ')' ) ;
}
else if ( item . Type == "BoxSet" ) {
$ ( '#childrenTitle' , page ) . html ( 'Movies (' + item . ChildCount + ')' ) ;
}
2013-04-22 08:10:54 -07:00
else if ( item . Type == "MusicAlbum" ) {
2013-04-22 13:06:43 -07:00
$ ( '#childrenTitle' , page ) . html ( 'Tracks (' + item . ChildCount + ')' ) ;
2013-04-22 08:10:54 -07:00
}
2013-04-28 11:47:19 -07:00
else if ( item . Type == "GamePlatform" ) {
$ ( '#childrenTitle' , page ) . html ( 'Games (' + item . ChildCount + ')' ) ;
}
2013-04-22 07:44:11 -07:00
else {
$ ( '#childrenTitle' , page ) . html ( 'Items (' + item . ChildCount + ')' ) ;
}
}
2013-04-10 14:14:25 -07:00
function renderUserDataIcons ( page , item ) {
2013-05-14 21:05:52 -07:00
$ ( '.userDataIcons' , page ) . html ( LibraryBrowser . getUserDataIconsHtml ( item ) ) ;
2013-04-10 14:14:25 -07:00
}
2013-04-24 13:28:42 -07:00
2013-05-11 23:05:51 -07:00
function renderCriticReviews ( page , item , limit ) {
2013-05-27 18:59:26 -07:00
if ( item . Type != "Movie" && item . Type != "Trailer" && item . Type != "MusicVideo" ) {
2013-05-19 10:35:00 -07:00
$ ( '#criticReviewsCollapsible' , page ) . hide ( ) ;
return ;
}
2013-05-11 23:05:51 -07:00
var options = { } ;
if ( limit ) {
options . limit = limit ;
}
ApiClient . getCriticReviews ( item . Id , options ) . done ( function ( result ) {
2013-05-14 21:05:52 -07:00
if ( result . TotalRecordCount || item . CriticRatingSummary ) {
2013-05-11 23:05:51 -07:00
$ ( '#criticReviewsCollapsible' , page ) . show ( ) ;
renderCriticReviewsContent ( page , result , limit ) ;
} else {
$ ( '#criticReviewsCollapsible' , page ) . hide ( ) ;
}
} ) ;
}
function renderCriticReviewsContent ( page , result , limit ) {
var html = '' ;
var reviews = result . ItemReviews ;
for ( var i = 0 , length = reviews . length ; i < length ; i ++ ) {
var review = reviews [ i ] ;
html += '<div class="criticReview">' ;
html += '<div class="reviewScore">' ;
if ( review . Score != null ) {
html += review . Score ;
}
else if ( review . Likes != null ) {
if ( review . Likes ) {
html += '<img src="css/images/fresh.png" />' ;
} else {
html += '<img src="css/images/rotten.png" />' ;
}
}
2013-05-13 22:36:36 -07:00
2013-05-11 23:05:51 -07:00
html += '</div>' ;
html += '<div class="reviewCaption">' + review . Caption + '</div>' ;
var vals = [ ] ;
if ( review . ReviewerName ) {
vals . push ( review . ReviewerName ) ;
}
if ( review . Publisher ) {
vals . push ( review . Publisher ) ;
}
html += '<div class="reviewerName">' + vals . join ( ', ' ) + '.' ;
if ( review . Date ) {
try {
var date = parseISO8601Date ( review . Date , true ) . toLocaleDateString ( ) ;
html += '<span class="reviewDate">' + date + '</span>' ;
}
catch ( error ) {
}
}
html += '</div>' ;
if ( review . Url ) {
html += '<div class="reviewLink"><a class="textlink" href="' + review . Url + '" target="_blank">Full review</a></div>' ;
}
html += '</div>' ;
}
if ( limit && result . TotalRecordCount > limit ) {
html += '<p style="margin: .5em 0 0;padding-left: .5em;"><button class="moreCriticReviews" data-inline="true" data-mini="true">More ...</button></p>' ;
}
$ ( '#criticReviewsContent' , page ) . html ( html ) . trigger ( 'create' ) ;
}
2013-05-19 10:35:00 -07:00
function renderThemeSongs ( page , item ) {
2013-04-24 13:28:42 -07:00
2013-05-19 10:35:00 -07:00
ApiClient . getThemeSongs ( Dashboard . getCurrentUserId ( ) , item . Id ) . done ( function ( result ) {
if ( result . Items . length ) {
2013-04-24 13:28:42 -07:00
2013-05-19 10:35:00 -07:00
$ ( '#themeSongsCollapsible' , page ) . show ( ) ;
$ ( '#themeSongsContent' , page ) . html ( LibraryBrowser . getSongTableHtml ( result . Items , { showArtist : true , showAlbum : true } ) ) . trigger ( 'create' ) ;
2013-05-19 19:45:04 -07:00
} else {
$ ( '#themeSongsCollapsible' , page ) . hide ( ) ;
2013-05-19 10:35:00 -07:00
}
} ) ;
2013-04-24 09:03:10 -07:00
}
2013-02-20 18:33:05 -07:00
2013-07-29 12:12:21 -07:00
function renderMusicVideos ( page , item ) {
ApiClient . getItems ( Dashboard . getCurrentUserId ( ) , {
SortBy : "SortName" ,
SortOrder : "Ascending" ,
IncludeItemTypes : "MusicVideo" ,
Recursive : true ,
2013-08-08 05:19:11 -07:00
Fields : "UserData,DisplayMediaType,ItemCounts,DateCreated" ,
Albums : item . Name
2013-07-29 12:12:21 -07:00
} ) . done ( function ( result ) {
if ( result . Items . length ) {
$ ( '#musicVideosCollapsible' , page ) . show ( ) ;
$ ( '#musicVideosContent' , page ) . html ( getVideosHtml ( result . Items ) ) . trigger ( 'create' ) ;
} else {
$ ( '#musicVideosCollapsible' , page ) . hide ( ) ;
}
} ) ;
}
2013-05-19 10:35:00 -07:00
function renderThemeVideos ( page , item ) {
2013-04-28 10:21:56 -07:00
2013-05-19 10:35:00 -07:00
ApiClient . getThemeVideos ( Dashboard . getCurrentUserId ( ) , item . Id ) . done ( function ( result ) {
if ( result . Items . length ) {
2013-04-28 10:21:56 -07:00
2013-05-19 10:35:00 -07:00
$ ( '#themeVideosCollapsible' , page ) . show ( ) ;
$ ( '#themeVideosContent' , page ) . html ( getVideosHtml ( result . Items ) ) . trigger ( 'create' ) ;
2013-05-19 19:45:04 -07:00
} else {
$ ( '#themeVideosCollapsible' , page ) . hide ( ) ;
2013-05-19 10:35:00 -07:00
}
} ) ;
2013-04-28 10:21:56 -07:00
}
2013-06-12 14:46:50 -07:00
function renderAdditionalParts ( page , item ) {
ApiClient . getAdditionalVideoParts ( Dashboard . getCurrentUserId ( ) , item . Id ) . done ( function ( result ) {
if ( result . Items . length ) {
$ ( '#additionalPartsCollapsible' , page ) . show ( ) ;
$ ( '#additionalPartsContent' , page ) . html ( getVideosHtml ( result . Items ) ) . trigger ( 'create' ) ;
} else {
$ ( '#additionalPartsCollapsible' , page ) . hide ( ) ;
}
} ) ;
}
2013-05-11 23:05:51 -07:00
function renderScenes ( page , item , limit ) {
2013-02-20 18:33:05 -07:00
var html = '' ;
2013-04-10 14:14:25 -07:00
2013-05-11 23:05:51 -07:00
var chapters = item . Chapters || [ ] ;
2013-02-20 18:33:05 -07:00
2013-03-25 21:44:12 -07:00
for ( var i = 0 , length = chapters . length ; i < length ; i ++ ) {
2013-05-11 23:05:51 -07:00
if ( limit && i >= limit ) {
break ;
}
2013-03-25 21:44:12 -07:00
var chapter = chapters [ i ] ;
2013-04-10 10:11:23 -07:00
var chapterName = chapter . Name || "Chapter " + i ;
2013-03-25 21:44:12 -07:00
2013-05-03 13:50:13 -07:00
html += '<a class="posterItem smallBackdropPosterItem" href="#play-Chapter-' + i + '" onclick="ItemDetailPage.play(' + chapter . StartPositionTicks + ');">' ;
var imgUrl ;
2013-03-25 21:44:12 -07:00
if ( chapter . ImageTag ) {
2013-05-03 13:50:13 -07:00
imgUrl = ApiClient . getImageUrl ( item . Id , {
2013-04-22 07:44:11 -07:00
width : 400 ,
2013-03-25 21:44:12 -07:00
tag : chapter . ImageTag ,
type : "Chapter" ,
index : i
} ) ;
} else {
2013-05-03 13:50:13 -07:00
imgUrl = "css/images/items/list/chapter.png" ;
2013-03-25 21:44:12 -07:00
}
2013-02-20 18:33:05 -07:00
2013-05-03 13:50:13 -07:00
html += '<div class="posterItemImage" style="background-image:url(\'' + imgUrl + '\');"></div>' ;
html += '<div class="posterItemText">' + chapterName + '</div>' ;
html += '<div class="posterItemText">' ;
2013-02-20 18:33:05 -07:00
2013-06-07 10:29:33 -07:00
html += Dashboard . getDisplayTime ( chapter . StartPositionTicks ) ;
2013-03-26 15:53:06 -07:00
2013-03-25 21:44:12 -07:00
html += '</div>' ;
html += '</a>' ;
2013-02-20 18:33:05 -07:00
}
2013-05-11 23:05:51 -07:00
if ( limit && chapters . length > limit ) {
html += '<p style="margin: .5em 0 0;padding-left: .5em;"><button class="moreScenes" data-inline="true" data-mini="true">More ...</button></p>' ;
}
$ ( '#scenesContent' , page ) . html ( html ) . trigger ( 'create' ) ;
2013-04-10 14:14:25 -07:00
}
2013-03-06 16:28:43 -07:00
2013-04-10 14:14:25 -07:00
function renderMediaInfo ( page , item ) {
2013-03-26 14:32:01 -07:00
2013-03-26 16:57:18 -07:00
var html = '' ;
for ( var i = 0 , length = item . MediaStreams . length ; i < length ; i ++ ) {
var stream = item . MediaStreams [ i ] ;
2013-04-09 11:01:39 -07:00
if ( stream . Type == "Data" ) {
continue ;
}
2013-04-09 11:38:58 -07:00
var type ;
if ( item . MediaType == "Audio" && stream . Type == "Video" ) {
type = "Embedded Image" ;
} else {
type = stream . Type ;
2013-03-27 12:23:42 -07:00
}
2013-04-09 11:38:58 -07:00
html += '<div class="mediaInfoStream">' ;
2013-03-26 16:57:18 -07:00
2013-05-15 20:39:15 -07:00
html += '<span class="mediaInfoStreamType">' + type + ':</span>' ;
2013-04-09 19:28:24 -07:00
2013-05-15 20:39:15 -07:00
var attributes = [ ] ;
2013-04-09 19:28:24 -07:00
2013-04-09 11:38:58 -07:00
if ( stream . Codec ) {
2013-05-15 20:39:15 -07:00
attributes . push ( '<span class="mediaInfoAttribute">' + stream . Codec + '</span>' ) ;
2013-04-09 11:38:58 -07:00
}
if ( stream . Profile ) {
2013-05-15 20:39:15 -07:00
attributes . push ( '<span class="mediaInfoAttribute">' + stream . Profile + '</span>' ) ;
2013-04-09 11:38:58 -07:00
}
if ( stream . Level ) {
2013-05-15 20:39:15 -07:00
attributes . push ( '<span class="mediaInfoAttribute">Level ' + stream . Level + '</span>' ) ;
2013-04-09 11:38:58 -07:00
}
2013-03-27 12:23:42 -07:00
if ( stream . Language ) {
2013-05-15 20:39:15 -07:00
attributes . push ( '<span class="mediaInfoAttribute">' + stream . Language + '</span>' ) ;
2013-04-09 11:38:58 -07:00
}
2013-05-15 20:39:15 -07:00
2013-04-09 11:38:58 -07:00
if ( stream . Width ) {
2013-05-15 20:39:15 -07:00
attributes . push ( '<span class="mediaInfoAttribute">' + stream . Width + '</span>' ) ;
2013-04-09 11:38:58 -07:00
}
2013-05-15 20:39:15 -07:00
2013-04-09 11:38:58 -07:00
if ( stream . Height ) {
2013-05-15 20:39:15 -07:00
attributes . push ( '<span class="mediaInfoAttribute">' + stream . Height + '</span>' ) ;
2013-04-09 11:38:58 -07:00
}
2013-05-15 20:39:15 -07:00
2013-04-09 11:38:58 -07:00
if ( stream . AspectRatio ) {
2013-05-15 20:39:15 -07:00
attributes . push ( '<span class="mediaInfoAttribute">' + stream . AspectRatio + '</span>' ) ;
2013-04-09 11:38:58 -07:00
}
2013-05-15 20:39:15 -07:00
2013-04-18 09:12:07 -07:00
if ( stream . BitRate ) {
2013-05-15 20:39:15 -07:00
attributes . push ( '<span class="mediaInfoAttribute">' + ( parseInt ( stream . BitRate / 1000 ) ) + ' kbps</span>' ) ;
2013-03-26 22:36:41 -07:00
}
2013-05-15 20:39:15 -07:00
2013-03-26 22:36:41 -07:00
if ( stream . Channels ) {
2013-05-15 20:39:15 -07:00
attributes . push ( '<span class="mediaInfoAttribute">' + stream . Channels + ' ch</span>' ) ;
2013-03-26 16:57:18 -07:00
}
2013-05-15 20:39:15 -07:00
2013-04-09 12:38:19 -07:00
if ( stream . SampleRate ) {
2013-05-15 20:39:15 -07:00
attributes . push ( '<span class="mediaInfoAttribute">' + stream . SampleRate + ' khz</span>' ) ;
2013-04-09 12:38:19 -07:00
}
2013-04-09 11:38:58 -07:00
var framerate = stream . AverageFrameRate || stream . RealFrameRate ;
2013-04-09 19:28:24 -07:00
2013-04-09 11:38:58 -07:00
if ( framerate ) {
2013-05-15 20:39:15 -07:00
attributes . push ( '<span class="mediaInfoAttribute">' + framerate + '</span>' ) ;
2013-04-09 11:38:58 -07:00
}
2013-04-09 19:28:24 -07:00
2013-04-09 12:38:19 -07:00
if ( stream . PixelFormat ) {
2013-05-15 20:39:15 -07:00
attributes . push ( '<span class="mediaInfoAttribute">' + stream . PixelFormat + '</span>' ) ;
2013-04-09 12:38:19 -07:00
}
2013-05-15 20:39:15 -07:00
if ( stream . IsDefault ) {
attributes . push ( '<span class="mediaInfoAttribute">Default</span>' ) ;
2013-04-09 11:38:58 -07:00
}
2013-05-15 20:39:15 -07:00
if ( stream . IsForced ) {
attributes . push ( '<span class="mediaInfoAttribute">Forced</span>' ) ;
}
if ( stream . IsExternal ) {
attributes . push ( '<span class="mediaInfoAttribute">External</span>' ) ;
2013-03-26 16:57:18 -07:00
}
2013-05-15 20:39:15 -07:00
html += attributes . join ( ' • ' ) ;
2013-03-26 22:36:41 -07:00
2013-04-09 11:38:58 -07:00
html += '</div>' ;
2013-02-20 18:33:05 -07:00
}
2013-03-26 16:57:18 -07:00
$ ( '#mediaInfoContent' , page ) . html ( html ) . trigger ( 'create' ) ;
2013-04-10 14:14:25 -07:00
}
2013-03-26 11:51:52 -07:00
2013-05-11 23:05:51 -07:00
function getVideosHtml ( items , limit , moreButtonClass ) {
2013-04-28 10:21:56 -07:00
2013-03-26 11:51:52 -07:00
var html = '' ;
2013-04-28 10:21:56 -07:00
for ( var i = 0 , length = items . length ; i < length ; i ++ ) {
2013-03-26 11:51:52 -07:00
2013-05-11 23:05:51 -07:00
if ( limit && i >= limit ) {
break ;
}
2013-04-28 10:21:56 -07:00
var item = items [ i ] ;
2013-03-26 11:51:52 -07:00
2013-05-11 23:05:51 -07:00
var cssClass = "posterItem smallBackdropPosterItem" ;
2013-07-29 12:12:21 -07:00
var href = "itemdetails.html?id=" + item . Id ;
html += '<a class="' + cssClass + '" href="' + href + '" onclick="MediaPlayer.playById(\'' + item . Id + '\'); return false;">' ;
2013-03-26 11:51:52 -07:00
2013-04-28 10:21:56 -07:00
var imageTags = item . ImageTags || { } ;
2013-03-26 11:51:52 -07:00
2013-04-28 10:39:16 -07:00
var imgUrl ;
2013-04-28 10:21:56 -07:00
if ( imageTags . Primary ) {
2013-03-29 07:12:14 -07:00
2013-04-28 10:39:16 -07:00
imgUrl = ApiClient . getImageUrl ( item . Id , {
2013-04-28 10:21:56 -07:00
maxwidth : 500 ,
tag : imageTags . Primary ,
type : "primary"
} ) ;
2013-03-26 11:51:52 -07:00
2013-04-28 10:21:56 -07:00
} else {
2013-04-28 10:39:16 -07:00
imgUrl = "css/images/items/detail/video.png" ;
2013-04-28 10:21:56 -07:00
}
2013-03-26 11:51:52 -07:00
2013-04-28 10:39:16 -07:00
html += '<div class="posterItemImage" style="background-image:url(\'' + imgUrl + '\');"></div>' ;
html += '<div class="posterItemText">' + item . Name + '</div>' ;
html += '<div class="posterItemText">' ;
2013-03-26 11:51:52 -07:00
2013-04-28 10:21:56 -07:00
if ( item . RunTimeTicks != "" ) {
2013-06-07 10:29:33 -07:00
html += Dashboard . getDisplayTime ( item . RunTimeTicks ) ;
2013-04-28 10:21:56 -07:00
}
else {
html += " " ;
}
html += '</div>' ;
2013-03-26 11:51:52 -07:00
2013-04-28 10:21:56 -07:00
html += '</a>' ;
2013-03-26 11:51:52 -07:00
2013-04-28 10:21:56 -07:00
}
2013-03-26 11:51:52 -07:00
2013-05-11 23:05:51 -07:00
if ( limit && items . length > limit ) {
html += '<p style="margin: .5em 0 0;padding-left: .5em;"><button class="' + moreButtonClass + '" data-inline="true" data-mini="true">More ...</button></p>' ;
}
2013-04-28 10:21:56 -07:00
return html ;
}
2013-05-11 23:05:51 -07:00
function renderSpecials ( page , item , limit ) {
2013-04-28 10:21:56 -07:00
ApiClient . getSpecialFeatures ( Dashboard . getCurrentUserId ( ) , item . Id ) . done ( function ( specials ) {
2013-03-26 11:51:52 -07:00
2013-05-11 23:05:51 -07:00
$ ( '#specialsContent' , page ) . html ( getVideosHtml ( specials , limit , "moreSpecials" ) ) . trigger ( 'create' ) ;
2013-03-26 11:51:52 -07:00
} ) ;
2013-04-10 14:14:25 -07:00
}
2013-03-26 11:51:52 -07:00
2013-04-10 14:14:25 -07:00
function renderTrailers ( page , item ) {
2013-03-26 11:51:52 -07:00
2013-08-23 19:53:30 -07:00
var remoteTrailersHtml = '' ;
2013-03-26 11:51:52 -07:00
2013-08-23 19:53:30 -07:00
for ( var i = 0 , length = item . RemoteTrailers . length ; i < length ; i ++ ) {
2013-03-26 11:51:52 -07:00
2013-08-23 19:53:30 -07:00
var trailer = item . RemoteTrailers [ i ] ;
var id = getParameterByName ( 'v' , trailer . Url ) ;
if ( id ) {
2013-08-23 20:47:13 -07:00
remoteTrailersHtml += '<iframe class="posterItem smallBackdropPosterItem" style="margin:0 3px;position:relative;top:9px;width:auto;" src="//www.youtube.com/embed/' + id + '" frameborder="0" allowfullscreen></iframe>' ;
2013-08-23 19:53:30 -07:00
}
}
var elem = $ ( '#trailersContent' , page ) . html ( remoteTrailersHtml ) ;
if ( item . LocalTrailerCount ) {
ApiClient . getLocalTrailers ( Dashboard . getCurrentUserId ( ) , item . Id ) . done ( function ( trailers ) {
elem . prepend ( getVideosHtml ( trailers ) ) ;
} ) ;
}
2013-04-10 14:14:25 -07:00
}
2013-03-26 22:20:46 -07:00
2013-05-11 23:05:51 -07:00
function renderCast ( page , item , context , limit ) {
2013-03-26 22:20:46 -07:00
var html = '' ;
2013-04-10 14:14:25 -07:00
2013-04-14 13:47:09 -07:00
var casts = item . People || [ ] ;
2013-03-26 22:20:46 -07:00
for ( var i = 0 , length = casts . length ; i < length ; i ++ ) {
2013-05-11 23:05:51 -07:00
if ( limit && i >= limit ) {
break ;
}
2013-04-22 07:44:11 -07:00
var cast = casts [ i ] ;
2013-03-26 22:20:46 -07:00
2013-05-11 23:05:51 -07:00
html += '<a class="tileItem smallPosterTileItem" href="itembynamedetails.html?context=' + context + '&person=' + ApiClient . encodeName ( cast . Name ) + '">' ;
var imgUrl ;
if ( cast . PrimaryImageTag ) {
imgUrl = ApiClient . getPersonImageUrl ( cast . Name , {
width : 130 ,
tag : cast . PrimaryImageTag ,
type : "primary"
} ) ;
} else {
imgUrl = "css/images/items/list/person.png" ;
}
html += '<div class="tileImage" style="background-image:url(\'' + imgUrl + '\');"></div>' ;
html += '<div class="tileContent">' ;
html += '<p>' + cast . Name + '</p>' ;
var role = cast . Role ? "as " + cast . Role : cast . Type ;
2013-05-19 10:35:00 -07:00
2013-05-18 10:07:20 -07:00
if ( role == "GuestStar" ) {
role = "Guest star" ;
}
2013-05-11 23:05:51 -07:00
2013-05-21 18:52:06 -07:00
role = role || "" ;
var maxlength = 40 ;
if ( role . length > maxlength ) {
role = role . substring ( 0 , maxlength - 3 ) + '...' ;
}
html += '<p>' + role + '</p>' ;
2013-05-11 23:05:51 -07:00
html += '</div>' ;
html += '</a>' ;
2013-03-26 22:20:46 -07:00
}
2013-05-11 23:05:51 -07:00
if ( limit && casts . length > limit ) {
html += '<p style="margin: .5em 0 0;padding-left: .5em;"><button class="morePeople" data-inline="true" data-mini="true">More ...</button></p>' ;
}
$ ( '#castContent' , page ) . html ( html ) . trigger ( 'create' ) ;
2013-04-10 14:14:25 -07:00
}
2013-04-14 08:14:10 -07:00
2013-04-10 14:14:25 -07:00
function play ( startPosition ) {
2013-03-28 22:51:45 -07:00
2013-04-10 14:14:25 -07:00
MediaPlayer . play ( [ currentItem ] , startPosition ) ;
}
2013-03-28 22:51:45 -07:00
2013-04-10 14:14:25 -07:00
$ ( document ) . on ( 'pageinit' , "#itemDetailPage" , function ( ) {
2013-03-29 07:12:14 -07:00
2013-04-10 14:14:25 -07:00
var page = this ;
2013-04-04 10:27:36 -07:00
2013-04-10 14:14:25 -07:00
$ ( '#btnPlay' , page ) . on ( 'click' , function ( ) {
var userdata = currentItem . UserData || { } ;
2013-08-08 07:53:25 -07:00
var mediaType = currentItem . MediaType ;
2013-08-23 19:53:30 -07:00
2013-08-08 07:53:25 -07:00
if ( currentItem . Type == "MusicArtist" || currentItem . Type == "MusicAlbum" ) {
mediaType = "Audio" ;
}
2013-08-23 19:53:30 -07:00
2013-08-08 07:53:25 -07:00
LibraryBrowser . showPlayMenu ( this , currentItem . Id , currentItem . Type , mediaType , userdata . PlaybackPositionTicks ) ;
2013-04-14 08:14:10 -07:00
} ) ;
2013-04-10 22:42:34 -07:00
2013-05-04 14:20:27 -07:00
$ ( '#btnEdit' , page ) . on ( 'click' , function ( ) {
2013-05-22 09:52:22 -07:00
Dashboard . navigate ( "edititemmetadata.html?id=" + currentItem . Id ) ;
2013-05-04 14:20:27 -07:00
} ) ;
2013-05-28 18:45:39 -07:00
$ ( '#btnRemote' , page ) . on ( 'click' , function ( ) {
2013-07-11 13:25:12 -07:00
RemoteControl . showMenuForItem ( {
2013-06-04 09:48:23 -07:00
2013-05-30 12:58:07 -07:00
item : currentItem ,
context : getContext ( currentItem ) ,
2013-06-04 09:48:23 -07:00
2013-05-30 12:58:07 -07:00
themeSongs : $ ( '#themeSongsCollapsible:visible' , page ) . length > 0 ,
themeVideos : $ ( '#themeVideosCollapsible:visible' , page ) . length > 0
} ) ;
2013-05-28 18:45:39 -07:00
} ) ;
2013-04-10 14:14:25 -07:00
} ) . on ( 'pageshow' , "#itemDetailPage" , function ( ) {
2013-03-28 22:51:45 -07:00
2013-04-10 14:14:25 -07:00
var page = this ;
2013-03-28 22:51:45 -07:00
2013-05-11 23:05:51 -07:00
$ ( page ) . on ( "click.moreScenes" , ".moreScenes" , function ( ) {
renderScenes ( page , currentItem ) ;
} ) . on ( "click.morePeople" , ".morePeople" , function ( ) {
renderCast ( page , currentItem , getContext ( currentItem ) ) ;
} ) . on ( "click.moreSpecials" , ".moreSpecials" , function ( ) {
renderSpecials ( page , currentItem ) ;
} ) . on ( "click.moreCriticReviews" , ".moreCriticReviews" , function ( ) {
renderCriticReviews ( page , currentItem ) ;
} ) ;
2013-04-10 14:14:25 -07:00
reload ( page ) ;
2013-03-28 22:51:45 -07:00
2013-04-10 14:14:25 -07:00
} ) . on ( 'pagehide' , "#itemDetailPage" , function ( ) {
2013-04-01 13:26:13 -07:00
2013-04-10 14:14:25 -07:00
currentItem = null ;
2013-05-11 23:05:51 -07:00
var page = this ;
$ ( page ) . off ( "click.moreScenes" ) . off ( "click.morePeople" ) . off ( "click.moreSpecials" ) . off ( "click.moreCriticReviews" ) ;
2013-04-10 14:14:25 -07:00
} ) ;
2013-04-14 08:14:10 -07:00
2013-04-10 14:14:25 -07:00
function itemDetailPage ( ) {
2013-04-01 13:26:13 -07:00
2013-04-10 14:14:25 -07:00
var self = this ;
2013-04-01 13:26:13 -07:00
2013-04-10 14:14:25 -07:00
self . play = play ;
2013-04-09 11:38:58 -07:00
}
2013-03-28 22:51:45 -07:00
2013-04-10 14:14:25 -07:00
window . ItemDetailPage = new itemDetailPage ( ) ;
2013-02-20 18:33:05 -07:00
2013-04-10 14:14:25 -07:00
} ) ( jQuery , document , LibraryBrowser , window ) ;