diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2023-12-17 18:19:28 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2023-12-17 18:19:28 +0100 |
commit | ef80d40c0eb434f7771c2743b016f5918ff76844 (patch) | |
tree | 96b514ddbc6b9295b447c862d7286e7cfbf8b2f0 /public/gallery.js | |
parent | f244e503d7935cbdc70f23eff6eb6067627dbf8f (diff) | |
download | gallery-ef80d40c0eb434f7771c2743b016f5918ff76844.tar.gz gallery-ef80d40c0eb434f7771c2743b016f5918ff76844.tar.xz gallery-ef80d40c0eb434f7771c2743b016f5918ff76844.zip |
Lazy load thumbnails on non-local links
Diffstat (limited to 'public/gallery.js')
-rw-r--r-- | public/gallery.js | 7 |
1 files changed, 6 insertions, 1 deletions
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})) })) }, } |