mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 11:28:23 -07:00
28 lines
591 B
JavaScript
28 lines
591 B
JavaScript
define([], function () {
|
|
|
|
function loadImage(elem, url) {
|
|
|
|
if (elem.tagName !== "IMG") {
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
|
var tmp = new Image();
|
|
|
|
tmp.onload = function () {
|
|
elem.style.backgroundImage = "url('" + url + "')";
|
|
resolve(elem);
|
|
};
|
|
tmp.src = url;
|
|
});
|
|
|
|
} else {
|
|
elem.setAttribute("src", url);
|
|
return Promise.resolve(elem);
|
|
}
|
|
}
|
|
|
|
return {
|
|
loadImage: loadImage
|
|
};
|
|
|
|
}); |