summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Hurst <julian.hurst92@gmail.com>2020-10-14 20:36:53 +0200
committerJulian Hurst <julian.hurst92@gmail.com>2020-10-14 20:36:53 +0200
commite670f9d19f658055e169b6d7c3ae57ddc11c3eee (patch)
tree01fa0c8c89d3a847a5ce2e629a5ee7fa8c5264b8
parent8891eea532102b58a23a71a491be2c3f151720b5 (diff)
downloadgrimtube-e670f9d19f658055e169b6d7c3ae57ddc11c3eee.tar.gz
Add embed and halloween theme
-rw-r--r--grimtube.go11
-rw-r--r--static/style-halloween.css56
-rw-r--r--static/style.css10
-rw-r--r--templates/embed.html4
-rw-r--r--templates/search.html5
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>