From 8c7aabab72e2a7409c4bd317d3047339b4cf2876 Mon Sep 17 00:00:00 2001 From: Ryan Stafford Date: Sun, 16 Jul 2023 13:45:40 -0400 Subject: [PATCH] spoiler fix, default search options --- routes.go | 2 +- state.go | 2 +- templates/frontpage.html | 4 +--- templates/main.html | 3 ++- templates/nav.html | 4 ++-- templates/sidebar.html | 1 + 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/routes.go b/routes.go index 7f690f1..b3cec93 100644 --- a/routes.go +++ b/routes.go @@ -140,7 +140,7 @@ var funcMap = template.FuncMap{ body = buf.String() body = strings.Replace(body, `$1$2") + body = RegReplace(body, `::: ?spoiler (.*?)\n([\S\s]*?):::`, "
$1$2
") return template.HTML(body) }, "rmmarkdown": func(body string) string { diff --git a/state.go b/state.go index cdaa921..9b5afab 100644 --- a/state.go +++ b/state.go @@ -544,7 +544,7 @@ func (state *State) Search(searchtype string) { search := types.Search{ Q: state.Query, Sort: types.NewOptional(types.SortType(state.Sort)), - ListingType: types.NewOptional(types.ListingType("All")), + ListingType: types.NewOptional(types.ListingType(state.Listing)), Type: types.NewOptional(types.SearchType(searchtype)), Limit: types.NewOptional(int64(25)), Page: types.NewOptional(int64(state.Page)), diff --git a/templates/frontpage.html b/templates/frontpage.html index 63637d1..ac291fd 100644 --- a/templates/frontpage.html +++ b/templates/frontpage.html @@ -29,9 +29,7 @@ {{ template "nsfw.html" }} {{ else }}
- {{ if or (contains .Sort "Top") (and (not .PostID) (not .User) (not .Community) (not .Activities) (eq .Op ""))}} - {{ template "menu.html" . }} - {{ end}} + {{ template "menu.html" . }} {{ if .Error }}
diff --git a/templates/main.html b/templates/main.html index e2d6390..5cf680d 100644 --- a/templates/main.html +++ b/templates/main.html @@ -27,12 +27,13 @@ {{ template "nsfw.html" }} {{ else }}
- {{ if or (contains .Sort "Top") (and (not .PostID) (not .User) (not .Community) (not .Activities) (eq .Op ""))}} + {{ if or (.Query) (.SearchType) (and (not .PostID) (not .User) (not .Activities) (eq .Op ""))}} {{ template "menu.html" . }} {{ end}} {{ if or (ne .Query "") .Communities }}