Added Youtube support for sound tracks
This commit is contained in:
parent
c1765a23ea
commit
5099c0b0e7
10
mixins/SoundTrack.pixy
Normal file
10
mixins/SoundTrack.pixy
Normal file
@ -0,0 +1,10 @@
|
||||
component SoundTrack(track *arn.SoundTrack)
|
||||
.sound-track.mountable(id=track.ID)
|
||||
.sound-track-content
|
||||
a.sound-track-anime-link.ajax(href="/anime/" + track.MainAnime().ID)
|
||||
img.sound-track-anime-image.lazy(data-src=track.MainAnime().Image.Small, alt=track.MainAnime().Title.Canonical, title=track.MainAnime().Title.Canonical)
|
||||
|
||||
iframe.lazy(data-src=track.Media[0].EmbedLink())
|
||||
.sound-track-footer
|
||||
span posted by
|
||||
a.ajax(href=track.CreatedByUser().Link())= track.CreatedByUser().Nick
|
@ -8,16 +8,4 @@ component Music(tracks []*arn.SoundTrack)
|
||||
|
||||
.sound-tracks
|
||||
each track in tracks
|
||||
SoundTrack(track)
|
||||
|
||||
component SoundTrack(track *arn.SoundTrack)
|
||||
.sound-track.mountable(id=track.ID)
|
||||
.sound-track-content
|
||||
a.sound-track-anime-link.ajax(href="/anime/" + track.MainAnime().ID)
|
||||
img.sound-track-anime-image.lazy(data-src=track.MainAnime().Image.Small, alt=track.MainAnime().Title.Canonical, title=track.MainAnime().Title.Canonical)
|
||||
|
||||
iframe.lazy(data-src="https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/" + track.Media[0].ServiceID + "?auto_play=false&hide_related=true&show_comments=false&show_user=false&show_reposts=false&visual=true")
|
||||
|
||||
.sound-track-footer
|
||||
span posted by
|
||||
a.ajax(href=track.CreatedByUser().Link())= track.CreatedByUser().Nick
|
||||
SoundTrack(track)
|
@ -1,10 +1,20 @@
|
||||
component NewSoundTrack(user *arn.User)
|
||||
.widgets
|
||||
.widget
|
||||
input#soundcloud-link.widget-element(type="text", placeholder="Soundcloud link")
|
||||
input#anime-link.widget-element(type="text", placeholder="Anime link")
|
||||
input#osu-link.widget-element(type="text", placeholder="Osu beatmap link (optional)")
|
||||
h3 New soundtrack
|
||||
label(for="soundcloud-link") Soundcloud link:
|
||||
input#soundcloud-link.widget-element(type="text", placeholder="https://soundcloud.com/abc/123")
|
||||
|
||||
label(for="youtube-link") Youtube link:
|
||||
input#youtube-link.widget-element(type="text", placeholder="https://www.youtube.com/watch?v=123")
|
||||
|
||||
label(for="anime-link") Anime link:
|
||||
input#anime-link.widget-element(type="text", placeholder="https://notify.moe/anime/123")
|
||||
|
||||
label(for="osu-link") Osu beatmap (optional):
|
||||
input#osu-link.widget-element(type="text", placeholder="https://osu.ppy.sh/s/123")
|
||||
|
||||
button.action(data-action="createSoundTrack", data-trigger="click")
|
||||
Icon("check")
|
||||
span Add soundtrack
|
||||
.buttons
|
||||
button.action(data-action="createSoundTrack", data-trigger="click")
|
||||
Icon("check")
|
||||
span Add soundtrack
|
@ -106,11 +106,13 @@ export function createThread(arn: AnimeNotifier) {
|
||||
// Create soundtrack
|
||||
export function createSoundTrack(arn: AnimeNotifier, button: HTMLButtonElement) {
|
||||
let soundcloud = arn.app.find("soundcloud-link") as HTMLInputElement
|
||||
let youtube = arn.app.find("youtube-link") as HTMLInputElement
|
||||
let anime = arn.app.find("anime-link") as HTMLInputElement
|
||||
let osu = arn.app.find("osu-link") as HTMLInputElement
|
||||
|
||||
let soundtrack = {
|
||||
soundcloud: soundcloud.value,
|
||||
youtube: youtube.value,
|
||||
tags: [anime.value, osu.value],
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user