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
|
.sound-tracks
|
||||||
each track in tracks
|
each track in tracks
|
||||||
SoundTrack(track)
|
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
|
|
@ -1,10 +1,20 @@
|
|||||||
component NewSoundTrack(user *arn.User)
|
component NewSoundTrack(user *arn.User)
|
||||||
.widgets
|
.widgets
|
||||||
.widget
|
.widget
|
||||||
input#soundcloud-link.widget-element(type="text", placeholder="Soundcloud link")
|
h3 New soundtrack
|
||||||
input#anime-link.widget-element(type="text", placeholder="Anime link")
|
label(for="soundcloud-link") Soundcloud link:
|
||||||
input#osu-link.widget-element(type="text", placeholder="Osu beatmap link (optional)")
|
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")
|
.buttons
|
||||||
Icon("check")
|
button.action(data-action="createSoundTrack", data-trigger="click")
|
||||||
span Add soundtrack
|
Icon("check")
|
||||||
|
span Add soundtrack
|
@ -106,11 +106,13 @@ export function createThread(arn: AnimeNotifier) {
|
|||||||
// Create soundtrack
|
// Create soundtrack
|
||||||
export function createSoundTrack(arn: AnimeNotifier, button: HTMLButtonElement) {
|
export function createSoundTrack(arn: AnimeNotifier, button: HTMLButtonElement) {
|
||||||
let soundcloud = arn.app.find("soundcloud-link") as HTMLInputElement
|
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 anime = arn.app.find("anime-link") as HTMLInputElement
|
||||||
let osu = arn.app.find("osu-link") as HTMLInputElement
|
let osu = arn.app.find("osu-link") as HTMLInputElement
|
||||||
|
|
||||||
let soundtrack = {
|
let soundtrack = {
|
||||||
soundcloud: soundcloud.value,
|
soundcloud: soundcloud.value,
|
||||||
|
youtube: youtube.value,
|
||||||
tags: [anime.value, osu.value],
|
tags: [anime.value, osu.value],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
tests.go
1
tests.go
@ -121,6 +121,7 @@ var tests = map[string][]string{
|
|||||||
"/auth/google": nil,
|
"/auth/google": nil,
|
||||||
"/auth/google/callback": nil,
|
"/auth/google/callback": nil,
|
||||||
"/new/thread": nil,
|
"/new/thread": nil,
|
||||||
|
"/new/soundtrack": nil,
|
||||||
"/user": nil,
|
"/user": nil,
|
||||||
"/settings": nil,
|
"/settings": nil,
|
||||||
"/extension/embed": nil,
|
"/extension/embed": nil,
|
||||||
|
Loading…
Reference in New Issue
Block a user