From ef80d40c0eb434f7771c2743b016f5918ff76844 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Sun, 17 Dec 2023 18:19:28 +0100 Subject: Lazy load thumbnails on non-local links --- public/gallery.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/gallery.js b/public/gallery.js index f18e4a9..d97a55a 100644 --- a/public/gallery.js +++ b/public/gallery.js @@ -83,13 +83,18 @@ let BrowseView = { oncreate(vnode) { vnode.dom.focus() }, view(vnode) { + const loading = undefined + if (window.location.hostname !== 'localhost') + loading = 'lazy' + return m('.browser[tabindex=0]', { // Trying to force the oncreate on path changes. key: BrowseModel.path, }, BrowseModel.entries.map(e => { return m(m.route.Link, {href: `/view/${e.sha1}`}, m('img', {src: `/thumb/${e.sha1}`, - width: e.thumbW, height: e.thumbH, title: e.name})) + width: e.thumbW, height: e.thumbH, title: e.name, + loading})) })) }, } -- cgit v1.2.3-70-g09d2