quick fix to hide all images

This commit is contained in:
Ted Unangst 2020-01-16 21:42:48 -05:00
parent 2a0e9a58d6
commit 7e2a8c0457
4 changed files with 16 additions and 2 deletions

View File

@ -2,6 +2,8 @@ changelog
=== next === next
+ Quick fix to hide all images.
+ Allow resending follow requests. + Allow resending follow requests.
+ Improved search query parsing. + Improved search query parsing.

View File

@ -47,6 +47,7 @@ type WhatAbout struct {
type UserOptions struct { type UserOptions struct {
SkinnyCSS bool `json:",omitempty"` SkinnyCSS bool `json:",omitempty"`
OmitImages bool `json:",omitempty"`
Avatar string `json:",omitempty"` Avatar string `json:",omitempty"`
MapLink string `json:",omitempty"` MapLink string `json:",omitempty"`
} }

View File

@ -10,6 +10,8 @@
<p><textarea name="whatabout">{{ .WhatAbout }}</textarea> <p><textarea name="whatabout">{{ .WhatAbout }}</textarea>
<p><label class="button" for="skinny">skinny layout:</label> <p><label class="button" for="skinny">skinny layout:</label>
<input tabindex=1 type="checkbox" id="skinny" name="skinny" value="skinny" {{ if .User.Options.SkinnyCSS }}checked{{ end }}><span></span> <input tabindex=1 type="checkbox" id="skinny" name="skinny" value="skinny" {{ if .User.Options.SkinnyCSS }}checked{{ end }}><span></span>
<p><label class="button" for="omitimages">omit images:</label>
<input tabindex=1 type="checkbox" id="omitimages" name="omitimages" value="omitimages" {{ if .User.Options.OmitImages }}checked{{ end }}><span></span>
<p><label class="button" for="maps">apple map links:</label> <p><label class="button" for="maps">apple map links:</label>
<input tabindex=1 type="checkbox" id="maps" name="maps" value="apple" {{ if eq "apple" .User.Options.MapLink }}checked{{ end }}><span></span> <input tabindex=1 type="checkbox" id="maps" name="maps" value="apple" {{ if eq "apple" .User.Options.MapLink }}checked{{ end }}><span></span>
<p><button>update settings</button> <p><button>update settings</button>

13
web.go
View File

@ -55,10 +55,14 @@ func getuserstyle(u *login.UserInfo) template.CSS {
return "" return ""
} }
user, _ := butwhatabout(u.Username) user, _ := butwhatabout(u.Username)
css := template.CSS("")
if user.Options.SkinnyCSS { if user.Options.SkinnyCSS {
return "main { max-width: 700px; }" css += "main { max-width: 700px; }\n"
} }
return "" if user.Options.OmitImages {
css += ".honk .noise img { display: none; }\n"
}
return css
} }
func getmaplink(u *login.UserInfo) string { func getmaplink(u *login.UserInfo) string {
@ -1118,6 +1122,11 @@ func saveuser(w http.ResponseWriter, r *http.Request) {
} else { } else {
options.SkinnyCSS = false options.SkinnyCSS = false
} }
if r.FormValue("omitimages") == "omitimages" {
options.OmitImages = true
} else {
options.OmitImages = false
}
if r.FormValue("maps") == "apple" { if r.FormValue("maps") == "apple" {
options.MapLink = "apple" options.MapLink = "apple"
} else { } else {