From b3257e78b6eb2786cb73974ba870f0381a0dd092 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Tue, 13 Mar 2018 16:45:40 +0100 Subject: [PATCH] Added Etterna beatmap support --- jobs/sync-anime/sync-anime.go | 7 ------- pages/soundtrack/soundtrack.pixy | 11 ++++++++--- patches/show-season/show-season.go | 2 +- scripts/Actions/Theme.ts | 12 ++++++++---- scripts/AnimeNotifier.ts | 2 +- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/jobs/sync-anime/sync-anime.go b/jobs/sync-anime/sync-anime.go index b4dcbb5a..7a3bed05 100644 --- a/jobs/sync-anime/sync-anime.go +++ b/jobs/sync-anime/sync-anime.go @@ -107,13 +107,6 @@ func sync(data *kitsu.Anime) *arn.Anime { } } - // NSFW - if attr.Nsfw { - anime.NSFW = 1 - } else { - anime.NSFW = 0 - } - // Rating if anime.Rating == nil { anime.Rating = &arn.AnimeRating{} diff --git a/pages/soundtrack/soundtrack.pixy b/pages/soundtrack/soundtrack.pixy index 5e9d2020..f1f7178d 100644 --- a/pages/soundtrack/soundtrack.pixy +++ b/pages/soundtrack/soundtrack.pixy @@ -28,13 +28,18 @@ component SoundTrackPage(track *arn.SoundTrack, user *arn.User) a.soundtrack-anime-list-item.ajax(href=anime.Link(), title=anime.Title.ByUser(user)) img.soundtrack-anime-list-item-image.lazy(data-src=anime.Image("small"), data-webp="true", alt=anime.Title.ByUser(user)) - if len(track.Beatmaps()) > 0 + //- TODO: This is quite ineffective, performance-wise + if len(track.OsuBeatmaps()) > 0 || len(track.EtternaBeatmaps()) > 0 .widget.mountable h3.widget-title Beatmaps ul.beatmaps - for index, beatmap := range track.Beatmaps() + for index, beatmap := range track.OsuBeatmaps() li - a.beatmap(href="https://osu.ppy.sh/s/" + beatmap, target="_blank")= "Beatmap #" + strconv.Itoa(index + 1) + a.beatmap(href="https://osu.ppy.sh/s/" + beatmap, target="_blank")= "Osu Beatmap #" + strconv.Itoa(index + 1) + + for index, beatmap := range track.EtternaBeatmaps() + li + a.beatmap(href="https://etternaonline.com/song/view/" + beatmap, target="_blank")= "Etterna Beatmap #" + strconv.Itoa(index + 1) .widget.mountable h3.widget-title Tags diff --git a/patches/show-season/show-season.go b/patches/show-season/show-season.go index db4891be..5e4a63e3 100644 --- a/patches/show-season/show-season.go +++ b/patches/show-season/show-season.go @@ -11,7 +11,7 @@ func main() { list := []*arn.Anime{} for anime := range arn.StreamAnime() { - if anime.NSFW == 1 || anime.Status != "current" || anime.Type != "tv" || anime.StartDate == "" || anime.StartDate < "2017-12" || anime.StartDate > "2018-02-01" { + if anime.Status != "current" || anime.Type != "tv" || anime.StartDate == "" || anime.StartDate < "2017-12" || anime.StartDate > "2018-02-01" { continue } diff --git a/scripts/Actions/Theme.ts b/scripts/Actions/Theme.ts index 2dc7b17c..7f9b72dd 100644 --- a/scripts/Actions/Theme.ts +++ b/scripts/Actions/Theme.ts @@ -45,16 +45,16 @@ let dark = { // Toggle theme export function toggleTheme(arn: AnimeNotifier) { if(currentTheme === "light") { - darkTheme() + darkTheme(arn) arn.statusMessage.showInfo("Previewing Dark theme. If you would like to use it permanently, please buy a PRO account.", 4000) return } - lightTheme() + lightTheme(arn) } // Light theme -export function lightTheme() { +export function lightTheme(arn: AnimeNotifier) { let root = document.documentElement for(let property in light) { @@ -69,9 +69,13 @@ export function lightTheme() { } // Dark theme -export function darkTheme() { +export function darkTheme(arn: AnimeNotifier) { let root = document.documentElement + if(arn.user.dataset.pro !== "true") { + alert("You need a PRO account!") + } + for(let property in dark) { if(!dark.hasOwnProperty(property)) { continue diff --git a/scripts/AnimeNotifier.ts b/scripts/AnimeNotifier.ts index 1399e291..b9c83db9 100644 --- a/scripts/AnimeNotifier.ts +++ b/scripts/AnimeNotifier.ts @@ -122,7 +122,7 @@ export class AnimeNotifier { // Theme if(this.user && this.user.dataset.pro === "true" && this.user.dataset.theme !== "light") { - darkTheme() + darkTheme(this) } // Status message