summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Pelz <pelzflorian@pelzflorian.de>2017-12-28 10:43:49 +0100
committerFlorian Pelz <pelzflorian@pelzflorian.de>2017-12-28 10:53:14 +0100
commitf32da6bb09185dd08c027a146e974ac7fbe54db4 (patch)
tree3d94711e73848e81baca0070f443268884a4434a
parent6f77a9b4c50594fdf51940ceb5f0096a11f092d6 (diff)
Add screenshot thumbnail and fixed width and height attributes.
Apparently this allows browsers to allocate a fixed size before the image is loaded and thus avoid a content reflow.
-rw-r--r--dont-hang/screenshots/01-thumb.pngbin0 -> 4971 bytes
-rw-r--r--dont-hang/screenshots/02-thumb.pngbin0 -> 3816 bytes
-rw-r--r--haunt.scm22
3 files changed, 15 insertions, 7 deletions
diff --git a/dont-hang/screenshots/01-thumb.png b/dont-hang/screenshots/01-thumb.png
new file mode 100644
index 0000000..c9a7def
--- /dev/null
+++ b/dont-hang/screenshots/01-thumb.png
Binary files differ
diff --git a/dont-hang/screenshots/02-thumb.png b/dont-hang/screenshots/02-thumb.png
new file mode 100644
index 0000000..f05d9a8
--- /dev/null
+++ b/dont-hang/screenshots/02-thumb.png
Binary files differ
diff --git a/haunt.scm b/haunt.scm
index 4c64a46..53fd096 100644
--- a/haunt.scm
+++ b/haunt.scm
@@ -347,13 +347,21 @@ each consisting of a file extension and a url."
")"))
pairs))))
-(define (screenshot src title)
- "SXML for a screenshot; should use a thumbnail." ; TODO
- `(a (@ (href ,src)
+(define (screenshot url title
+ thumbnail-url thumbnail-width thumbnail-height)
+ "SXML for a screenshot.
+
+URL: The URL of the full-size screenshot as a raster graphics image.
+TITLE: The title for a link to the full image.
+THUMBNAIL-URL: The URL to a smaller version of the image.
+THUMBNAIL-WIDTH: The width of the thumbnail image.
+THUMBNAIL-HEIGHT: The height of the thumbnail image." ; TODO AUTODETECT
+ `(a (@ (href ,url)
(title ,title))
(img (@ (class "horizontally-padded-wide")
- (src ,src)
- (width "300")
+ (src ,thumbnail-url)
+ (width ,(number->string thumbnail-width))
+ (height ,(number->string thumbnail-height))
(alt (string-append "Screenshot: " ,title))))))
(define (back-button-for-lingua lingua)
@@ -655,9 +663,9 @@ cost."))
(h1 ,(_ "Screenshots"))
(div (@ (class "centered"))
,(screenshot "screenshots/01.png" (_ "Guessing an \
-expression"))
+expression") "screenshots/01-thumb.png" 224 126)
,(screenshot "screenshots/02.png" (_ "Right-to-left \
-support")))
+support") "screenshots/02-thumb.png" 224 126))
,(let* ((posts-about-dont-hang
(assoc-ref