lazy load images

merge-requests/208/head
fatchan 4 years ago
parent 1d5ef43f2d
commit b63940e3c2
  1. 2
      views/includes/captcha.pug
  2. 2
      views/mixins/boardheader.pug
  3. 4
      views/mixins/catalogtile.pug
  4. 4
      views/mixins/post.pug
  5. 2
      views/pages/banners.pug
  6. 2
      views/pages/managebanners.pug

@ -1,4 +1,4 @@
noscript.no-m-p
iframe.captcha(src='/captcha.html' 'width=210' height='80' scrolling='no')
iframe.captcha(src='/captcha.html' 'width=210' height='80' scrolling='no' loading='lazy')
.jsonly.captcha(style='display:none;')
input.captchafield(type='text' name='captcha' autocomplete='off' placeholder='captcha text' pattern=".{6}" required title='6 characters')

@ -1,6 +1,6 @@
mixin boardheader(pagename)
.board-header
img.board-banner(src=`/randombanner?board=${board._id}` width='300' height='100')
img.board-banner(src=`/randombanner?board=${board._id}` width='300' height='100' loading='lazy')
br
if pagename
h1.board-title #{pagename}(#[a.no-decoration(href=`/${board._id}/index.html`) /#{board._id}/])

@ -21,8 +21,8 @@ mixin catalogtile(board, post, index)
else if file.mimetype.startsWith('audio')
div.audioimg.catalog-thumb
else if file.hasThumb
img.catalog-thumb(src=`/file/thumb-${file.hash}${file.thumbextension}` width='64' height='64')
img.catalog-thumb(src=`/file/thumb-${file.hash}${file.thumbextension}` width='64' height='64' loading='lazy')
else
img.catalog-thumb(src=`/file/${file.filename}` width='64' height='64')
img.catalog-thumb(src=`/file/${file.filename}` width='64' height='64' loading='lazy')
if post.message
pre.no-m-p.post-message !{post.message}

@ -82,9 +82,9 @@ mixin post(post, truncate, manage=false, globalmanage=false, ban=false)
else if type === 'audio'
div.audioimg.file-thumb
else if file.hasThumb
img.file-thumb(src=`/file/thumb-${file.hash}${file.thumbextension}` height=file.geometry.thumbheight width=file.geometry.thumbwidth)
img.file-thumb(src=`/file/thumb-${file.hash}${file.thumbextension}` height=file.geometry.thumbheight width=file.geometry.thumbwidth loading='lazy')
else
img.file-thumb(src=`/file/${file.filename}` height=file.geometry.height width=file.geometry.width)
img.file-thumb(src=`/file/${file.filename}` height=file.geometry.height width=file.geometry.width loading='lazy')
- if (post.message && modview) { post.message = post.message.replace(new RegExp(`<a class="quote" href="/${post.board}`, 'g'), `<a class="quote" href="/${post.board}/manage`); } //quick & dirty solution to a bigger problem/design issue
- let truncatedMessage = post.message;
if post.message

@ -15,7 +15,7 @@ block content
if board.banners.length > 0
.catalog
each banner in board.banners
img.board-banner(src=`/banner/${board._id}/${banner}` width='300' height='100')
img.board-banner(src=`/banner/${board._id}/${banner}` width='300' height='100' loading='lazy')
else
p Board has no custom banners.
include ../includes/stickynav.pug

@ -37,5 +37,5 @@ block content
each banner in board.banners
label.banner-check
input(type='checkbox' name='checkedbanners' value=banner)
img.board-banner(src=`/banner/${board._id}/${banner}` width='300' height='100')
img.board-banner(src=`/banner/${board._id}/${banner}` width='300' height='100' loading='lazy')
input(type='submit', value='delete')

Loading…
Cancel
Save