Merge pull request #459 from dhartung/more-item-details

Added more details to itemdetails page
This commit is contained in:
Joshua M. Boniface 2019-09-19 11:28:02 -04:00 committed by GitHub
commit 0c337e11a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 89 additions and 16 deletions

View File

@ -235,7 +235,20 @@ define(["loading", "appRouter", "layoutManager", "connectionManager", "cardBuild
var name = itemHelper.getDisplayName(item, {
includeParentInfo: !1
});
html && !parentNameLast ? html += '<h3 class="itemName" style="margin: .25em 0 .5em;">' + name + "</h3>" : html = parentNameLast ? '<h1 class="itemName" style="margin: .1em 0 .25em;">' + name + "</h1>" + html : '<h1 class="itemName" style="margin: .1em 0 .5em;">' + name + "</h1>" + html, container.innerHTML = html, html.length ? container.classList.remove("hide") : container.classList.add("hide")
var offset = parentNameLast ? ".25em" : ".5em";
if (html && !parentNameLast) {
html += '<h3 class="itemName" style="margin: .25em 0 .5em;">' + name + '</h3>';
} else {
html = '<h1 class="itemName" style="margin: .1em 0 ' + offset + ';">' + name + "</h1>" + html;
}
if (item.OriginalTitle && item.OriginalTitle != item.Name) {
html += '<h4 class="itemName" style="margin: -' + offset + ' 0 0">' + item.OriginalTitle + '</h4>';
}
container.innerHTML = html;
html.length ? container.classList.remove("hide") : container.classList.add("hide")
}
function setTrailerButtonVisibility(page, item) {
@ -380,6 +393,18 @@ define(["loading", "appRouter", "layoutManager", "connectionManager", "cardBuild
}
}
function renderUserInfo(page, item) {
var lastPlayedElement = page.querySelector(".itemLastPlayed");
if (item.UserData && item.UserData.LastPlayedDate) {
lastPlayedElement.classList.remove("hide");
var datePlayed = datetime.parseISO8601Date(item.UserData.LastPlayedDate);
lastPlayedElement.innerHTML = globalize.translate("DatePlayed") + " " + datetime.toLocaleDateString(datePlayed) + " " + datetime.getDisplayTime(datePlayed);
} else {
lastPlayedElement.classList.add("hide");
}
}
function renderLinks(linksElem, item) {
var html = [];
if (item.DateCreated && itemHelper.enableDateAddedDisplay(item)) {
@ -531,22 +556,64 @@ define(["loading", "appRouter", "layoutManager", "connectionManager", "cardBuild
}
function renderDetails(page, item, apiClient, context, isStatic) {
renderSimilarItems(page, item, context), renderMoreFromSeason(page, item, apiClient), renderMoreFromArtist(page, item, apiClient), renderDirector(page, item, apiClient, context, isStatic), renderGenres(page, item, apiClient, context, isStatic), renderChannelGuide(page, apiClient, item);
renderSimilarItems(page, item, context);
renderMoreFromSeason(page, item, apiClient);
renderMoreFromArtist(page, item, apiClient);
renderDirector(page, item, apiClient, context, isStatic);
renderGenres(page, item, apiClient, context, isStatic);
renderChannelGuide(page, apiClient, item);
var taglineElement = page.querySelector(".tagline");
item.Taglines && item.Taglines.length ? (taglineElement.classList.remove("hide"), taglineElement.innerHTML = item.Taglines[0]) : taglineElement.classList.add("hide");
var overview = page.querySelector(".overview"),
externalLinksElem = page.querySelector(".itemExternalLinks");
"Season" !== item.Type && "MusicAlbum" !== item.Type && "MusicArtist" !== item.Type || (overview.classList.add("detailsHiddenOnMobile"), externalLinksElem.classList.add("detailsHiddenOnMobile")), renderOverview([overview], item);
var i, length, itemMiscInfo = page.querySelectorAll(".itemMiscInfo-primary");
for (i = 0, length = itemMiscInfo.length; i < length; i++) mediaInfo.fillPrimaryMediaInfo(itemMiscInfo[i], item, {
interactive: !0,
episodeTitle: !1,
subtitles: !1
}), itemMiscInfo[i].innerHTML && "SeriesTimer" !== item.Type ? itemMiscInfo[i].classList.remove("hide") : itemMiscInfo[i].classList.add("hide");
for (itemMiscInfo = page.querySelectorAll(".itemMiscInfo-secondary"), i = 0, length = itemMiscInfo.length; i < length; i++) mediaInfo.fillSecondaryMediaInfo(itemMiscInfo[i], item, {
interactive: !0
}), itemMiscInfo[i].innerHTML ? itemMiscInfo[i].classList.remove("hide") : itemMiscInfo[i].classList.add("hide");
reloadUserDataButtons(page, item), renderLinks(externalLinksElem, item), renderTags(page, item), renderSeriesAirTime(page, item, isStatic)
if (item.Taglines && item.Taglines.length) {
taglineElement.classList.remove("hide");
taglineElement.innerHTML = item.Taglines[0];
} else {
taglineElement.classList.add("hide");
}
var overview = page.querySelector(".overview");
var externalLinksElem = page.querySelector(".itemExternalLinks");
if ("Season" !== item.Type && "MusicAlbum" !== item.Type && "MusicArtist" !== item.Type) {
overview.classList.add("detailsHiddenOnMobile");
externalLinksElem.classList.add("detailsHiddenOnMobile");
}
renderOverview([overview], item);
var i, itemMiscInfo;
itemMiscInfo = page.querySelectorAll(".itemMiscInfo-primary");
for (i = 0; i < itemMiscInfo.length; i++) {
mediaInfo.fillPrimaryMediaInfo(itemMiscInfo[i], item, {
interactive: !0,
episodeTitle: !1,
subtitles: !1
});
if (itemMiscInfo[i].innerHTML && "SeriesTimer" !== item.Type) {
itemMiscInfo[i].classList.remove("hide");
} else {
itemMiscInfo[i].classList.add("hide");
}
}
itemMiscInfo = page.querySelectorAll(".itemMiscInfo-secondary")
for (i = 0; i < itemMiscInfo.length; i++) {
mediaInfo.fillSecondaryMediaInfo(itemMiscInfo[i], item, {
interactive: !0
})
if (itemMiscInfo[i].innerHTML && "SeriesTimer" !== item.Type) {
itemMiscInfo[i].classList.remove("hide");
} else {
itemMiscInfo[i].classList.add("hide");
}
}
reloadUserDataButtons(page, item);
renderLinks(externalLinksElem, item);
renderUserInfo(page, item);
renderTags(page, item);
renderSeriesAirTime(page, item, isStatic)
}
function enableScrollX() {

View File

@ -30,6 +30,10 @@
</div>
<div class="itemMiscInfo nativeName hide">
</div>
<div class="itemMiscInfo itemMiscInfo-primary" style="margin: .7em 0;font-size:92%;">
</div>
@ -191,6 +195,7 @@
</div>
<div class="detailSectionContent">
<div class="itemLastPlayed hide"></div>
<p class="itemGenres"></p>
<h3 class="tagline"></h3>
@ -202,6 +207,7 @@
<div class="itemTags hide" style="margin: .7em 0;font-size:92%;">
</div>
<div class="itemExternalLinks hide" style="margin: .7em 0;font-size:92%;">
</div>