Skip to content

Commit 4c104e7

Browse files
committed
refactor(popup): use lazysizes.js instead of lazyload.js
1 parent 2b66839 commit 4c104e7

File tree

4 files changed

+6
-55
lines changed

4 files changed

+6
-55
lines changed

popup/lazyload.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

popup/lazysizes.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

popup/popup.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<html>
33
<head>
44
<link rel="stylesheet" type="text/css" href="style.css" />
5+
<script src="lazysizes.min.js" defer></script>
56
<script src="../util/time.js" defer></script>
67
<script src="../util/hyperscript.js" defer></script>
78
<script type="module" src="popup.js" defer></script>

popup/popup.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
/* global chrome, formatVideoLength, timeAgo, formatTime, m */
22

3-
import lazyload from './lazyload.js';
4-
53
const removeChildClasses = ($node, className) => {
64
for (let $child of $node.children) {
75
$child.classList.remove(className);
@@ -207,7 +205,7 @@ const renderGroupVideo = (group, video) => {
207205
target: '_blank',
208206
}, [
209207
user.image ?
210-
m('img.lazy', { 'data-src': user.image }) : null,
208+
m('img.lazyload', { 'data-src': user.image }) : null,
211209
m('span.name', user.name),
212210
user.verified ?
213211
m('span.verified', { 'data-title': 'Verified' }) : null,
@@ -226,7 +224,7 @@ const renderGroupVideo = (group, video) => {
226224
href: url,
227225
target: '_blank',
228226
'data-title': game.name,
229-
}, m('img.lazy', { 'data-src': image }));
227+
}, m('img.lazyload', { 'data-src': image }));
230228
};
231229

232230
const sourceView = (source) => {
@@ -248,7 +246,7 @@ const renderGroupVideo = (group, video) => {
248246
if (video.playing) { vidClass += '.playing'; }
249247
const $video = m('li.video' + vidClass, [
250248
m('a.left-side', { href: video.url, disabled: true }, [
251-
m('img.lazy', {
249+
m('img.lazyload', {
252250
'data-src': video.thumbnail || '',
253251
onclick: open.bind(null, false),
254252
}),
@@ -472,12 +470,10 @@ const renderVideos = (group) => {
472470
for (let video of group.videos.slice(6)) {
473471
group.$videos.append(renderGroupVideo(group, video));
474472
}
475-
lazyload.addImages(group.$videos);
476473
setVideoPositions(group);
477474
});
478475

479476
group.$container = m('div.videos.selected');
480-
lazyload.addImages(group.$videos);
481477
setVideoPositions(group);
482478
group.$container.appendChild(group.$queueAll);
483479
group.$container.appendChild(group.$videos);
@@ -563,5 +559,4 @@ const setVideoPositions = (group) => {
563559
}
564560
});
565561

566-
lazyload.processScroll();
567562
};

0 commit comments

Comments
 (0)