diff options
| -rw-r--r-- | grimtube.go | 11 | ||||
| -rw-r--r-- | static/style-halloween.css | 56 | ||||
| -rw-r--r-- | static/style.css | 10 | ||||
| -rw-r--r-- | templates/embed.html | 4 | ||||
| -rw-r--r-- | templates/search.html | 5 |
5 files changed, 84 insertions, 2 deletions
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"}} + <iframe width="100%" height="100%" src="https://www.youtube-nocookie.com/embed/{{.}}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> +{{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}} <tr> <td> - <a href="{{.Url}}"><img width=120 src="{{.Thumb}}"></a> + <a href="/embed?id={{.Id}}"><img width=120 src="{{.Thumb}}"></a> </td> <td> - <a href="{{.Url}}"><span>{{.Title}}</span></a> + <a href="/embed?id={{.Id}}"><span>{{.Title}}</span></a><br/> + <a href="{{.Url}}"><span class="comments">Comments</span></a> </td> <td> <a href="{{.ChannelUrl}}"><span>{{.ChannelTitle}}</span></a> |
