1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-14 11:23:30 +02:00

generalized separator class and created specific insertion point class

split spacer into two files and converted to es6

insertion-point-spacer  -> custom-control-spacer
This commit is contained in:
Matthew McClure 2015-03-09 15:51:54 -07:00
parent 493f4d5df4
commit 4f52a47d7e
5 changed files with 50 additions and 22 deletions

View File

@ -17,6 +17,7 @@ import ChaptersButton from './text-track-controls/chapters-button.js';
import SubtitlesButton from './text-track-controls/subtitles-button.js'; import SubtitlesButton from './text-track-controls/subtitles-button.js';
import CaptionsButton from './text-track-controls/captions-button.js'; import CaptionsButton from './text-track-controls/captions-button.js';
import PlaybackRateMenuButton from './playback-rate-menu/playback-rate-menu-button.js'; import PlaybackRateMenuButton from './playback-rate-menu/playback-rate-menu-button.js';
import CustomControlSpacer from './spacer-controls/custom-control-spacer.js';
/** /**
* Container of main controls * Container of main controls
@ -44,7 +45,7 @@ ControlBar.prototype.options_ = {
'remainingTimeDisplay': {}, 'remainingTimeDisplay': {},
'liveDisplay': {}, 'liveDisplay': {},
'progressControl': {}, 'progressControl': {},
// 'separator': {}, 'customControlSpacer': {},
'fullscreenToggle': {}, 'fullscreenToggle': {},
'volumeControl': {}, 'volumeControl': {},
'muteToggle': {}, 'muteToggle': {},

View File

@ -18,7 +18,7 @@ class SeekHandle extends SliderHandle {
/** @inheritDoc */ /** @inheritDoc */
createEl() { createEl() {
return super.createEl.call('div', { return super.createEl('div', {
className: 'vjs-seek-handle', className: 'vjs-seek-handle',
'aria-live': 'off' 'aria-live': 'off'
}); });

View File

@ -1,20 +0,0 @@
/**
* Just an empty separator element that can be used as an append point for plugins, etc.
* Also can be used to create space between elements when necessary.
*
* @param {vjs.Player|Object} player
* @param {Object=} options
* @constructor
*/
vjs.Separator = vjs.Component.extend({
/** @constructor */
init: function(player, options){
vjs.Component.call(this, player, options);
}
});
vjs.Separator.prototype.createEl = function(){
return vjs.Component.prototype.createEl.call(this, 'div', {
className: 'vjs-separator-control'
});
};

View File

@ -0,0 +1,23 @@
import Spacer from './spacer.js';
/**
* Spacer specifically meant to be used as an insertion point for new plugins, etc.
*
* @param {Player|Object} player
* @param {Obect=} options
*/
class CustomControlSpacer extends Spacer {
buildCSSClass() {
return `vjs-custom-control-spacer ${super.buildCSSClass}`;
}
createEl() {
return super.createEl({
className: this.buildCSSClass()
});
}
}
Spacer.registerComponent('CustomControlSpacer', CustomControlSpacer);
export default CustomControlSpacer;

View File

@ -0,0 +1,24 @@
import Component from '../../component.js';
/**
* Just an empty spacer element that can be used as an append point for plugins, etc.
* Also can be used to create space between elements when necessary.
*
* @param {Player|Object} player
* @param {Object=} options
*/
class Spacer extends Component {
buildCSSClass() {
return `vjs-spacer ${super.buildCSSClass()}`;
}
createEl(props) {
return super.createEl('div', {
className: this.buildCSSClass()
});
}
}
Component.registerComponent('Spacer', Spacer);
export default Spacer;