hide "map" on no-js website type, fix2
This commit is contained in:
parent
424dd0adab
commit
5b77d2a03c
4 changed files with 14 additions and 11 deletions
12
images.go
12
images.go
|
@ -66,6 +66,8 @@ func fetchImageResults(query string, safe, lang string, page int) ([]ImageSearch
|
||||||
lang = "en_CA"
|
lang = "en_CA"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Format &lang=lang_de is incorret, implement fix !
|
||||||
|
|
||||||
apiURL := fmt.Sprintf("https://api.qwant.com/v3/search/images?t=images&q=%s&count=%d&locale=%s&offset=%d&device=desktop&tgp=2&safesearch=%s",
|
apiURL := fmt.Sprintf("https://api.qwant.com/v3/search/images?t=images&q=%s&count=%d&locale=%s&offset=%d&device=desktop&tgp=2&safesearch=%s",
|
||||||
url.QueryEscape(query),
|
url.QueryEscape(query),
|
||||||
resultsPerPage,
|
resultsPerPage,
|
||||||
|
@ -100,11 +102,11 @@ func fetchImageResults(query string, safe, lang string, page int) ([]ImageSearch
|
||||||
var results []ImageSearchResult
|
var results []ImageSearchResult
|
||||||
for _, item := range apiResp.Data.Result.Items {
|
for _, item := range apiResp.Data.Result.Items {
|
||||||
results = append(results, ImageSearchResult{
|
results = append(results, ImageSearchResult{
|
||||||
Thumbnail: item.Thumbnail, // Thumbnail URL
|
Thumbnail: item.Thumbnail, // Thumbnail URL
|
||||||
Title: item.Title, // Image title
|
Title: item.Title, // Image title
|
||||||
Media: item.Media, // Direct link to the image - Ensure this field is used appropriately in your template
|
Media: item.Media, // Direct link to the image
|
||||||
Source: item.Media, // Using item.Media here ensures the direct image link is used
|
Source: item.Url,
|
||||||
ThumbProxy: "/img_proxy?url=" + url.QueryEscape(item.Media), // Proxy URL for the thumbnail, if needed
|
ThumbProxy: "/img_proxy?url=" + url.QueryEscape(item.Media),
|
||||||
Width: item.Width,
|
Width: item.Width,
|
||||||
Height: item.Height,
|
Height: item.Height,
|
||||||
})
|
})
|
||||||
|
|
2
main.go
2
main.go
|
@ -110,7 +110,7 @@ func handleSearch(w http.ResponseWriter, r *http.Request) {
|
||||||
case "video":
|
case "video":
|
||||||
videoSearchEndpointHandler(w, r)
|
videoSearchEndpointHandler(w, r)
|
||||||
case "map":
|
case "map":
|
||||||
handleMapSearch(w, query, safe) // implement map results
|
handleMapSearch(w, query, safe)
|
||||||
default:
|
default:
|
||||||
http.ServeFile(w, r, "templates/search.html")
|
http.ServeFile(w, r, "templates/search.html")
|
||||||
}
|
}
|
||||||
|
|
|
@ -1138,6 +1138,10 @@ p {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.js-enabled {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.logomobile {
|
.logomobile {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin-top: 0px;
|
margin-top: 0px;
|
||||||
|
|
|
@ -5,9 +5,6 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>{{.Query}} - Ocásek</title>
|
<title>{{.Query}} - Ocásek</title>
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/style.css">
|
<link rel="stylesheet" type="text/css" href="/static/css/style.css">
|
||||||
<style>
|
|
||||||
.js-enabled { display: none; }
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form action="/search" id="prev-next-form" class="results-search-container" method="GET" autocomplete="off">
|
<form action="/search" id="prev-next-form" class="results-search-container" method="GET" autocomplete="off">
|
||||||
|
@ -58,8 +55,8 @@
|
||||||
<option value="{{.Code}}" {{if eq .Code $.CurrentLang}}selected{{end}}>{{.Name}}</option>
|
<option value="{{.Code}}" {{if eq .Code $.CurrentLang}}selected{{end}}>{{.Name}}</option>
|
||||||
{{end}}
|
{{end}}
|
||||||
</select>
|
</select>
|
||||||
<button class="results-save" type="submit">Apply settings</button>
|
<button class="results-save" name="t" value="image">Apply settings</button>
|
||||||
</form>
|
</form>
|
||||||
<div class="search-results">
|
<div class="search-results">
|
||||||
<!-- Results go here -->
|
<!-- Results go here -->
|
||||||
{{ if .Results }}
|
{{ if .Results }}
|
||||||
|
|
Loading…
Add table
Reference in a new issue