Skip to content

Commit 4f2b74a

Browse files
committed
A site's screenshot is a thumbnail that opens larger on a click
The screenshot on a site's page took the full width of the page. It is now a small thumbnail, and clicking it opens it large in a dialog, with a link to the full size image. Escape or a click outside closes it.
1 parent b93a3bc commit 4f2b74a

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

‎app/web/static/app.css‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,3 +1137,12 @@ th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
11371137
.ext-fields label.check { display: flex; gap: .5rem; align-items: flex-start; margin: .5rem 0; }
11381138
.ext-fields > label:not(.check) { display: block; margin: .5rem 0; }
11391139
.modal-body > label.check { display: flex; gap: .5rem; align-items: flex-start; margin: .5rem 0; }
1140+
/* The site's screenshot: small on the page, large on a click. */
1141+
.shot-thumb-btn { background: none; border: 0; padding: 0; cursor: zoom-in;
1142+
display: inline-flex; flex-direction: column; gap: .3rem; align-items: flex-start; }
1143+
.shot-small { width: 360px; max-width: 100%; height: auto; display: block;
1144+
border: 1px solid var(--border); border-radius: 6px; }
1145+
.shot-thumb-btn:hover .shot-small, .shot-thumb-btn:focus-visible .shot-small { border-color: var(--border-strong); }
1146+
.modal.shot-modal { max-width: min(1320px, 95vw); }
1147+
.shot-modal-body { overflow: auto; padding: .5rem; }
1148+
.shot-large { width: 100%; height: auto; display: block; border-radius: 4px; }

‎app/web/templates/external_site.html‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@
4949
<span class="faint small" style="font-weight:400">{{ tele.final_url or ('https://' ~ asset.host ~ '/') }}{% if asset.telemetry_at %}, {{ asset.telemetry_at | dt('%Y-%m-%d %H:%M') }}{% endif %}</span></div>
5050
<div class="card-body">
5151
{% if asset.screenshot == 'ok' %}
52-
<a href="{{ base }}/external/{{ asset.id }}/screenshot.png" target="_blank" rel="noopener"><img class="shot-hero" alt="Screenshot of {{ asset.host }}" src="{{ base }}/external/{{ asset.id }}/screenshot.png?v={{ asset.telemetry_at.timestamp() | int if asset.telemetry_at else 0 }}"></a>
52+
{% set shot_src = base ~ '/external/' ~ asset.id ~ '/screenshot.png?v=' ~ (asset.telemetry_at.timestamp() | int if asset.telemetry_at else 0) %}
53+
<button type="button" class="shot-thumb-btn" data-modal="shot-modal" title="Show it larger">
54+
<img class="shot-small" alt="Screenshot of {{ asset.host }}, click to enlarge" src="{{ shot_src }}">
55+
<span class="small faint">Click to enlarge</span></button>
5356
{% else %}
5457
<div class="shot-hero-none">{{ {'waf':'A firewall block page answered, so the screenshot is left out.','blank':'The page rendered blank.','nobrowser':'No headless browser on this server.','blocked':'The browser brought back no image.'}.get(asset.screenshot, 'No screenshot yet. Refresh telemetry to take one.') }}
5558
{% if tele.shot_detail %}<div class="small faint">{{ tele.shot_detail }}</div>{% endif %}</div>
@@ -251,6 +254,21 @@
251254
</div>
252255
</div>
253256

257+
{% if asset.screenshot == 'ok' %}
258+
<div class="modal-backdrop" id="shot-modal" hidden>
259+
<div class="modal shot-modal">
260+
<div class="modal-head">{{ tele.final_url or asset.host }}
261+
<button type="button" class="modal-close" data-close-modal aria-label="Close">&times;</button></div>
262+
<div class="modal-body shot-modal-body">
263+
<img class="shot-large" alt="Screenshot of {{ asset.host }}" src="{{ shot_src }}" loading="lazy">
264+
</div>
265+
<div class="modal-foot">
266+
<a class="btn" href="{{ shot_src }}" target="_blank" rel="noopener">Open full size</a>
267+
<button type="button" class="btn" data-close-modal>Close</button></div>
268+
</div>
269+
</div>
270+
{% endif %}
271+
254272
<div class="modal-backdrop" id="edit-modal" hidden>
255273
<div class="modal wide"><form method="post" action="{{ base }}/external/{{ asset.id }}/edit">
256274
<div class="modal-head">Edit {{ asset.host }} <button type="button" class="modal-close" data-close-modal>&times;</button></div>

0 commit comments

Comments
 (0)