From e670f9d19f658055e169b6d7c3ae57ddc11c3eee Mon Sep 17 00:00:00 2001 From: Julian Hurst Date: Wed, 14 Oct 2020 20:36:53 +0200 Subject: Add embed and halloween theme --- grimtube.go | 11 +++++++++ static/style-halloween.css | 56 ++++++++++++++++++++++++++++++++++++++++++++++ static/style.css | 10 +++++++++ templates/embed.html | 4 ++++ templates/search.html | 5 +++-- 5 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 static/style-halloween.css create mode 100644 templates/embed.html diff --git a/grimtube.go b/grimtube.go index 6751543..a804f09 100644 --- a/grimtube.go +++ b/grimtube.go @@ -69,11 +69,22 @@ func search(w http.ResponseWriter, r *http.Request) { } } +func embed(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case "GET": + query := r.URL.Query() + id := query.Get("id") + serve(w, "templates/embed.html", id) + default: + } +} + func main() { fs := http.FileServer(http.Dir("static")) http.Handle("/static/", http.StripPrefix("/static/", fs)) http.HandleFunc("/", index) http.HandleFunc("/search", search) + http.HandleFunc("/embed", embed) log.Fatal(http.ListenAndServe(":8080", nil)) diff --git a/static/style-halloween.css b/static/style-halloween.css new file mode 100644 index 0000000..def4dac --- /dev/null +++ b/static/style-halloween.css @@ -0,0 +1,56 @@ +a { + color: orange; +} + +a:hover { + color: darkorange; +} + +li { + list-style-type: none; +} + +body { + margin: 0 auto; + margin-top: 10px; + max-width: 80ex; + background-color: #111; + color: antiquewhite; +} + +table { + border-collapse: collapse; + width: 100%; +} + +tr { + border-bottom: 1px solid #666; + border-top: 1px solid #666; +} + +td { + padding-top: 10px; + padding-bottom: 10px; +} + +form { + margin-bottom: 10px; +} + +input { + width: 100%; +} + +tr:hover { + background-color: #222; +} + +iframe { + position: absolute; + top: 0; + left: 0; +} + +.comments { + font-size: small; +} diff --git a/static/style.css b/static/style.css index 0f92c0b..62ec755 100644 --- a/static/style.css +++ b/static/style.css @@ -34,3 +34,13 @@ form { input { width: 100%; } + +iframe { + position: absolute; + top: 0; + left: 0; +} + +.comments { + font-size: small; +} diff --git a/templates/embed.html b/templates/embed.html new file mode 100644 index 0000000..ff372ab --- /dev/null +++ b/templates/embed.html @@ -0,0 +1,4 @@ +{{define "title"}}Index{{end}} +{{define "content"}} + +{{end}} diff --git a/templates/search.html b/templates/search.html index b921eb6..5ab6f7e 100644 --- a/templates/search.html +++ b/templates/search.html @@ -7,10 +7,11 @@ {{range .Items}} - + - {{.Title}} + {{.Title}}
+ Comments {{.ChannelTitle}} -- cgit v1.2.3