Skip to content

Commit

Permalink
@eXon began Tech 2.0 work, improved how tech events are handled by th…
Browse files Browse the repository at this point in the history
…e player. closes #2057

closes #1485
  • Loading branch information
eXon authored and heff committed May 6, 2015
1 parent de843af commit e5595b1
Show file tree
Hide file tree
Showing 29 changed files with 620 additions and 545 deletions.
1 change: 1 addition & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"undef" : true,
"laxbreak" : true,
"esnext" : true,
"eqeqeq" : true,
"predef" : [
"_V_",
"goog",
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ CHANGELOG
* @gkatsev added error logging for bad JSON formatting ([view](https://github.com/videojs/video.js/pull/2113))
* @gkatsev added a sensible toJSON function ([view](https://github.com/videojs/video.js/pull/2114))
* @bc-bbay fixed instance where progress bars would go passed 100% ([view](https://github.com/videojs/video.js/pull/2040))
* @eXon began Tech 2.0 work, improved how tech events are handled by the player ([view](https://github.com/videojs/video.js/pull/2057))

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

Expand Down
2 changes: 1 addition & 1 deletion src/js/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Button extends Component {
// KeyPress (document level) - Trigger click when keys are pressed
handleKeyPress(event) {
// Check for space bar (32) or enter (13) keys
if (event.which == 32 || event.which == 13) {
if (event.which === 32 || event.which === 13) {
event.preventDefault();
this.handleClick();
}
Expand Down
5 changes: 2 additions & 3 deletions src/js/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ class Component {
// If there was no ID from the options, generate one
if (!this.id_) {
// Don't require the player ID function in the case of mock players
let id = player.id && player.id() || 'no_player';

let id = player && player.id && player.id() || 'no_player';
this.id_ = `${id}_component_${Lib.guid++}`;
}

Expand Down Expand Up @@ -1033,7 +1032,7 @@ class Component {
*/
enableTouchActivity() {
// Don't continue if the root player doesn't support reporting user activity
if (!this.player().reportUserActivity) {
if (!this.player() || !this.player().reportUserActivity) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class PlaybackRateMenuItem extends MenuItem {
}

update() {
this.selected(this.player().playbackRate() == this.rate);
this.selected(this.player().playbackRate() === this.rate);
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/js/control-bar/progress-control/seek-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class SeekBar extends Slider {
let newTime = this.calculateDistance(event) * this.player_.duration();

// Don't let video end while scrubbing.
if (newTime == this.player_.duration()) { newTime = newTime - 0.1; }
if (newTime === this.player_.duration()) { newTime = newTime - 0.1; }

// Set new time (tell player to seek to new time)
this.player_.currentTime(newTime);
Expand Down
2 changes: 1 addition & 1 deletion src/js/control-bar/text-track-controls/chapters-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ChaptersButton extends TextTrackButton {

for (let i = 0, l = tracks.length; i < l; i++) {
let track = tracks[i];
if (track['kind'] == this.kind_) {
if (track['kind'] === this.kind_) {
if (!track.cues) {
track['mode'] = 'hidden';
/* jshint loopfunc:true */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ class TextTrackButton extends MenuButton {
}

MenuButton.registerComponent('TextTrackButton', TextTrackButton);
export default TextTrackButton;
export default TextTrackButton;
2 changes: 1 addition & 1 deletion src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ var videojs = function(id, options, ready){

// CDN Version. Used to target right flash swf.
videojs.CDN_VERSION = '__VERSION_NO_PATCH__';
videojs.ACCESS_PROTOCOL = ('https:' == document.location.protocol ? 'https://' : 'http://');
videojs.ACCESS_PROTOCOL = ('https:' === document.location.protocol ? 'https://' : 'http://');

/**
* Full player version
Expand Down
2 changes: 1 addition & 1 deletion src/js/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ var on = function(elem, type, fn){
};
}

if (data.handlers[type].length == 1) {
if (data.handlers[type].length === 1) {
if (elem.addEventListener) {
elem.addEventListener(type, data.dispatcher, false);
} else if (elem.attachEvent) {
Expand Down
6 changes: 3 additions & 3 deletions src/js/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var createEl = function(tagName='div', properties={}){
// add the attribute "role". My guess is because it's not a valid attribute in some namespaces, although
// browsers handle the attribute just fine. The W3C allows for aria-* attributes to be used in pre-HTML5 docs.
// http://www.w3.org/TR/wai-aria-primer/#ariahtml. Using setAttribute gets around this problem.
if (propName.indexOf('aria-') !== -1 || propName == 'role') {
if (propName.indexOf('aria-') !== -1 || propName === 'role') {
el.setAttribute(propName, val);
} else {
el[propName] = val;
Expand Down Expand Up @@ -616,10 +616,10 @@ var setLocalStorage = function(key, value){
if (!localStorage) { return; }
localStorage[key] = value;
} catch(e) {
if (e.code == 22 || e.code == 1014) { // Webkit == 22 / Firefox == 1014
if (e.code === 22 || e.code === 1014) { // Webkit == 22 / Firefox == 1014
log('LocalStorage Full (VideoJS)', e);
} else {
if (e.code == 18) {
if (e.code === 18) {
log('LocalStorage not allowed (VideoJS)', e);
} else {
log('LocalStorage Error (VideoJS)', e);
Expand Down
4 changes: 2 additions & 2 deletions src/js/menu/menu-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ class MenuButton extends Button {
handleKeyPress(event) {

// Check for space bar (32) or enter (13) keys
if (event.which == 32 || event.which == 13) {
if (event.which === 32 || event.which === 13) {
if (this.buttonPressed_){
this.unpressButton();
} else {
this.pressButton();
}
event.preventDefault();
// Check for escape (27) key
} else if (event.which == 27){
} else if (event.which === 27){
if (this.buttonPressed_){
this.unpressButton();
}
Expand Down
Loading

0 comments on commit e5595b1

Please sign in to comment.