Merge branch 'go' into show_latest_anime_trailer

This commit is contained in:
Eduard Urbach 2018-06-30 20:11:25 +09:00 committed by GitHub
commit 0f2780396d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 64 additions and 56 deletions

View File

@ -27,6 +27,12 @@ curl -s https://raw.githubusercontent.com/animenotifier/notify.moe/go/install.sh
* If you restart your operating system, run `make ports` to update your port bindings
## Author
| [![Eduard Urbach on Twitter](https://gravatar.com/avatar/16ed4d41a5f244d1b10de1b791657989?s=70)](https://twitter.com/eduardurbach "Follow @eduardurbach on Twitter") |
|---|
| [Eduard Urbach](https://eduardurbach.com) |
[godoc-image]: https://godoc.org/github.com/animenotifier/notify.moe?status.svg
[godoc-url]: https://godoc.org/github.com/animenotifier/notify.moe
[goreportcard-image]: https://goreportcard.com/badge/github.com/animenotifier/notify.moe

View File

@ -60,7 +60,7 @@ func testPackage(pkg string) {
Title: pkg,
Message: "Test failed",
Link: "https://" + pkg,
Icon: "https://notify.moe/images/brand/220.png",
Icon: "https://media.notify.moe/images/brand/220.png",
Type: arn.NotificationTypePackageTest,
})
return

View File

@ -7,18 +7,18 @@ component Anime(anime *arn.Anime, listItem *arn.AnimeListItem, tracks []*arn.Sou
component AnimeMainColumn(anime *arn.Anime, listItem *arn.AnimeListItem, tracks []*arn.SoundTrack, amvs []*arn.AMV, amvAppearances []*arn.AMV, episodes []*arn.AnimeEpisode, user *arn.User)
.anime-header(data-id=anime.ID)
a.anime-image-container.mountable(href=anime.ImageLink("original"), target="_blank")
a.anime-image-container.mountable(href=anime.ImageLink("original"), target="_blank", data-mountable-type="header")
img.anime-cover-image.lazy(data-src=anime.ImageLink("large"), data-webp="true", data-color=anime.AverageColor(), alt=anime.Title.ByUser(user))
.space
.anime-info
h1.anime-title.mountable(title=anime.Type)= anime.Title.ByUser(user)
h1.anime-title.mountable(title=anime.Type, data-mountable-type="header")= anime.Title.ByUser(user)
h2.anime-alternative-title.mountable
h2.anime-alternative-title.mountable(data-mountable-type="header")
Japanese(anime.Title.Japanese)
p.anime-summary.mountable= anime.Summary
p.anime-summary.mountable(data-mountable-type="header")= anime.Summary
.anime-summary-footer-container
.anime-summary-footer
@ -43,26 +43,26 @@ component AnimeActions(anime *arn.Anime, listItem *arn.AnimeListItem, user *arn.
if user != nil
.buttons.anime-actions
if user.Role == "editor" || user.Role == "admin"
a.button.mountable(href=anime.Link() + "/edit", data-mountable-type="footer")
a.button.mountable(href=anime.Link() + "/edit", data-mountable-type="header")
Icon("pencil-square-o")
span Edit anime
if listItem != nil
a.button.mountable(href="/+" + user.Nick + "/animelist/anime/" + anime.ID, data-mountable-type="footer")
a.button.mountable(href="/+" + user.Nick + "/animelist/anime/" + anime.ID, data-mountable-type="header")
Icon("pencil")
span= listItem.StatusHumanReadable()
else
button.mountable.action(data-api="/api/animelist/" + user.ID, data-action="addAnimeToCollection", data-trigger="click", data-anime-id=anime.ID, data-mountable-type="footer")
button.mountable.action(data-api="/api/animelist/" + user.ID, data-action="addAnimeToCollection", data-trigger="click", data-anime-id=anime.ID, data-mountable-type="header")
Icon("plus")
span Add to collection
component AnimeRatings(anime *arn.Anime, user *arn.User)
section.anime-section.mountable
section.anime-section.mountable(data-mountable-type="sidebar")
h3.anime-section-name Ratings
table.anime-info-table
tbody
tr.mountable(data-mountable-type="info")
tr.mountable(data-mountable-type="ratings")
td.anime-info-key
if anime.Status == "upcoming"
span Hype:
@ -72,56 +72,56 @@ component AnimeRatings(anime *arn.Anime, user *arn.User)
Rating(anime.Rating.Overall, anime.Rating.Count.Overall, user)
if anime.Rating.Count.Story > 0
tr.mountable(data-mountable-type="info")
tr.mountable(data-mountable-type="ratings")
td.anime-info-key Story:
td.anime-info-value
Rating(anime.Rating.Story, anime.Rating.Count.Story, user)
if anime.Rating.Count.Visuals > 0
tr.mountable(data-mountable-type="info")
tr.mountable(data-mountable-type="ratings")
td.anime-info-key Visuals:
td.anime-info-value
Rating(anime.Rating.Visuals, anime.Rating.Count.Visuals, user)
if anime.Rating.Count.Soundtrack > 0
tr.mountable(data-mountable-type="info")
tr.mountable(data-mountable-type="ratings")
td.anime-info-key Soundtrack:
td.anime-info-value
Rating(anime.Rating.Soundtrack, anime.Rating.Count.Soundtrack, user)
component AnimePopularity(anime *arn.Anime)
if anime.Popularity.Total() > 0
section.anime-section.mountable
section.anime-section.mountable(data-mountable-type="sidebar")
h3.anime-section-name Popularity
table.anime-info-table
if anime.Popularity.Watching > 0
tr.mountable(data-mountable-type="info")
tr.mountable(data-mountable-type="popularity")
td.anime-info-key Watching:
td.anime-info-value= anime.Popularity.Watching
if anime.Popularity.Completed > 0
tr.mountable(data-mountable-type="info")
tr.mountable(data-mountable-type="popularity")
td.anime-info-key Completed:
td.anime-info-value= anime.Popularity.Completed
if anime.Popularity.Planned > 0
tr.mountable(data-mountable-type="info")
tr.mountable(data-mountable-type="popularity")
td.anime-info-key Planned:
td.anime-info-value= anime.Popularity.Planned
if anime.Popularity.Hold > 0
tr.mountable(data-mountable-type="info")
tr.mountable(data-mountable-type="popularity")
td.anime-info-key On hold:
td.anime-info-value= anime.Popularity.Hold
if anime.Popularity.Dropped > 0
tr.mountable(data-mountable-type="info")
tr.mountable(data-mountable-type="popularity")
td.anime-info-key Dropped:
td.anime-info-value= anime.Popularity.Dropped
component AnimeLinks(anime *arn.Anime, user *arn.User)
section.anime-section.mountable
section.anime-section.mountable(data-mountable-type="sidebar")
h3.anime-section-name Links
.light-button-group
@ -146,7 +146,7 @@ component AnimeLinks(anime *arn.Anime, user *arn.User)
component AnimeGenres(anime *arn.Anime)
.anime-genres
each genre in anime.Genres
a.anime-genre.mountable(href="/genre/" + strings.ToLower(genre), data-mountable-type="footer")
a.anime-genre.mountable(href="/genre/" + strings.ToLower(genre), data-mountable-type="header")
span= genre
component AnimeTrailer(anime *arn.Anime)
@ -154,14 +154,14 @@ component AnimeTrailer(anime *arn.Anime)
AnimeTrailerByIndex(anime, len(anime.Trailers)-1)
component AnimeTrailerByIndex(anime *arn.Anime, index int)
section.anime-section.mountable
section.anime-section.mountable(data-mountable-type="sidebar")
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
section.anime-section.mountable
section.anime-section.mountable(data-mountable-type="sidebar")
h3.anime-section-name Friends
.anime-friends
@ -176,7 +176,7 @@ component AnimeFriends(friends []*arn.User, listItems map[*arn.User]*arn.AnimeLi
FriendEntry(friend, listItems)
component AnimeInformation(anime *arn.Anime)
section.anime-section.mountable
section.anime-section.mountable(data-mountable-type="sidebar")
h3.anime-section-name Information
table.anime-info-table
tr.mountable(data-mountable-type="info")

View File

@ -34,7 +34,7 @@ func Get(ctx *aero.Context) string {
weekdayIndex := int(now.Weekday())
// Create days
days := make([]*utils.CalendarDay, 7, 7)
days := make([]*utils.CalendarDay, 7)
for i := 0; i < 7; i++ {
days[i] = &utils.CalendarDay{

View File

@ -9,23 +9,23 @@ component CharacterDetails(character *arn.Character, characterAnime []*arn.Anime
.character-page
.character-left-column
.character-header
.character-image-container.mountable
.character-image-container.mountable(data-mountable-type="header")
img.character-image-large.lazy(data-src=character.ImageLink("large"), data-webp="true", data-color=character.AverageColor(), alt=character.Name.Canonical)
.buttons
LikeButton(strconv.Itoa(len(character.Likes)), "heart", "character", character, user)
if user != nil && (user.Role == "editor" || user.Role == "admin")
a.button.tip.mountable(href=character.Link() + "/edit", aria-label="Edit character")
a.button.tip.mountable(href=character.Link() + "/edit", aria-label="Edit character", data-mountable-type="header")
RawIcon("pencil")
.character-description-container
if character.Name.Canonical == ""
h1.character-name.mountable untitled
h1.character-name.mountable(data-mountable-type="header") untitled
else
h1.character-name.mountable= character.Name.Canonical
h1.character-name.mountable(data-mountable-type="header")= character.Name.Canonical
.anime-alternative-title.mountable
.anime-alternative-title.mountable(data-mountable-type="header")
if character.Name.Japanese != ""
Japanese(character.Name.Japanese)
else
@ -35,7 +35,7 @@ component CharacterDetails(character *arn.Character, characterAnime []*arn.Anime
.character-quotes
Quote(mainQuote, user)
.character-description.mountable!= markdown.Render(character.Description)
.character-description.mountable(data-mountable-type="header")!= markdown.Render(character.Description)
.character-main-column
if len(characterAnime) > 0
@ -61,9 +61,9 @@ component CharacterDetails(character *arn.Character, characterAnime []*arn.Anime
component CharacterSidebar(character *arn.Character, friends []*arn.User, relevantCharacters []*arn.Character, user *arn.User)
.character-sidebar
if len(character.Attributes) > 0
h3.mountable Information
h3.mountable(data-mountable-type="sidebar") Information
table.character-attributes.mountable
table.character-attributes.mountable(data-mountable-type="sidebar")
each attribute in character.Attributes
tr.mountable(data-mountable-type="info")
td.character-attributes-name= attribute.Name + ":"
@ -74,18 +74,18 @@ component CharacterSidebar(character *arn.Character, friends []*arn.User, releva
td.character-attributes-value= attribute.Value
if len(relevantCharacters) > 0
h3.mountable Relevant
h3.mountable(data-mountable-type="sidebar") Relevant
.relevant-characters.mountable
.relevant-characters.mountable(data-mountable-type="sidebar")
each relevantCharacter in relevantCharacters
.mountable(data-mountable-type="relevant-character")
CharacterSmall(relevantCharacter, user)
if len(friends) > 0
.character-friends
h3.mountable Friends
h3.mountable(data-mountable-type="sidebar") Friends
.user-avatars.mountable
.user-avatars.mountable(data-mountable-type="sidebar")
each friend in friends
.mountable(data-mountable-type="friend")
if friend.IsActive()
@ -94,9 +94,9 @@ component CharacterSidebar(character *arn.Character, friends []*arn.User, releva
.inactive-user
Avatar(friend)
h3.mountable Links
h3.mountable(data-mountable-type="sidebar") Links
.light-button-group.mountable
.light-button-group.mountable(data-mountable-type="sidebar")
if character.GetMapping("myanimelist/character") != ""
a.light-button(href="https://myanimelist.net/character/" + character.GetMapping("myanimelist/character"), target="_blank", rel="noopener")
Icon("external-link")

View File

@ -27,9 +27,12 @@ var jobInfo = map[string]*utils.JobInfo{
"mal-parse": &utils.JobInfo{
Name: "mal-parse",
},
// "mal-sync": &utils.JobInfo{
// Name: "mal-sync",
// },
"mal-sync": &utils.JobInfo{
Name: "mal-sync",
},
"test": &utils.JobInfo{
Name: "test",
},
}
var jobLogs = []string{}

View File

@ -6,20 +6,20 @@ component ImportLists(user *arn.User)
label AniList:
.widget-section
a.button.mountable(href="/import/anilist/animelist")
a.button(href="/import/anilist/animelist")
Icon("download")
span Import AniList
if user.Accounts.Kitsu.Nick != ""
label Kitsu:
.widget-section
a.button.mountable(href="/import/kitsu/animelist")
a.button(href="/import/kitsu/animelist")
Icon("download")
span Import Kitsu
if user.Accounts.MyAnimeList.Nick != ""
label MyAnimeList:
.widget-section
a.button.mountable(href="/import/myanimelist/animelist")
a.button(href="/import/myanimelist/animelist")
Icon("download")
span Import MyAnimeList

View File

@ -29,7 +29,7 @@ func GetPostsByUser(ctx *aero.Context) string {
posts = posts[:postLimit]
}
postables = make([]arn.Postable, len(posts), len(posts))
postables = make([]arn.Postable, len(posts))
for i, post := range posts {
postables[i] = arn.ToPostable(post)

View File

@ -23,7 +23,7 @@ func Get(ctx *aero.Context) string {
// Fetch posts
postObjects := arn.DB.GetMany("Post", thread.Posts)
posts := make([]*arn.Post, len(postObjects), len(postObjects))
posts := make([]*arn.Post, len(postObjects))
for i, obj := range postObjects {
posts[i] = obj.(*arn.Post)

View File

@ -2,10 +2,9 @@ component Users(users []*arn.User, url string)
h1.page-title Users
UsersTabs(url)
.user-avatars
.user-avatars.mountable
each user in users
.mountable
Avatar(user)
Avatar(user)
component ProUsers(users []*arn.User, url string)
h1.page-title Supporters

View File

@ -774,7 +774,7 @@ export default class AnimeNotifier {
modifyDelayed(elements: IterableIterator<HTMLElement>, func: (element: HTMLElement) => void) {
const maxDelay = 2500
const delay = 18
const delay = 40
let time = 0
let start = Date.now()
@ -859,8 +859,8 @@ export default class AnimeNotifier {
this.unmountMountables()
this.loading(true)
// Delay by transition-speed
await delay(150)
// Delay by mountable-transition-speed
await delay(250)
let html = await request

View File

@ -143,4 +143,4 @@ const anime-image-large-height = 350px
// Timings
fade-speed = 150ms
transition-speed = 150ms
mountable-transition-speed = 150ms
mountable-transition-speed = 250ms

View File

@ -9,8 +9,8 @@ import (
// Current currency rates
const (
yenToEuro = 0.0075
yenToDollar = 0.0093
yenToEuro = 0.0077
yenToDollar = 0.0090
)
var countryQuery = gountries.New()