Browse Source

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

master
rra 3 years ago
parent
commit
0369b3f8bc
  1. 4
      LogBot/logbot.py

4
LogBot/logbot.py

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

Loading…
Cancel
Save