Slowly moving away from stylus to scarlet
This commit is contained in:
parent
105cf0d128
commit
adb6ca1e0c
@ -7,6 +7,7 @@
|
|||||||
"styles": [
|
"styles": [
|
||||||
"reset",
|
"reset",
|
||||||
"font-awesome",
|
"font-awesome",
|
||||||
|
"config",
|
||||||
"base",
|
"base",
|
||||||
"elements",
|
"elements",
|
||||||
"layout",
|
"layout",
|
||||||
|
@ -1,24 +1,17 @@
|
|||||||
package jobs
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"github.com/animenotifier/arn"
|
"github.com/animenotifier/arn"
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AiringAnimeCache ...
|
|
||||||
type AiringAnimeCache struct {
|
|
||||||
Anime []*arn.Anime `json:"anime"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// AiringAnimeCacheSmall ...
|
|
||||||
type AiringAnimeCacheSmall struct {
|
|
||||||
Anime []*arn.AnimeSmall `json:"anime"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// AiringAnime ...
|
// AiringAnime ...
|
||||||
func AiringAnime() {
|
func AiringAnime() {
|
||||||
|
fmt.Println("Running background job: Airing Anime")
|
||||||
|
|
||||||
animeList, err := arn.GetAiringAnime()
|
animeList, err := arn.GetAiringAnime()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -41,7 +34,7 @@ func AiringAnime() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
saveErr := arn.SetObject("Cache", "airingAnime", &AiringAnimeCacheSmall{
|
saveErr := arn.SetObject("Cache", "airingAnime", &arn.AiringAnimeCacheSmall{
|
||||||
Anime: animeListSmall,
|
Anime: animeListSmall,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
18
jobs/main.go
Normal file
18
jobs/main.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// Background jobs
|
||||||
|
go func() {
|
||||||
|
for {
|
||||||
|
AiringAnime()
|
||||||
|
time.Sleep(time.Duration(2) * time.Second)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
// Main loop
|
||||||
|
for {
|
||||||
|
time.Sleep(time.Duration(10) * time.Second)
|
||||||
|
}
|
||||||
|
}
|
23
main.go
23
main.go
@ -5,9 +5,7 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/aerogo/aero"
|
"github.com/aerogo/aero"
|
||||||
"github.com/animenotifier/arn"
|
|
||||||
"github.com/animenotifier/notify.moe/components"
|
"github.com/animenotifier/notify.moe/components"
|
||||||
"github.com/animenotifier/notify.moe/jobs"
|
|
||||||
"github.com/animenotifier/notify.moe/pages/airing"
|
"github.com/animenotifier/notify.moe/pages/airing"
|
||||||
"github.com/animenotifier/notify.moe/pages/anime"
|
"github.com/animenotifier/notify.moe/pages/anime"
|
||||||
"github.com/animenotifier/notify.moe/pages/dashboard"
|
"github.com/animenotifier/notify.moe/pages/dashboard"
|
||||||
@ -24,7 +22,7 @@ import (
|
|||||||
var app = aero.New()
|
var app = aero.New()
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app.SetStyle(components.BundledCSS)
|
app.SetStyle(components.CSS())
|
||||||
|
|
||||||
// app.Sessions = sessions.New(sessions.Config{
|
// app.Sessions = sessions.New(sessions.Config{
|
||||||
// Cookie: "sid",
|
// Cookie: "sid",
|
||||||
@ -34,16 +32,11 @@ func main() {
|
|||||||
// DisableSubdomainPersistence: false,
|
// DisableSubdomainPersistence: false,
|
||||||
// })
|
// })
|
||||||
|
|
||||||
app.Sessions.Store = aero.NewMemoryStore()
|
// user, _ := arn.GetUserByNick("Akyoto")
|
||||||
|
// user.CoverImage.URL = "https://www.pixelstalk.net/wp-content/uploads/2016/10/Hanyijie-sky-scenery-ship-anime-art-1920x1080.jpg"
|
||||||
user, _ := arn.GetUserByNick("Akyoto")
|
// user.CoverImage.Position.X = "50%"
|
||||||
user.CoverImage.URL = "https://www.pixelstalk.net/wp-content/uploads/2016/10/Hanyijie-sky-scenery-ship-anime-art-1920x1080.jpg"
|
// user.CoverImage.Position.Y = "0%"
|
||||||
user.CoverImage.Position.X = "50%"
|
// user.Save()
|
||||||
user.CoverImage.Position.Y = "0%"
|
|
||||||
user.Save()
|
|
||||||
|
|
||||||
// Background jobs
|
|
||||||
go jobs.AiringAnime()
|
|
||||||
|
|
||||||
scripts, _ := ioutil.ReadFile("temp/scripts.js")
|
scripts, _ := ioutil.ReadFile("temp/scripts.js")
|
||||||
js := string(scripts)
|
js := string(scripts)
|
||||||
@ -78,5 +71,9 @@ func main() {
|
|||||||
app.Ajax("/user/:nick", profile.Get)
|
app.Ajax("/user/:nick", profile.Get)
|
||||||
app.Ajax("/airing", airing.Get)
|
app.Ajax("/airing", airing.Get)
|
||||||
|
|
||||||
|
app.Ajax("/test", func(ctx *aero.Context) string {
|
||||||
|
return ctx.HTML(components.Test("Hello World"))
|
||||||
|
})
|
||||||
|
|
||||||
app.Run()
|
app.Run()
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,11 @@ import (
|
|||||||
"github.com/aerogo/aero"
|
"github.com/aerogo/aero"
|
||||||
"github.com/animenotifier/arn"
|
"github.com/animenotifier/arn"
|
||||||
"github.com/animenotifier/notify.moe/components"
|
"github.com/animenotifier/notify.moe/components"
|
||||||
"github.com/animenotifier/notify.moe/jobs"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Get ...
|
// Get ...
|
||||||
func Get(ctx *aero.Context) string {
|
func Get(ctx *aero.Context) string {
|
||||||
airingAnimeCache := new(jobs.AiringAnimeCache)
|
airingAnimeCache := new(arn.AiringAnimeCache)
|
||||||
err := arn.GetObject("Cache", "airingAnime", airingAnimeCache)
|
err := arn.GetObject("Cache", "airingAnime", airingAnimeCache)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -12,7 +12,7 @@ func Get(ctx *aero.Context) string {
|
|||||||
genre, err := arn.GetGenre(genreName)
|
genre, err := arn.GetGenre(genreName)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err.Error()
|
return ctx.Error(404, "Genre not found", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctx.HTML(components.Genre(genre))
|
return ctx.HTML(components.Genre(genre))
|
||||||
|
2
pages/test.pixy
Normal file
2
pages/test.pixy
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
component Test(msg string)
|
||||||
|
h1= msg
|
1
styles/config.scarlet
Normal file
1
styles/config.scarlet
Normal file
@ -0,0 +1 @@
|
|||||||
|
fade-speed = 290ms
|
7
styles/fade.scarlet
Normal file
7
styles/fade.scarlet
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
.fade
|
||||||
|
opacity 1
|
||||||
|
transition opacity fade-speed ease
|
||||||
|
will-change opacity
|
||||||
|
|
||||||
|
.fade-out
|
||||||
|
opacity 0
|
46
styles/reset.scarlet
Normal file
46
styles/reset.scarlet
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video, main
|
||||||
|
outline 0
|
||||||
|
border 0
|
||||||
|
font-size 100%
|
||||||
|
font inherit
|
||||||
|
vertical-align baseline
|
||||||
|
background transparent
|
||||||
|
|
||||||
|
html
|
||||||
|
box-sizing border-box
|
||||||
|
|
||||||
|
textarea
|
||||||
|
resize vertical
|
||||||
|
|
||||||
|
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section
|
||||||
|
display block
|
||||||
|
|
||||||
|
body
|
||||||
|
line-height 1
|
||||||
|
-webkit-font-smoothing antialiased
|
||||||
|
-moz-osx-font-smoothing grayscale
|
||||||
|
|
||||||
|
ol, ul
|
||||||
|
list-style none
|
||||||
|
|
||||||
|
blockquote, q
|
||||||
|
quotes none
|
||||||
|
|
||||||
|
blockquote:before, blockquote:after, q:before, q:after
|
||||||
|
content ''
|
||||||
|
content none
|
||||||
|
|
||||||
|
table
|
||||||
|
border-collapse collapse
|
||||||
|
border-spacing 0
|
||||||
|
|
||||||
|
audio, canvas, img, video, input, select
|
||||||
|
vertical-align middle
|
||||||
|
|
||||||
|
:focus
|
||||||
|
outline 0
|
||||||
|
|
||||||
|
*
|
||||||
|
margin 0
|
||||||
|
padding 0
|
||||||
|
box-sizing inherit
|
Loading…
Reference in New Issue
Block a user