in static/js/com/gif-player/gif-player.js [54:90]
function GifPlayer(element) {
if (!(this instanceof GifPlayer))
return new GifPlayer(element);
// Search for the element
const $element = $(element, 'body');
if ($element === 0) throw new Error('Mount node for component not found.');
else if ($element.length > 1) throw new Error('Component can be attached only to 1 node. ' + $element.length + ' nodes given.');
//Store element node
this.$element = $element;
this.elementIsImage = this.$element.is(TAGS.img);
// Get gif source
const gifSrc = $element.attr(ATTRIBUTES.gifSrc);
if (this.elementIsImage && !gifSrc) throw new Error('Can\'t init Gif-player, please provide ' + ATTRIBUTES.gifSrc + ' attribute for ' + element + '.');
// Store image node
this.$image = this.elementIsImage ? $element : $(element).find(TAGS.img);
// Init and store player wrapper
this.$player = this._initPlayerWrapper();
//init breakpoints behavior
if (!this.elementIsImage) this._initBreakpointsBehavior();
// Init and store click handler to be able to remove it on destroy
this.clickHandler = this._initClickHandler();
// Listen for clicks and call toggle play function
this.$player.on('click', this.clickHandler);
// Store this instance
GifPlayer._addInstance(this);
}