New anime images
This commit is contained in:
parent
ac7c78242f
commit
4558939bff
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/animenotifier/arn"
|
"github.com/animenotifier/arn"
|
||||||
@ -53,10 +54,7 @@ func sync(data *kitsu.Anime) *arn.Anime {
|
|||||||
anime.Title.English = attr.Titles.En
|
anime.Title.English = attr.Titles.En
|
||||||
anime.Title.Romaji = attr.Titles.EnJp
|
anime.Title.Romaji = attr.Titles.EnJp
|
||||||
anime.Title.Synonyms = attr.AbbreviatedTitles
|
anime.Title.Synonyms = attr.AbbreviatedTitles
|
||||||
anime.Image.Tiny = kitsu.FixImageURL(attr.PosterImage.Tiny)
|
anime.ImageExtension = filepath.Ext(kitsu.FixImageURL(attr.PosterImage.Original))
|
||||||
anime.Image.Small = kitsu.FixImageURL(attr.PosterImage.Small)
|
|
||||||
anime.Image.Large = kitsu.FixImageURL(attr.PosterImage.Large)
|
|
||||||
anime.Image.Original = kitsu.FixImageURL(attr.PosterImage.Original)
|
|
||||||
anime.StartDate = attr.StartDate
|
anime.StartDate = attr.StartDate
|
||||||
anime.EndDate = attr.EndDate
|
anime.EndDate = attr.EndDate
|
||||||
anime.EpisodeCount = attr.EpisodeCount
|
anime.EpisodeCount = attr.EpisodeCount
|
||||||
|
@ -2,4 +2,4 @@ component AnimeGrid(animeList []*arn.Anime)
|
|||||||
.anime-grid
|
.anime-grid
|
||||||
each anime in animeList
|
each anime in animeList
|
||||||
a.anime-grid-cell.ajax(href="/anime/" + toString(anime.ID))
|
a.anime-grid-cell.ajax(href="/anime/" + toString(anime.ID))
|
||||||
img.anime-grid-image.lazy(data-src=anime.Image.Small, alt=anime.Title.Romaji, title=anime.Title.Romaji)
|
img.anime-grid-image.lazy(data-src=anime.Image("medium"), alt=anime.Title.Romaji, title=anime.Title.Romaji)
|
@ -94,7 +94,7 @@ func Get(ctx *aero.Context) string {
|
|||||||
openGraph := &arn.OpenGraph{
|
openGraph := &arn.OpenGraph{
|
||||||
Tags: map[string]string{
|
Tags: map[string]string{
|
||||||
"og:title": anime.Title.Canonical,
|
"og:title": anime.Title.Canonical,
|
||||||
"og:image": anime.Image.Large,
|
"og:image": anime.Image("large"),
|
||||||
"og:url": "https://" + ctx.App.Config.Domain + anime.Link(),
|
"og:url": "https://" + ctx.App.Config.Domain + anime.Link(),
|
||||||
"og:site_name": "notify.moe",
|
"og:site_name": "notify.moe",
|
||||||
"og:description": description,
|
"og:description": description,
|
||||||
|
@ -7,17 +7,16 @@ component Anime(anime *arn.Anime, tracks []*arn.SoundTrack, episodes []*arn.Anim
|
|||||||
|
|
||||||
component AnimeMainColumn(anime *arn.Anime, tracks []*arn.SoundTrack, episodes []*arn.AnimeEpisode, user *arn.User)
|
component AnimeMainColumn(anime *arn.Anime, tracks []*arn.SoundTrack, episodes []*arn.AnimeEpisode, user *arn.User)
|
||||||
.anime-header(data-id=anime.ID)
|
.anime-header(data-id=anime.ID)
|
||||||
if anime.Image.Large != ""
|
.anime-image-container.mountable
|
||||||
.anime-image-container.mountable
|
img.anime-cover-image.lazy(data-src=anime.Image("large"), data-webp="true", alt=anime.Title.ByUser(user))
|
||||||
img.anime-cover-image(src=anime.Image.Large, alt=anime.Title.ByUser(user))
|
|
||||||
|
//- if anime.StartDate != ""
|
||||||
|
//- .anime-start-date
|
||||||
|
//- span(title="Start date: " + anime.StartDate)= anime.StartDate[:4]
|
||||||
|
//- if anime.EndDate != "" && anime.StartDate[:4] != anime.EndDate[:4]
|
||||||
|
//- span -
|
||||||
|
//- span(title="End date: " + anime.EndDate)= anime.EndDate[:4]
|
||||||
|
|
||||||
//- if anime.StartDate != ""
|
|
||||||
//- .anime-start-date
|
|
||||||
//- span(title="Start date: " + anime.StartDate)= anime.StartDate[:4]
|
|
||||||
//- if anime.EndDate != "" && anime.StartDate[:4] != anime.EndDate[:4]
|
|
||||||
//- span -
|
|
||||||
//- span(title="End date: " + anime.EndDate)= anime.EndDate[:4]
|
|
||||||
|
|
||||||
.space
|
.space
|
||||||
|
|
||||||
.anime-info
|
.anime-info
|
||||||
@ -28,14 +27,14 @@ component AnimeMainColumn(anime *arn.Anime, tracks []*arn.SoundTrack, episodes [
|
|||||||
|
|
||||||
//- h3.anime-section-name.anime-summary-header Summary
|
//- h3.anime-section-name.anime-summary-header Summary
|
||||||
p.anime-summary.mountable= anime.Summary
|
p.anime-summary.mountable= anime.Summary
|
||||||
|
|
||||||
AnimeActions(anime, user)
|
AnimeActions(anime, user)
|
||||||
|
|
||||||
AnimeCharacters(anime)
|
AnimeCharacters(anime)
|
||||||
AnimeRelations(anime, user)
|
AnimeRelations(anime, user)
|
||||||
AnimeTracks(anime, tracks)
|
AnimeTracks(anime, tracks)
|
||||||
AnimeEpisodes(episodes)
|
AnimeEpisodes(episodes)
|
||||||
|
|
||||||
//- //- h3.anime-section-name Reviews
|
//- //- h3.anime-section-name Reviews
|
||||||
//- //- p Coming soon.
|
//- //- p Coming soon.
|
||||||
|
|
||||||
@ -114,7 +113,7 @@ component AnimePopularity(anime *arn.Anime)
|
|||||||
tr.mountable(data-mountable-type="info")
|
tr.mountable(data-mountable-type="info")
|
||||||
td.anime-info-key Completed:
|
td.anime-info-key Completed:
|
||||||
td.anime-info-value= anime.Popularity.Completed
|
td.anime-info-value= anime.Popularity.Completed
|
||||||
|
|
||||||
if anime.Popularity.Planned > 0
|
if anime.Popularity.Planned > 0
|
||||||
tr.mountable(data-mountable-type="info")
|
tr.mountable(data-mountable-type="info")
|
||||||
td.anime-info-key Planned:
|
td.anime-info-key Planned:
|
||||||
@ -137,7 +136,7 @@ component AnimeLinks(anime *arn.Anime)
|
|||||||
a.light-button(href="https://kitsu.io/anime/" + anime.ID, target="_blank", rel="noopener")
|
a.light-button(href="https://kitsu.io/anime/" + anime.ID, target="_blank", rel="noopener")
|
||||||
Icon("external-link")
|
Icon("external-link")
|
||||||
span Kitsu
|
span Kitsu
|
||||||
|
|
||||||
each mapping in anime.Mappings
|
each mapping in anime.Mappings
|
||||||
a.light-button(href=mapping.Link(), target="_blank", rel="noopener")
|
a.light-button(href=mapping.Link(), target="_blank", rel="noopener")
|
||||||
Icon("external-link")
|
Icon("external-link")
|
||||||
@ -167,7 +166,7 @@ component AnimeFriends(friends []*arn.User, listItems map[*arn.User]*arn.AnimeLi
|
|||||||
if len(friends) > 0
|
if len(friends) > 0
|
||||||
section.anime-section.mountable
|
section.anime-section.mountable
|
||||||
h3.anime-section-name Friends
|
h3.anime-section-name Friends
|
||||||
|
|
||||||
.anime-friends
|
.anime-friends
|
||||||
.user-avatars
|
.user-avatars
|
||||||
each friend in friends
|
each friend in friends
|
||||||
@ -200,7 +199,7 @@ component AnimeInformation(anime *arn.Anime)
|
|||||||
tr.mountable(data-mountable-type="info")
|
tr.mountable(data-mountable-type="info")
|
||||||
td.anime-info-key Status:
|
td.anime-info-key Status:
|
||||||
td.anime-info-value= anime.StatusHumanReadable()
|
td.anime-info-value= anime.StatusHumanReadable()
|
||||||
|
|
||||||
if anime.StartDate == anime.EndDate && anime.StartDate != "" && anime.EndDate != ""
|
if anime.StartDate == anime.EndDate && anime.StartDate != "" && anime.EndDate != ""
|
||||||
if anime.StartDate != ""
|
if anime.StartDate != ""
|
||||||
tr.mountable(data-mountable-type="info")
|
tr.mountable(data-mountable-type="info")
|
||||||
|
@ -14,23 +14,23 @@ component CompareAnimeList(a *arn.User, b *arn.User, countA int, countB int, com
|
|||||||
th.comparison
|
th.comparison
|
||||||
Avatar(b)
|
Avatar(b)
|
||||||
th.comparison
|
th.comparison
|
||||||
|
|
||||||
tbody
|
tbody
|
||||||
each comparison in comparisons
|
each comparison in comparisons
|
||||||
tr.anime-list-item.mountable
|
tr.anime-list-item.mountable
|
||||||
td.anime-list-item-image-container
|
td.anime-list-item-image-container
|
||||||
a.ajax(href=comparison.Anime.Link())
|
a.ajax(href=comparison.Anime.Link())
|
||||||
img.anime-list-item-image.lazy(data-src=comparison.Anime.Image.Tiny, alt=comparison.Anime.Title.ByUser(user))
|
img.anime-list-item-image.lazy(data-src=comparison.Anime.Image("small"), alt=comparison.Anime.Title.ByUser(user))
|
||||||
|
|
||||||
td.anime-list-item-name
|
td.anime-list-item-name
|
||||||
a.ajax(href=comparison.Anime.Link())= comparison.Anime.Title.ByUser(user)
|
a.ajax(href=comparison.Anime.Link())= comparison.Anime.Title.ByUser(user)
|
||||||
|
|
||||||
td.comparison
|
td.comparison
|
||||||
if comparison.ItemA != nil
|
if comparison.ItemA != nil
|
||||||
span= comparison.ItemA.Status
|
span= comparison.ItemA.Status
|
||||||
else
|
else
|
||||||
span -
|
span -
|
||||||
|
|
||||||
td.comparison
|
td.comparison
|
||||||
if comparison.ItemA != nil
|
if comparison.ItemA != nil
|
||||||
if comparison.ItemA.Rating.Overall != 0
|
if comparison.ItemA.Rating.Overall != 0
|
||||||
@ -42,13 +42,13 @@ component CompareAnimeList(a *arn.User, b *arn.User, countA int, countB int, com
|
|||||||
span -
|
span -
|
||||||
else
|
else
|
||||||
span -
|
span -
|
||||||
|
|
||||||
td.comparison
|
td.comparison
|
||||||
if comparison.ItemB != nil
|
if comparison.ItemB != nil
|
||||||
span= comparison.ItemB.Status
|
span= comparison.ItemB.Status
|
||||||
else
|
else
|
||||||
span -
|
span -
|
||||||
|
|
||||||
td.comparison
|
td.comparison
|
||||||
if comparison.ItemB != nil
|
if comparison.ItemB != nil
|
||||||
if comparison.ItemB.Rating.Overall != 0
|
if comparison.ItemB.Rating.Overall != 0
|
||||||
|
@ -6,20 +6,20 @@ component SearchResults(term string, users []*arn.User, animes []*arn.Anime, pos
|
|||||||
h3.widget-title
|
h3.widget-title
|
||||||
Icon("tv")
|
Icon("tv")
|
||||||
span Anime
|
span Anime
|
||||||
|
|
||||||
.profile-watching-list.anime-search
|
.profile-watching-list.anime-search
|
||||||
if len(animes) == 0
|
if len(animes) == 0
|
||||||
p.no-search-results.mountable No anime found.
|
p.no-search-results.mountable No anime found.
|
||||||
else
|
else
|
||||||
each anime in animes
|
each anime in animes
|
||||||
a.profile-watching-list-item.mountable.ajax(href=anime.Link(), title=anime.Title.Canonical, data-mountable-type="anime")
|
a.profile-watching-list-item.mountable.ajax(href=anime.Link(), title=anime.Title.Canonical, data-mountable-type="anime")
|
||||||
img.anime-cover-image.anime-search-result(src=anime.Image.Tiny, alt=anime.Title.Canonical)
|
img.anime-cover-image.anime-search-result(src=anime.Image("small"), alt=anime.Title.Canonical)
|
||||||
|
|
||||||
.widget
|
.widget
|
||||||
h3.widget-title
|
h3.widget-title
|
||||||
Icon("comment")
|
Icon("comment")
|
||||||
span Forum
|
span Forum
|
||||||
|
|
||||||
if len(posts) == 0 && len(threads) == 0
|
if len(posts) == 0 && len(threads) == 0
|
||||||
p.no-search-results.mountable No posts found.
|
p.no-search-results.mountable No posts found.
|
||||||
else
|
else
|
||||||
@ -30,7 +30,7 @@ component SearchResults(term string, users []*arn.User, animes []*arn.Anime, pos
|
|||||||
if thread.Author().HasNick()
|
if thread.Author().HasNick()
|
||||||
.forum-search-result-author= thread.Author().Nick
|
.forum-search-result-author= thread.Author().Nick
|
||||||
.forum-search-result-sample= thread.Text
|
.forum-search-result-sample= thread.Text
|
||||||
|
|
||||||
each post in posts
|
each post in posts
|
||||||
.mountable(data-mountable-type="forum")
|
.mountable(data-mountable-type="forum")
|
||||||
.forum-search-result
|
.forum-search-result
|
||||||
@ -38,12 +38,12 @@ component SearchResults(term string, users []*arn.User, animes []*arn.Anime, pos
|
|||||||
if post.Author().HasNick()
|
if post.Author().HasNick()
|
||||||
.forum-search-result-author= post.Author().Nick
|
.forum-search-result-author= post.Author().Nick
|
||||||
.forum-search-result-sample= post.Text
|
.forum-search-result-sample= post.Text
|
||||||
|
|
||||||
.widget
|
.widget
|
||||||
h3.widget-title
|
h3.widget-title
|
||||||
Icon("music")
|
Icon("music")
|
||||||
span Soundtracks
|
span Soundtracks
|
||||||
|
|
||||||
if len(tracks) == 0
|
if len(tracks) == 0
|
||||||
p.no-search-results.mountable No soundtracks found.
|
p.no-search-results.mountable No soundtracks found.
|
||||||
else
|
else
|
||||||
@ -56,7 +56,7 @@ component SearchResults(term string, users []*arn.User, animes []*arn.Anime, pos
|
|||||||
h3.widget-title
|
h3.widget-title
|
||||||
Icon("user")
|
Icon("user")
|
||||||
span Users
|
span Users
|
||||||
|
|
||||||
.user-avatars.user-search
|
.user-avatars.user-search
|
||||||
if len(users) == 0
|
if len(users) == 0
|
||||||
p.no-search-results.mountable No users found.
|
p.no-search-results.mountable No users found.
|
||||||
|
@ -20,7 +20,7 @@ component Track(track *arn.SoundTrack, user *arn.User)
|
|||||||
.sound-track-anime-list
|
.sound-track-anime-list
|
||||||
each anime in track.Anime()
|
each anime in track.Anime()
|
||||||
a.sound-track-anime-list-item.ajax(href=anime.Link(), title=anime.Title.Canonical)
|
a.sound-track-anime-list-item.ajax(href=anime.Link(), title=anime.Title.Canonical)
|
||||||
img.sound-track-anime-list-item-image.lazy(data-src=anime.Image.Tiny, alt=anime.Title.Canonical)
|
img.sound-track-anime-list-item-image.lazy(data-src=anime.Image("small"), alt=anime.Title.Canonical)
|
||||||
|
|
||||||
if len(track.Beatmaps()) > 0
|
if len(track.Beatmaps()) > 0
|
||||||
.widget.mountable
|
.widget.mountable
|
||||||
@ -36,14 +36,14 @@ component Track(track *arn.SoundTrack, user *arn.User)
|
|||||||
.tag= tag
|
.tag= tag
|
||||||
.footer.text-center.mountable
|
.footer.text-center.mountable
|
||||||
if track.EditedBy != ""
|
if track.EditedBy != ""
|
||||||
span Edited
|
span Edited
|
||||||
span.utc-date(data-date=track.Edited)
|
span.utc-date(data-date=track.Edited)
|
||||||
span by
|
span by
|
||||||
span= track.EditedByUser().Nick
|
span= track.EditedByUser().Nick
|
||||||
else
|
else
|
||||||
span Posted
|
span Posted
|
||||||
span.utc-date(data-date=track.Created)
|
span.utc-date(data-date=track.Created)
|
||||||
span by
|
span by
|
||||||
span= track.Creator().Nick
|
span= track.Creator().Nick
|
||||||
|
|
||||||
span .
|
span .
|
||||||
|
@ -464,14 +464,25 @@ export class AnimeNotifier {
|
|||||||
lazyLoadImage(element: HTMLImageElement) {
|
lazyLoadImage(element: HTMLImageElement) {
|
||||||
// Once the image becomes visible, load it
|
// Once the image becomes visible, load it
|
||||||
element["became visible"] = () => {
|
element["became visible"] = () => {
|
||||||
|
let dataSrc = element.dataset.src
|
||||||
|
let dot = dataSrc.lastIndexOf(".")
|
||||||
|
let base = dataSrc.substring(0, dot)
|
||||||
|
let extension = ""
|
||||||
|
|
||||||
// Replace URL with WebP if supported
|
// Replace URL with WebP if supported
|
||||||
if(this.webpEnabled && element.dataset.webp) {
|
if(this.webpEnabled && element.dataset.webp) {
|
||||||
let dot = element.dataset.src.lastIndexOf(".")
|
extension = ".webp"
|
||||||
element.src = element.dataset.src.substring(0, dot) + ".webp"
|
|
||||||
} else {
|
} else {
|
||||||
element.src = element.dataset.src
|
extension = dataSrc.substring(dot)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Anime images on Retina displays
|
||||||
|
if(base.includes("/anime/") && window.devicePixelRatio >= 2) {
|
||||||
|
base += "@2"
|
||||||
|
}
|
||||||
|
|
||||||
|
element.src = base + extension
|
||||||
|
|
||||||
if(element.naturalWidth === 0) {
|
if(element.naturalWidth === 0) {
|
||||||
element.onload = () => {
|
element.onload = () => {
|
||||||
this.elementFound.queue(element)
|
this.elementFound.queue(element)
|
||||||
|
Loading…
Reference in New Issue
Block a user