I LOVE HTML

This commit is contained in:
partisan 2024-11-19 12:14:11 +01:00
parent db89f9c781
commit 998896ad86
2 changed files with 33 additions and 21 deletions

View file

@ -8,6 +8,13 @@
{{ end }} {{ end }}
<title>{{ .Query }} - {{ translate "site_name" }}</title> <title>{{ .Query }} - {{ translate "site_name" }}</title>
<link rel="stylesheet" href="/static/css/style.css"> <link rel="stylesheet" href="/static/css/style.css">
<noscript>
<style>
img.placeholder-img {
display: none;
}
</style>
</noscript>
<link rel="stylesheet" href="/static/css/style-fixedwidth.css"> <link rel="stylesheet" href="/static/css/style-fixedwidth.css">
<link rel="stylesheet" href="/static/css/{{.Theme}}.css"> <link rel="stylesheet" href="/static/css/{{.Theme}}.css">
<link rel="search" type="application/opensearchdescription+xml" title="{{ translate "site_name" }}" href="/opensearch.xml"> <link rel="search" type="application/opensearchdescription+xml" title="{{ translate "site_name" }}" href="/opensearch.xml">
@ -185,16 +192,14 @@
</noscript> </noscript>
<!-- JavaScript is enabled; use placeholders --> <!-- JavaScript is enabled; use placeholders -->
<div id="content" class="js-enabled">
<img <img
src="/static/images/placeholder.svg" src="/static/images/placeholder.svg"
data-id="{{ $result.ID }}" data-id="{{ $result.ID }}"
data-full="{{ $result.ProxyFull }}" data-full="{{ $result.ProxyFull }}"
data-proxy-full="{{ $result.ProxyThumb }}" data-proxy-full="{{ $result.ProxyThumb }}"
alt="{{ $result.Title }}" alt="{{ $result.Title }}"
class="clickable" class="clickable placeholder-img"
/> />
</div>
{{ else }} {{ else }}
<!-- HardCacheEnabled is false; serve images directly --> <!-- HardCacheEnabled is false; serve images directly -->
<img src="{{ $result.ProxyFull }}" alt="{{ $result.Title }}" class="clickable" /> <img src="{{ $result.ProxyFull }}" alt="{{ $result.Title }}" class="clickable" />
@ -216,10 +221,10 @@
<!-- Nav buttons --> <!-- Nav buttons -->
<div class="pagination"> <div class="pagination">
{{ if .HasPrevPage }} {{ if .HasPrevPage }}
<a href="/search?q={{ .Query }}&t=image&p={{ sub .Page 1 }}&js_disabled=true">{{ translate "previous" }}</a> <a href="/search?q={{ .Query }}&t=image&p={{ sub .Page 1 }}">{{ translate "previous" }}</a>
{{ end }} {{ end }}
{{ if .HasNextPage }} {{ if .HasNextPage }}
<a href="/search?q={{ .Query }}&t=image&p={{ add .Page 1 }}&js_disabled=true">{{ translate "next" }}</a> <a href="/search?q={{ .Query }}&t=image&p={{ add .Page 1 }}">{{ translate "next" }}</a>
{{ end }} {{ end }}
</div> </div>
</noscript> </noscript>

View file

@ -1,17 +1,24 @@
{{ range $index, $result := .Results }} {{ range $index, $result := .Results }}
<div class="image"> <div class="image">
{{ if $.HardCacheEnabled }}
<noscript>
<!-- JavaScript is disabled; serve actual images -->
<img src="{{ $result.ProxyFull }}" alt="{{ $result.Title }}" class="clickable" />
</noscript>
<!-- JavaScript is enabled; use placeholders -->
<img <img
{{if $.HardCacheEnabled}}
src="/static/images/placeholder.svg" src="/static/images/placeholder.svg"
data-id="{{ $result.ID }}" data-id="{{ $result.ID }}"
data-full="{{ $result.ProxyFull }}" data-full="{{ $result.ProxyFull }}"
data-proxy-full="{{ $result.ProxyThumb }}" data-proxy-full="{{ $result.ProxyThumb }}"
{{else}}
src="{{ $result.ProxyFull }}"
{{end}}
alt="{{ $result.Title }}" alt="{{ $result.Title }}"
class="clickable" class="clickable placeholder-img"
/> />
{{ else }}
<!-- HardCacheEnabled is false; serve images directly -->
<img src="{{ $result.ProxyFull }}" alt="{{ $result.Title }}" class="clickable" />
{{ end }}
<div class="resolution">{{ $result.Width }} × {{ $result.Height }}</div> <div class="resolution">{{ $result.Width }} × {{ $result.Height }}</div>
<div class="details"> <div class="details">
<span class="img_title clickable">{{ $result.Title }}</span> <span class="img_title clickable">{{ $result.Title }}</span>