Browse Source

Lazy-load screenshots

spaghetti 7 years ago
parent
commit
e36a953e32
2 changed files with 10 additions and 2 deletions
  1. 2
    2
      sections/torrents/details.php
  2. 8
    0
      static/functions/torrent.js

+ 2
- 2
sections/torrents/details.php View File

@@ -779,9 +779,9 @@ if (count($PersonalCollages) > 0) {
779 779
     foreach($Screenshots as $Screenshot) {
780 780
       $SSURL = ImageTools::process($Screenshot['Image']);
781 781
       if (check_perms('users_mod')) {
782
-        ?><img class='tooltip lightbox-init' title='<?=Users::format_username($Screenshot['UserID'], false, false, false)?> - <?=time_diff($Screenshot['Time'])?>' src="<?=$SSURL?>" /><?
782
+        ?><img class='tooltip lightbox-init' title='<?=Users::format_username($Screenshot['UserID'], false, false, false)?> - <?=time_diff($Screenshot['Time'])?>' data-src="<?=$SSURL?>" /><?
783 783
       } else {
784
-        ?><img class='tooltip lightbox-init' title='Added <?=time_diff($Screenshot['Time'])?>' src="<?=$SSURL?>" /><?
784
+        ?><img class='tooltip lightbox-init' title='Added <?=time_diff($Screenshot['Time'])?>' data-src="<?=$SSURL?>" /><?
785 785
       }
786 786
     }
787 787
 ?>

+ 8
- 0
static/functions/torrent.js View File

@@ -188,3 +188,11 @@ function Vote(amount, requestid) {
188 188
     }
189 189
   );
190 190
 }
191
+
192
+$(() => {
193
+  $('.torrent_screenshots_box > .head > a[data-toggle-replace]').on('click', event => {
194
+    $('.torrent_screenshots > img').each((i, el) => {
195
+      el.src = $(el).data('src')
196
+    })
197
+  })
198
+})

Loading…
Cancel
Save