jellyfin-web/dashboard-ui/bower_components/emby-lazyload-image/lazyload-image.html
2016-04-25 22:17:11 -04:00

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>