'use strict';
/**
 * @file BackwardControl.js
 *
 * Backward control
 */

import $ from 'jquery';
import Component from './Component';
import Control from './Control';

/**
 * @param {Player} player Main player
 * @param {Object} [options={}] Options
 * @class BackwardControl
 * @extends Control
 */
class BackwardControl extends Control {
	constructor (player, options={}) {
		options = $.extend({}, {
			iconName : 'undo',
			className : 'backward',
			name : 'backward',
			title : `Отмотать назад на ${player.options.playback.step.medium} секунд`,
		}, options);
		super(player, options);
	}

	/**
	 * @override
	 */
	onClick(e) {
		super.onClick(e);
		this.player.video.currentTime -= this.player.options.playback.step.medium;
		this.player.splashIcon.show('undo');
	}
}

Component.registerComponent('BackwardControl', BackwardControl);
Control.registerControl('backward', BackwardControl);
export default BackwardControl;

@@ -546,16 +546,34 @@
 %D0%B5%D0%BA%D1%83%D0%BD%D0%B4%60,%0A
+%09%09%09disable : true%0A
 %09%09%7D, opt
@@ -604,16 +604,75 @@
 ptions);
+%0A%0A%09%09this.player.on('firstplay', () =%3E this.disable = false)
 %0A%09%7D%0A%0A%09/*

Disable backward control if video hasn't yet started