From 6bc77b8dc512439de8106b526e8daa2da08a9e9b Mon Sep 17 00:00:00 2001 From: Janne Koschinski <janne@kuschku.de> Date: Thu, 24 May 2018 18:12:19 +0200 Subject: [PATCH] More statistics --- .gitignore | 3 ++- assets/sass/style.sass | 29 +++++++++++++++++++++++++++++ main.go | 6 +----- templates/statistics.html | 3 +-- 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index f8570a4..4be66ce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /.idea/ /vendor/ -/node_modules/ \ No newline at end of file +/node_modules/ +/assets/css/ \ No newline at end of file diff --git a/assets/sass/style.sass b/assets/sass/style.sass index e69de29..26b7cee 100644 --- a/assets/sass/style.sass +++ b/assets/sass/style.sass @@ -0,0 +1,29 @@ +* + font-family: Verdana, Arial, sans-serif + +body + display: flex + flex-direction: column + align-items: center + +table + max-width: 720px + width: 100% + border-collapse: collapse + th + background: rgba(52, 68, 84, 1.0) + color: #ffffff + tr + background: rgba(52, 68, 84, 0.2) + font-size: 13px + &:nth-child(2n) + background: rgba(52, 68, 84, 0.1) + &.small-followup + tbody + background: rgba(52, 68, 84, 0.2) + tr + background: none + tr:not(:first-child) + font-size: 10px + &:nth-child(2n) + background: rgba(52, 68, 84, 0.1) \ No newline at end of file diff --git a/main.go b/main.go index dfa5fdc..e28d42e 100644 --- a/main.go +++ b/main.go @@ -112,7 +112,7 @@ func main() { panic(err) } - assets := http.FileServer(http.Dir("assets")) + http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir("assets")))) http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { _, channel := path.Split(r.URL.Path) if strings.HasPrefix(channel, "#") { @@ -193,10 +193,6 @@ func main() { handleError(err) return } - } else { - w.Header().Set("Vary", "Accept-Encoding") - w.Header().Set("Cache-Control", "public, max-age=31536000") - assets.ServeHTTP(w, r) } }) diff --git a/templates/statistics.html b/templates/statistics.html index a4945aa..ce1c33f 100644 --- a/templates/statistics.html +++ b/templates/statistics.html @@ -20,7 +20,6 @@ <meta name="apple-mobile-web-app-status-bar-style" content="#FFC107"> <link href="/assets/css/style.css" rel="stylesheet"> -<p>Total: {{.Lines}} Lines, {{.Words}} Words, {{printf "%.1f" .WordsPerLine}} Words per Line</p> <table> <thead> @@ -48,7 +47,7 @@ </tbody> </table> -<table> +<table class="small-followup"> <thead> <tr> <th>Big numbers</th> -- GitLab