Skip to content

Commit

Permalink
Revert "@heff converted all classes to use ES6 classes. closes videoj…
Browse files Browse the repository at this point in the history
…s#1993"

This reverts commit a02ee27.
  • Loading branch information
libins committed May 4, 2015
1 parent a02ee27 commit 1c9cc62
Show file tree
Hide file tree
Showing 74 changed files with 6,166 additions and 6,081 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ CHANGELOG
* @OleLaursen added a Danish translation ([view](https://github.com/videojs/video.js/pull/1899))
* @dn5 Added new translations (Bosnian, Serbian, Croatian) ([view](https://github.com/videojs/video.js/pull/1897))
* @mmcc (and others) converted the whole project to use ES6, Babel and Browserify ([view](https://github.com/videojs/video.js/pull/1976))
* @heff converted all classes to use ES6 classes ([view](https://github.com/videojs/video.js/pull/1993))

--------------------

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"global": "^4.3.0"
},
"devDependencies": {
"babelify": "^6.0.1",
"babelify": "^5.0.4",
"blanket": "^1.1.6",
"browserify-istanbul": "^0.2.1",
"browserify-versionify": "^1.0.4",
Expand Down
26 changes: 13 additions & 13 deletions src/js/big-play-button.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Component from './component';
import Button from './button';

/* Big Play Button
Expand All @@ -10,21 +11,20 @@ import Button from './button';
* @class
* @constructor
*/
class BigPlayButton extends Button {
var BigPlayButton = Button.extend();

createEl() {
return super.createEl('div', {
className: 'vjs-big-play-button',
innerHTML: '<span aria-hidden="true"></span>',
'aria-label': 'play video'
});
}
Component.registerComponent('BigPlayButton', BigPlayButton);

onClick() {
this.player_.play();
}
BigPlayButton.prototype.createEl = function(){
return Button.prototype.createEl.call(this, 'div', {
className: 'vjs-big-play-button',
innerHTML: '<span aria-hidden="true"></span>',
'aria-label': 'play video'
});
};

}
BigPlayButton.prototype.onClick = function(){
this.player_.play();
};

Button.registerComponent('BigPlayButton', BigPlayButton);
export default BigPlayButton;
108 changes: 55 additions & 53 deletions src/js/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ import document from 'global/document';
* @class
* @constructor
*/
class Button extends Component {

constructor(player, options) {
super(player, options);
var Button = Component.extend({
/**
* @constructor
* @inheritDoc
*/
init: function(player, options){
Component.call(this, player, options);

this.emitTapEvents();

Expand All @@ -24,65 +27,64 @@ class Button extends Component {
this.on('focus', this.onFocus);
this.on('blur', this.onBlur);
}
});

createEl(type, props) {
// Add standard Aria and Tabindex info
props = Lib.obj.merge({
className: this.buildCSSClass(),
'role': 'button',
'aria-live': 'polite', // let the screen reader user know that the text of the button may change
tabIndex: 0
}, props);

let el = super.createEl(type, props);

// if innerHTML hasn't been overridden (bigPlayButton), add content elements
if (!props.innerHTML) {
this.contentEl_ = Lib.createEl('div', {
className: 'vjs-control-content'
});

this.controlText_ = Lib.createEl('span', {
className: 'vjs-control-text',
innerHTML: this.localize(this.buttonText) || 'Need Text'
});

this.contentEl_.appendChild(this.controlText_);
el.appendChild(this.contentEl_);
}

return el;
}
Component.registerComponent('Button', Button);

buildCSSClass() {
// TODO: Change vjs-control to vjs-button?
return 'vjs-control ' + super.buildCSSClass();
Button.prototype.createEl = function(type, props){
// Add standard Aria and Tabindex info
props = Lib.obj.merge({
className: this.buildCSSClass(),
'role': 'button',
'aria-live': 'polite', // let the screen reader user know that the text of the button may change
tabIndex: 0
}, props);

let el = Component.prototype.createEl.call(this, type, props);

// if innerHTML hasn't been overridden (bigPlayButton), add content elements
if (!props.innerHTML) {
this.contentEl_ = Lib.createEl('div', {
className: 'vjs-control-content'
});

this.controlText_ = Lib.createEl('span', {
className: 'vjs-control-text',
innerHTML: this.localize(this.buttonText) || 'Need Text'
});

this.contentEl_.appendChild(this.controlText_);
el.appendChild(this.contentEl_);
}

return el;
};

Button.prototype.buildCSSClass = function(){
// TODO: Change vjs-control to vjs-button?
return 'vjs-control ' + Component.prototype.buildCSSClass.call(this);
};

// Click - Override with specific functionality for button
onClick() {}
Button.prototype.onClick = function(){};

// Focus - Add keyboard functionality to element
onFocus() {
Events.on(document, 'keydown', Lib.bind(this, this.onKeyPress));
}
Button.prototype.onFocus = function(){
Events.on(document, 'keydown', Lib.bind(this, this.onKeyPress));
};

// KeyPress (document level) - Trigger click when keys are pressed
onKeyPress(event) {
// Check for space bar (32) or enter (13) keys
if (event.which == 32 || event.which == 13) {
event.preventDefault();
this.onClick();
}
}

// Blur - Remove keyboard triggers
onBlur() {
Events.off(document, 'keydown', Lib.bind(this, this.onKeyPress));
Button.prototype.onKeyPress = function(event){
// Check for space bar (32) or enter (13) keys
if (event.which == 32 || event.which == 13) {
event.preventDefault();
this.onClick();
}
};

}
// Blur - Remove keyboard triggers
Button.prototype.onBlur = function(){
Events.off(document, 'keydown', Lib.bind(this, this.onKeyPress));
};


Component.registerComponent('Button', Button);
export default Button;
Loading

0 comments on commit 1c9cc62

Please sign in to comment.