mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Migrate imageLoader to ES6
This commit is contained in:
parent
a802079ba3
commit
ac9668f9bb
2 changed files with 17 additions and 16 deletions
|
@ -100,7 +100,8 @@
|
||||||
"src/scripts/dfnshelper.js",
|
"src/scripts/dfnshelper.js",
|
||||||
"src/scripts/imagehelper.js",
|
"src/scripts/imagehelper.js",
|
||||||
"src/scripts/inputManager.js",
|
"src/scripts/inputManager.js",
|
||||||
"src/components/lazyloader/lazyloader-intersectionobserver.js"
|
"src/components/lazyloader/lazyloader-intersectionobserver.js",
|
||||||
|
"src/components/images/imageLoader.js"
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@babel/plugin-transform-modules-amd"
|
"@babel/plugin-transform-modules-amd"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
define(['lazyLoader', 'userSettings', 'css!./style'], function (lazyLoader, userSettings) {
|
import lazyLoader from 'lazyLoader';
|
||||||
'use strict';
|
import userSettings from 'userSettings';
|
||||||
|
import 'css!./style';
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
var self = {};
|
export function fillImage(entry) {
|
||||||
|
|
||||||
function fillImage(entry) {
|
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
throw new Error('entry cannot be null');
|
throw new Error('entry cannot be null');
|
||||||
}
|
}
|
||||||
|
@ -59,11 +59,11 @@ define(['lazyLoader', 'userSettings', 'css!./style'], function (lazyLoader, user
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function lazyChildren(elem) {
|
export function lazyChildren(elem) {
|
||||||
lazyLoader.lazyChildren(elem, fillImage);
|
lazyLoader.lazyChildren(elem, fillImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPrimaryImageAspectRatio(items) {
|
export function getPrimaryImageAspectRatio(items) {
|
||||||
|
|
||||||
var values = [];
|
var values = [];
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ define(['lazyLoader', 'userSettings', 'css!./style'], function (lazyLoader, user
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillImages(elems) {
|
export function fillImages(elems) {
|
||||||
|
|
||||||
for (var i = 0, length = elems.length; i < length; i++) {
|
for (var i = 0, length = elems.length; i < length; i++) {
|
||||||
var elem = elems[0];
|
var elem = elems[0];
|
||||||
|
@ -131,10 +131,10 @@ define(['lazyLoader', 'userSettings', 'css!./style'], function (lazyLoader, user
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.fillImages = fillImages;
|
/* eslint-enable indent */
|
||||||
self.lazyImage = fillImage;
|
export default {
|
||||||
self.lazyChildren = lazyChildren;
|
fillImages: fillImages,
|
||||||
self.getPrimaryImageAspectRatio = getPrimaryImageAspectRatio;
|
lazyImage: fillImage,
|
||||||
|
lazyChildren: lazyChildren,
|
||||||
return self;
|
getPrimaryImageAspectRatio: getPrimaryImageAspectRatio
|
||||||
});
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue