mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 19:38:20 -07:00
47 lines
1.4 KiB
HTML
47 lines
1.4 KiB
HTML
<script>
|
|
|
|
require(['imageFetcher'], function (imageFetcher) {
|
|
window.ImageFetcherLazyloadImage = imageFetcher;
|
|
});
|
|
|
|
/**
|
|
* <lazyload-image>
|
|
* HTMLImageElement extension for lazy loading.
|
|
* http://github.com/1000ch/lazyload-image
|
|
*
|
|
* Copyright 1000ch
|
|
* licensed under the MIT license.
|
|
*/
|
|
window.LazyloadImage = (function () {
|
|
'use strict';
|
|
|
|
var FALLBACK_IMAGE = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAEElEQVR42gEFAPr/AP///wAI/AL+Sr4t6gAAAABJRU5ErkJggg==';
|
|
|
|
// create prototype from HTMLImageElement
|
|
var LazyloadImagePrototype = Object.create(HTMLImageElement.prototype);
|
|
|
|
// lifecycle callbacks
|
|
//LazyloadImagePrototype.createdCallback = function () {
|
|
|
|
//};
|
|
|
|
//LazyloadImagePrototype.attachedCallback = function () {
|
|
|
|
// var original = this.currentSrc || this.src;
|
|
|
|
// if (original && window.ImageFetcherLazyloadImage) {
|
|
// //console.log(original);
|
|
// this.src = FALLBACK_IMAGE;
|
|
// console.log('loading ' + original);
|
|
// ImageFetcherLazyloadImage.loadImage(this, original);
|
|
// }
|
|
//};
|
|
|
|
return document.registerElement('lazyload-image', {
|
|
prototype: LazyloadImagePrototype,
|
|
extends: 'img'
|
|
});
|
|
|
|
})();
|
|
|
|
</script> |