mirror of
https://github.com/videojs/video.js.git
synced 2024-12-31 03:11:11 +02:00
Use externs to prevent obfuscation
Instead of using string literals, create an externs file for the player and use that to ensure fullscreen functionality is never minified.
This commit is contained in:
parent
c69290c39f
commit
7efcbd5e19
@ -52,12 +52,12 @@ module.exports = function(grunt) {
|
||||
minify: {
|
||||
source:{
|
||||
src: ['build/files/combined.video.js', 'build/compiler/goog.base.js', 'src/js/exports.js'],
|
||||
externs: ['src/js/media/flash.externs.js'],
|
||||
externs: ['src/js/player.externs.js', 'src/js/media/flash.externs.js'],
|
||||
dest: 'build/files/minified.video.js'
|
||||
},
|
||||
tests: {
|
||||
src: ['build/files/combined.video.js', 'build/compiler/goog.base.js', 'src/js/exports.js', 'test/unit/*.js', '!test/unit/api.js'],
|
||||
externs: ['src/js/media/flash.externs.js', 'test/qunit/qunit-externs.js'],
|
||||
externs: ['src/js/player.externs.js', 'src/js/media/flash.externs.js', 'test/qunit/qunit-externs.js'],
|
||||
dest: 'build/files/test.minified.video.js'
|
||||
}
|
||||
},
|
||||
|
@ -23,11 +23,11 @@ vjs.FullscreenToggle.prototype.buildCSSClass = function(){
|
||||
};
|
||||
|
||||
vjs.FullscreenToggle.prototype.onClick = function(){
|
||||
if (!this.player_['isFullScreen']) {
|
||||
this.player_['requestFullScreen']();
|
||||
if (!this.player_.isFullScreen) {
|
||||
this.player_.requestFullScreen();
|
||||
this.el_.children[0].children[0].innerHTML = 'Non-Fullscreen'; // change the button text to "Non-Fullscreen"
|
||||
} else {
|
||||
this.player_['cancelFullScreen']();
|
||||
this.player_.cancelFullScreen();
|
||||
this.el_.children[0].children[0].innerHTML = 'Fullscreen'; // change the button to "Fullscreen"
|
||||
}
|
||||
};
|
||||
|
11
src/js/player.externs.js
Normal file
11
src/js/player.externs.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @fileoverview Externs for videojs.Player. Externs are functions that the
|
||||
* compiler shouldn't obfuscate.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fullscreen functionality
|
||||
*/
|
||||
videojs.Player.prototype.isFullScreen = undefined;
|
||||
videojs.Player.prototype.requestFullScreen = function(){};
|
||||
videojs.Player.prototype.cancelFullScreen = function(){};
|
Loading…
Reference in New Issue
Block a user