Introduction
Introduction Statistics Contact Development Disclaimer Help
vods layout: autofocus search field, use f as format parameter - twitch-go - tw…
git clone git://git.codemadness.org/twitch-go
Log
Files
Refs
README
LICENSE
---
commit 4d831a39ecffe51c5e64ac72a1f9a8ce832a5314
parent ce4781ef15eb2330b793db45629d223a7e294b98
Author: Hiltjo Posthuma <[email protected]>
Date: Sat, 6 Apr 2019 20:39:05 +0200
vods layout: autofocus search field, use f as format parameter
Diffstat:
M data/templates/pages/vods.html | 4 ++--
M main.go | 7 ++++---
2 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/data/templates/pages/vods.html b/data/templates/pages/vods.html
@@ -5,7 +5,7 @@
{{if .Search}}
-<p><a href="?n={{.Search}}&amp;format=atom">Atom feed</a></p>
+<p><a href="?n={{.Search}}&amp;f=atom">Atom feed</a></p>
<table class="table" border="0">
<thead>
@@ -31,7 +31,7 @@
{{else}}
<form method="get" action="">
- <input type="search" name="n" value="" placeholder="Login name..." />
+ <input type="search" name="n" value="" placeholder="Login name..." aut…
<input type="submit" name="list" value="List vods" />
</form>
diff --git a/main.go b/main.go
@@ -218,7 +218,7 @@ func VODSHandler(w http.ResponseWriter, r *http.Request) er…
var users *twitch.Users
var videos *twitch.Videos
- format := r.FormValue("format")
+ format := r.FormValue("f")
name := r.FormValue("n")
v := struct {
@@ -250,11 +250,12 @@ func VODSHandler(w http.ResponseWriter, r *http.Request) …
v.Videos = videos.Items
}
- if format == "atom" {
+ switch format {
+ case "atom":
w.Header().Set("Content-Type", "text/xml; charset=utf-8")
fmt.Fprintf(w, `<?xml version="1.0" encoding="UTF-8"?>`+"\n")
return templates.Render(w, "vods.xml", "atom.xml", v)
- } else {
+ default:
return templates.Render(w, "vods.html", "page.html", v)
}
}
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.