all repos — honk @ c6b448ddd6d8b08c5095902e9c51439cfb0f5608

my fork of honk

experiment with sass like css replacement
Ted Unangst tedu@tedunangst.com
Wed, 04 Sep 2019 13:19:52 -0400
commit

c6b448ddd6d8b08c5095902e9c51439cfb0f5608

parent

1f3864b61572332414e3bbdd432c3358170c9493

5 files changed, 45 insertions(+), 31 deletions(-)

jump to
M go.modgo.mod

@@ -7,5 +7,5 @@ github.com/mattn/go-runewidth v0.0.4

golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4 golang.org/x/net v0.0.0-20190620200207-3b0461eec859 humungus.tedunangst.com/r/go-sqlite3 v1.1.3 - humungus.tedunangst.com/r/webs v0.6.4 + humungus.tedunangst.com/r/webs v0.6.5 )
M go.sumgo.sum

@@ -27,3 +27,5 @@ humungus.tedunangst.com/r/webs v0.6.3 h1:WoN32ETiAgSfOSonxj47cZmspdbmdTNbwlvVDmEDR+I=

humungus.tedunangst.com/r/webs v0.6.3/go.mod h1:Ho+nmafD/aUWF7LnH+Yl2/b0ob7f2pCkXm4onteWvLE= humungus.tedunangst.com/r/webs v0.6.4 h1:J/zuFH8lTCtXTG0H3u8saVO7pfvykAu9KptXg1BoD5M= humungus.tedunangst.com/r/webs v0.6.4/go.mod h1:Ho+nmafD/aUWF7LnH+Yl2/b0ob7f2pCkXm4onteWvLE= +humungus.tedunangst.com/r/webs v0.6.5 h1:5XOwH9sPeIEVn5t3a2Pvs1/2Ywt3xtjG1G3+6OEXkDY= +humungus.tedunangst.com/r/webs v0.6.5/go.mod h1:Ho+nmafD/aUWF7LnH+Yl2/b0ob7f2pCkXm4onteWvLE=
M honk.gohonk.go

@@ -22,6 +22,7 @@ "fmt"

"html" "html/template" "io" + "io/ioutil" "log" notrand "math/rand" "net/http"

@@ -33,6 +34,7 @@ "strings"

"time" "github.com/gorilla/mux" + "humungus.tedunangst.com/r/webs/css" "humungus.tedunangst.com/r/webs/htfilter" "humungus.tedunangst.com/r/webs/httpsig" "humungus.tedunangst.com/r/webs/image"

@@ -1618,8 +1620,11 @@ w.Write(a)

} func servecss(w http.ResponseWriter, r *http.Request) { + data, _ := ioutil.ReadFile("views" + r.URL.Path) + s := css.Process(string(data)) w.Header().Set("Cache-Control", "max-age=7776000") - http.ServeFile(w, r, "views"+r.URL.Path) + w.Header().Set("Content-Type", "text/css; charset=utf-8") + w.Write([]byte(s)) } func servehtml(w http.ResponseWriter, r *http.Request) { templinfo := getInfo(r)
M hoot.gohoot.go

@@ -74,6 +74,7 @@

wanted := "" var buf strings.Builder + filt := htfilter.New() fmt.Fprintf(&buf, "%s\n", url) for _, div := range divs { twp := div.Parent.Parent.Parent

@@ -95,7 +96,7 @@ }

if author != wanted { continue } - text := htfilter.TextOnly(div) + text := filt.TextOnly(div) text = strings.Replace(text, "\n", " ", -1) text = strings.Replace(text, "pic.twitter.com", "https://pic.twitter.com", -1)
M views/style.cssviews/style.css

@@ -1,6 +1,12 @@

+$bg-page: #305; +$bg-dark: #002; +$fg: #dde; +$fg-subtle: #aab; +$fg-limited: #a79; + body { - background: #305; - color: #dde; + background: $bg-page; + color: $fg; font-size: 1em; word-wrap: break-word; font-family: sans-serif, "Noto Color Emoji";

@@ -11,7 +17,7 @@ }

blockquote { margin-left: 0em; padding-left: 0.5em; - border-left: 1px solid #aab; + border-left: 1px solid $fg-subtle; } table { display: block;

@@ -19,7 +25,7 @@ max-width: 100%;

overflow-x: auto; } a { - color: #dde; + color: $fg; } form, input, textarea { font-family: monospace, "Noto Color Emoji";

@@ -29,8 +35,8 @@ margin-top 1em;

margin-bottom: 1em; } input { - background: #305; - color: #dde; + background: $bg-page; + color: $fg; font-size: 1.0em; line-height: 1.2em; padding: 0.5em;

@@ -56,8 +62,8 @@ margin: auto;

font-size: 1.5em; } .info { - background: #002; - border: 1px solid #dde; + background: $bg-dark; + border: 1px solid $fg; margin-bottom: 1em; padding: 0em 1em 0em 1em; }

@@ -68,9 +74,9 @@ }

label, button, form input[type=submit], select { font-size: 16px; font-family: monospace; - color: #dde; - background: #305; - border: 1px solid #dde; + color: $fg; + background: $bg-page; + border: 1px solid $fg; padding: 0.5em; } button a {

@@ -82,8 +88,8 @@ }

textarea { padding: 0.5em; font-size: 1em; - background: #305; - color: #dde; + background: $bg-page; + color: $fg; width: 600px; height: 8em; margin-bottom: 0.5em;

@@ -101,7 +107,7 @@ input[type="checkbox"]:checked + span:after {

content: "yes"; } input[type="checkbox"]:focus + span:after { - outline: 1px solid #dde; + outline: 1px solid $fg; } input[type=file] { display: none;

@@ -110,8 +116,8 @@

.honk { width: 90%; margin: auto; - background: #002; - border: 1px solid #dde; + background: $bg-dark; + border: 1px solid $fg; border-radius: 1em; margin-bottom: 1em; padding-left: 1em;

@@ -121,14 +127,14 @@ overflow: hidden;

} .honk #honkform { padding: 1em; - border: 1px solid #dde; + border: 1px solid $fg; } .honk a { - color: #dde; + color: $fg; } .honk header .clip a { - color: #88a; + color: $fg-subtle; } .honk header { white-space: nowrap;

@@ -154,21 +160,21 @@ }

.subtle { } .subtle .noise { - color: #aab; + color: $fg-subtle; font-size: 0.8em; } .subtle .noise a { - color: #aab; + color: $fg-subtle; } .limited { - border: 1px solid #a79; - color: #a79; + border: 1px solid fg-limited; + color: fg-limited; } .limited .noise { - color: #a79; + color: fg-limited; } .limited .noise a { - color: #a79; + color: fg-limited; } details.noise[open] summary { display: none;

@@ -179,10 +185,10 @@ }

.inlineform select { } .honk details.actions summary { - color: #aab; + color: $fg-subtle; } .limited details.actions summary { - color: #a79; + color: fg-limited; } h1, h2 { font-size: 1.2em;

@@ -192,7 +198,7 @@ font-size: 1.1em;

} img:not(.emu) { - background: #305; + background: $bg-page; } img, video { max-width: 100%