experiment with sass like css replacement
This commit is contained in:
parent
0a1de921e1
commit
6758548d9c
2
go.mod
2
go.mod
|
@ -7,5 +7,5 @@ require (
|
||||||
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4
|
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859
|
||||||
humungus.tedunangst.com/r/go-sqlite3 v1.1.3
|
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
|
||||||
)
|
)
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -27,3 +27,5 @@ humungus.tedunangst.com/r/webs v0.6.3 h1:WoN32ETiAgSfOSonxj47cZmspdbmdTNbwlvVDmE
|
||||||
humungus.tedunangst.com/r/webs v0.6.3/go.mod h1:Ho+nmafD/aUWF7LnH+Yl2/b0ob7f2pCkXm4onteWvLE=
|
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 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.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=
|
||||||
|
|
7
honk.go
7
honk.go
|
@ -22,6 +22,7 @@ import (
|
||||||
"html"
|
"html"
|
||||||
"html/template"
|
"html/template"
|
||||||
"io"
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
notrand "math/rand"
|
notrand "math/rand"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -33,6 +34,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
|
"humungus.tedunangst.com/r/webs/css"
|
||||||
"humungus.tedunangst.com/r/webs/htfilter"
|
"humungus.tedunangst.com/r/webs/htfilter"
|
||||||
"humungus.tedunangst.com/r/webs/httpsig"
|
"humungus.tedunangst.com/r/webs/httpsig"
|
||||||
"humungus.tedunangst.com/r/webs/image"
|
"humungus.tedunangst.com/r/webs/image"
|
||||||
|
@ -1618,8 +1620,11 @@ func avatate(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func servecss(w http.ResponseWriter, r *http.Request) {
|
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")
|
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) {
|
func servehtml(w http.ResponseWriter, r *http.Request) {
|
||||||
templinfo := getInfo(r)
|
templinfo := getInfo(r)
|
||||||
|
|
3
hoot.go
3
hoot.go
|
@ -74,6 +74,7 @@ func hootfixer(r io.Reader, url string) string {
|
||||||
wanted := ""
|
wanted := ""
|
||||||
var buf strings.Builder
|
var buf strings.Builder
|
||||||
|
|
||||||
|
filt := htfilter.New()
|
||||||
fmt.Fprintf(&buf, "%s\n", url)
|
fmt.Fprintf(&buf, "%s\n", url)
|
||||||
for _, div := range divs {
|
for _, div := range divs {
|
||||||
twp := div.Parent.Parent.Parent
|
twp := div.Parent.Parent.Parent
|
||||||
|
@ -95,7 +96,7 @@ func hootfixer(r io.Reader, url string) string {
|
||||||
if author != wanted {
|
if author != wanted {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
text := htfilter.TextOnly(div)
|
text := filt.TextOnly(div)
|
||||||
text = strings.Replace(text, "\n", " ", -1)
|
text = strings.Replace(text, "\n", " ", -1)
|
||||||
text = strings.Replace(text, "pic.twitter.com", "https://pic.twitter.com", -1)
|
text = strings.Replace(text, "pic.twitter.com", "https://pic.twitter.com", -1)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
|
$bg-page: #305;
|
||||||
|
$bg-dark: #002;
|
||||||
|
$fg: #dde;
|
||||||
|
$fg-subtle: #aab;
|
||||||
|
$fg-limited: #a79;
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background: #305;
|
background: $bg-page;
|
||||||
color: #dde;
|
color: $fg;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
font-family: sans-serif, "Noto Color Emoji";
|
font-family: sans-serif, "Noto Color Emoji";
|
||||||
|
@ -11,7 +17,7 @@ pre, code {
|
||||||
blockquote {
|
blockquote {
|
||||||
margin-left: 0em;
|
margin-left: 0em;
|
||||||
padding-left: 0.5em;
|
padding-left: 0.5em;
|
||||||
border-left: 1px solid #aab;
|
border-left: 1px solid $fg-subtle;
|
||||||
}
|
}
|
||||||
table {
|
table {
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -19,7 +25,7 @@ table {
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
}
|
}
|
||||||
a {
|
a {
|
||||||
color: #dde;
|
color: $fg;
|
||||||
}
|
}
|
||||||
form, input, textarea {
|
form, input, textarea {
|
||||||
font-family: monospace, "Noto Color Emoji";
|
font-family: monospace, "Noto Color Emoji";
|
||||||
|
@ -29,8 +35,8 @@ p {
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
input {
|
input {
|
||||||
background: #305;
|
background: $bg-page;
|
||||||
color: #dde;
|
color: $fg;
|
||||||
font-size: 1.0em;
|
font-size: 1.0em;
|
||||||
line-height: 1.2em;
|
line-height: 1.2em;
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
|
@ -56,8 +62,8 @@ main {
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
}
|
}
|
||||||
.info {
|
.info {
|
||||||
background: #002;
|
background: $bg-dark;
|
||||||
border: 1px solid #dde;
|
border: 1px solid $fg;
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
padding: 0em 1em 0em 1em;
|
padding: 0em 1em 0em 1em;
|
||||||
}
|
}
|
||||||
|
@ -68,9 +74,9 @@ main {
|
||||||
label, button, form input[type=submit], select {
|
label, button, form input[type=submit], select {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
color: #dde;
|
color: $fg;
|
||||||
background: #305;
|
background: $bg-page;
|
||||||
border: 1px solid #dde;
|
border: 1px solid $fg;
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
}
|
}
|
||||||
button a {
|
button a {
|
||||||
|
@ -82,8 +88,8 @@ form {
|
||||||
textarea {
|
textarea {
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
background: #305;
|
background: $bg-page;
|
||||||
color: #dde;
|
color: $fg;
|
||||||
width: 600px;
|
width: 600px;
|
||||||
height: 8em;
|
height: 8em;
|
||||||
margin-bottom: 0.5em;
|
margin-bottom: 0.5em;
|
||||||
|
@ -101,7 +107,7 @@ input[type="checkbox"]:checked + span:after {
|
||||||
content: "yes";
|
content: "yes";
|
||||||
}
|
}
|
||||||
input[type="checkbox"]:focus + span:after {
|
input[type="checkbox"]:focus + span:after {
|
||||||
outline: 1px solid #dde;
|
outline: 1px solid $fg;
|
||||||
}
|
}
|
||||||
input[type=file] {
|
input[type=file] {
|
||||||
display: none;
|
display: none;
|
||||||
|
@ -110,8 +116,8 @@ input[type=file] {
|
||||||
.honk {
|
.honk {
|
||||||
width: 90%;
|
width: 90%;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
background: #002;
|
background: $bg-dark;
|
||||||
border: 1px solid #dde;
|
border: 1px solid $fg;
|
||||||
border-radius: 1em;
|
border-radius: 1em;
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
padding-left: 1em;
|
padding-left: 1em;
|
||||||
|
@ -121,14 +127,14 @@ input[type=file] {
|
||||||
}
|
}
|
||||||
.honk #honkform {
|
.honk #honkform {
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
border: 1px solid #dde;
|
border: 1px solid $fg;
|
||||||
}
|
}
|
||||||
|
|
||||||
.honk a {
|
.honk a {
|
||||||
color: #dde;
|
color: $fg;
|
||||||
}
|
}
|
||||||
.honk header .clip a {
|
.honk header .clip a {
|
||||||
color: #88a;
|
color: $fg-subtle;
|
||||||
}
|
}
|
||||||
.honk header {
|
.honk header {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
@ -154,21 +160,21 @@ input[type=file] {
|
||||||
.subtle {
|
.subtle {
|
||||||
}
|
}
|
||||||
.subtle .noise {
|
.subtle .noise {
|
||||||
color: #aab;
|
color: $fg-subtle;
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
}
|
}
|
||||||
.subtle .noise a {
|
.subtle .noise a {
|
||||||
color: #aab;
|
color: $fg-subtle;
|
||||||
}
|
}
|
||||||
.limited {
|
.limited {
|
||||||
border: 1px solid #a79;
|
border: 1px solid fg-limited;
|
||||||
color: #a79;
|
color: fg-limited;
|
||||||
}
|
}
|
||||||
.limited .noise {
|
.limited .noise {
|
||||||
color: #a79;
|
color: fg-limited;
|
||||||
}
|
}
|
||||||
.limited .noise a {
|
.limited .noise a {
|
||||||
color: #a79;
|
color: fg-limited;
|
||||||
}
|
}
|
||||||
details.noise[open] summary {
|
details.noise[open] summary {
|
||||||
display: none;
|
display: none;
|
||||||
|
@ -179,10 +185,10 @@ details.noise[open] summary {
|
||||||
.inlineform select {
|
.inlineform select {
|
||||||
}
|
}
|
||||||
.honk details.actions summary {
|
.honk details.actions summary {
|
||||||
color: #aab;
|
color: $fg-subtle;
|
||||||
}
|
}
|
||||||
.limited details.actions summary {
|
.limited details.actions summary {
|
||||||
color: #a79;
|
color: fg-limited;
|
||||||
}
|
}
|
||||||
h1, h2 {
|
h1, h2 {
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
|
@ -192,7 +198,7 @@ h3, h4 {
|
||||||
}
|
}
|
||||||
|
|
||||||
img:not(.emu) {
|
img:not(.emu) {
|
||||||
background: #305;
|
background: $bg-page;
|
||||||
}
|
}
|
||||||
img, video {
|
img, video {
|
||||||
max-width: 100%
|
max-width: 100%
|
||||||
|
|
Loading…
Reference in New Issue