From 770f5bae5f07ee3ecaddbf7f23dfab0e392152bb Mon Sep 17 00:00:00 2001 From: Scott Date: Sat, 30 Jun 2018 13:02:30 +0200 Subject: [PATCH] Display latest anime trailer on an anime page. --- pages/anime/anime.pixy | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pages/anime/anime.pixy b/pages/anime/anime.pixy index 559782b9..96d8aa4d 100644 --- a/pages/anime/anime.pixy +++ b/pages/anime/anime.pixy @@ -150,11 +150,14 @@ component AnimeGenres(anime *arn.Anime) span= genre component AnimeTrailer(anime *arn.Anime) - if len(anime.Trailers) > 0 && anime.Trailers[0].Service == "Youtube" && anime.Trailers[0].ServiceID != "" - section.anime-section.mountable - h3.anime-section-name Trailer - .anime-trailer.video-container - iframe.video(src="https://www.youtube.com/embed/" + anime.Trailers[0].ServiceID + "?showinfo=0", allowfullscreen="allowfullscreen") + if len(anime.Trailers) > 0 && anime.Trailers[len(anime.Trailers) - 1].Service == "Youtube" && anime.Trailers[len(anime.Trailers) - 1].ServiceID != "" + AnimeTrailerByIndex(anime, len(anime.Trailers)-1) + +component AnimeTrailerByIndex(anime *arn.Anime, index int) + section.anime-section.mountable + h3.anime-section-name Trailer + .anime-trailer.video-container + iframe.video(src="https://www.youtube.com/embed/" + anime.Trailers[index].ServiceID + "?showinfo=0", allowfullscreen="allowfullscreen") component AnimeFriends(friends []*arn.User, listItems map[*arn.User]*arn.AnimeListItem) if len(friends) > 0