add lazyloading parameter to only load material which is close to the viewport

This commit is contained in:
rra 2021-12-01 17:35:01 +01:00
parent f234bafb5c
commit 0369b3f8bc

View File

@ -97,9 +97,9 @@ class Logbot(Bot):
# define media_post
media_path = os.path.join(media_type, filename)
if message.url.lower().endswith(self.IMAGE_TYPES):
media_post = f'<img src="{ media_path }">'
media_post = f'<img src="{ media_path }" loading="lazy">'
elif message.url.lower().endswith(self.FILE_TYPES):
media_post = f'<iframe src="{ media_path }"></iframe>'
media_post = f'<iframe src="{ media_path }" loading="lazy"></iframe>'
elif message.url.lower().endswith(self.AUDIO_TYPES):
media_post = f'<audio controls src="{ media_path }"></audio>'
elif message.url.lower().endswith(self.VIDEO_TYPES):