1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-04 06:48:49 +02:00

Several minor code improvements.

Actually, tracks.js contains several pieces of code which could
be re-written more effectively. The problem is that in some places
there are conditional checks like this:

    if (condition) {
        call_setter( true);
    } else {
        call_setter( false);
    }

which could be re-written to:

    call_setter( condition);

This improvement saves some bytes of code length, traffic and should
also work more effectively by utilizing less machine resources
This commit is contained in:
mstadnyk 2013-06-17 00:18:21 +03:00
parent 0ddf8af452
commit 3a40dcd883

View File

@ -742,11 +742,7 @@ vjs.TextTrackMenuItem.prototype.onClick = function(){
};
vjs.TextTrackMenuItem.prototype.update = function(){
if (this.track.mode() == 2) {
this.selected(true);
} else {
this.selected(false);
}
this.selected(this.track.mode() == 2);
};
/**
@ -786,11 +782,7 @@ vjs.OffTextTrackMenuItem.prototype.update = function(){
}
}
if (off) {
this.selected(true);
} else {
this.selected(false);
}
this.selected(off);
};
/* Captions Button
@ -999,11 +991,9 @@ vjs.ChaptersTrackMenuItem.prototype.update = function(){
currentTime = this.player_.currentTime();
// vjs.log(currentTime, cue.startTime);
if (cue.startTime <= currentTime && currentTime < cue.endTime) {
this.selected(true);
} else {
this.selected(false);
}
this.selected(
cue.startTime <= currentTime && currentTime < cue.endTime
);
};
// Add Buttons to controlBar