source/js/le-player.js
/**
	 * Remove unnecessary attributes, and set some attrs from options (loop, poster etc...). Create main DOM objects
	 *
	 * @override
	 */
Remove unnecessary attributes, and set some attrs from options (loop, poster etc...). Create main DOM objects
@override
Remove unnecessary attributes and set some attrs from options ( loop poster etc ... ) . Create main DOM objects @override
createElement() {
		const options = this.options;
		const element = this._element;
		this.element = createEl('div');
		this.element = this.element
			.addClass('leplayer')
			.attr('tabindex', 0)
			.css('width', options.width && '100%')
			.css('max-width', options.width)
		this.errorDisplay = new ErrorDisplay(this);
		this.playButton = new PlayButton(this);
		this.loader = $('<div />')
			.addClass('leplayer-loader-container')
			.append(new Icon(this, {
				iconName : 'refresh',
				className : 'leplayer-loader-container__icon'
			}).element);
		this.splashIcon = new SplashIcon(this);
		this.videoContainer = createEl('div', {
			className : 'leplayer-video'
		})
		.append(this.errorDisplay.element)
		.append(this.playButton.element)
		.append(this.loader)
		.append(this.splashIcon.element)
		this.poster = new Poster(this);
		this.videoContainer.append(this.poster.element);
		const lastTimer = new Time(this, {
			fn : (player) => {
				const video = player.video;
				return secondsToTime(video.duration - video.currentTime);
			}
		})
		if(this.options.videoInfo) {
			console.warn('options.videoInfo is deprecated, please use istead options.description');
		}
		this.infoElement = createEl('div', {
			className : 'leplayer__info'
		})
		.append(createEl('div', {
			className : 'leplayer__title',
			html : this.options.title || ""
		}))
		.append(createEl('div', {
			className : 'leplayer__video-info',
			html : this.options.description || this.options.videoInfo || ""
		}))
		.append(createEl('div', {
			className : 'leplayer__last',
			html : `Видео закончится через `,
		}).append(lastTimer.element))
		this.innerElement = $('<div />')
			.addClass('leplayer__inner')
			.append(this.videoContainer)
			.append(this.infoElement)
		this.element = this.element
			.append(this.innerElement)
		this.addClass('leplayer--paused');
		this.addClass('leplayer--virgin');
		if(IS_IPHONE) {
			this.addClass('leplayer--iphone');
		}
		if(IS_ANDROID) {
			this.addClass('leplayer--android');
		}
		if(IS_MOBILE) {
			this.addClass('leplayer--mobile');
		}
		if(options.sectionContainer) {
			this.sectionsContainer = $(options.sectionContainer);
		}
		element.before(this.element);
		this.videoContainer.append(element);
		return this.element;
	}
createElement ( ) { const options = this . options ; const element = this . _element ; this . element = createEl ( 'div' ) ; this . element = this . element . addClass ( 'leplayer' ) . attr ( 'tabindex' , 0 ) . css ( 'width' , options . width && '100%' ) . css ( 'max-width' , options . width ) this . errorDisplay = new ErrorDisplay ( this ) ; this . playButton = new PlayButton ( this ) ; this . loader = $ ( '<div />' ) . addClass ( 'leplayer-loader-container' ) . append ( new Icon ( this , { iconName : 'refresh' , className : 'leplayer-loader-container__icon' } ) . element ) ; this . splashIcon = new SplashIcon ( this ) ; this . videoContainer = createEl ( 'div' , { className : 'leplayer-video' } ) . append ( this . errorDisplay . element ) . append ( this . playButton . element ) . append ( this . loader ) . append ( this . splashIcon . element ) this . poster = new Poster ( this ) ; this . videoContainer . append ( this . poster . element ) ; const lastTimer = new Time ( this , { fn : ( player ) => { const video = player . video ; return secondsToTime ( video . duration - video . currentTime ) ; } } ) if ( this . options . videoInfo ) { console . warn ( 'options.videoInfo is deprecated, please use istead options.description' ) ; } this . infoElement = createEl ( 'div' , { className : 'leplayer__info' } ) . append ( createEl ( 'div' , { className : 'leplayer__title' , html : this . options . title || "" } ) ) . append ( createEl ( 'div' , { className : 'leplayer__video-info' , html : this . options . description || this . options . videoInfo || "" } ) ) . append ( createEl ( 'div' , { className : 'leplayer__last' , html : ` } ) . append ( lastTimer . element ) ) this . innerElement = $ ( '<div />' ) . addClass ( 'leplayer__inner' ) . append ( this . videoContainer ) . append ( this . infoElement ) this . element = this . element . append ( this . innerElement ) this . addClass ( 'leplayer--paused' ) ; this . addClass ( 'leplayer--virgin' ) ; if ( IS_IPHONE ) { this . addClass ( 'leplayer--iphone' ) ; } if ( IS_ANDROID ) { this . addClass ( 'leplayer--android' ) ; } if ( IS_MOBILE ) { this . addClass ( 'leplayer--mobile' ) ; } if ( options . sectionContainer ) { this . sectionsContainer = $ ( options . sectionContainer ) ; } element . before ( this . element ) ; this . videoContainer . append ( element ) ; return this . element ; }
Remove unnecessary attributes, and set some attrs from options (loop, poster etc...).
Remove unnecessary attributes and set some attrs from options ( loop poster etc ... ) .
/**
		 * Error display component.
		 *
		 * @type {ErrorDisplay}
		 * @memberof! Player#
		 */ /**
		 * Play button component.
		 *
		 * @type {PlayButton}
		 * @memberof! Player#
		 */ // TODO: Вынести это в отдельнеый компонент /**
		 * Splash icon component.
		 *
		 * @type {SplashIcon}
		 * @memberof! Player#
		 */