<commit_before>( function( mw, $ ) {"use strict";

/** 
 * Base screen component that allow to show overlay on top of the player 
**/

mw.KBaseScreen = mw.KBaseComponent.extend({

	$screen: null,
	templateData: null,
	iconBtnClass: '',

	// Returns KBaseComponent config with screen config
	getBaseConfig: function(){
		var parentConfig = this._super();
		return $.extend({}, parentConfig, {
			usePreviewPlayer: false,
			previewPlayerEnabled: false
		});
	},

	_addBindings: function(){
		var _this = this;
		// Make sure we will call _addBindings on KBaseComponent
		this._super();

		this.bind('playerReady', $.proxy(function(){
			this.templateData = null;
			this.removeScreen();
		}, this));

		this.bind('onplay', $.proxy(function(){
			if( this.isScreenVisible() ){
				setTimeout(function(){
					_this.getPlayer().disableComponentsHover();
				},50);
				if( this.hasPreviewPlayer() ){
					this.resizePlayer();

				} else {
					this.hideScreen();

				}
			}
		}, this));

		this.bind('playerSizeClassUpdate', $.proxy(function(e, size){
			if( size == 'tiny' ){
				this.setConfig('previewPlayerEnabled', false);
			} else {
				this.setConfig('previewPlayerEnabled', true);
			}
		}, this));

		this.bind('closeOpenScreens', $.proxy(function(e, opener){
			if( this.pluginName !== opener )
				this.hideScreen();
		}, this));
	},

	removeScreen: function(){
		if( this.$screen ){
			this.$screen.remove();
			this.$screen = null;
		}
	},
	hideScreen: function(){
		if( this.hasPreviewPlayer() ){
			this.restorePlayer();
		} else {
			this.restorePlayback();
		}
		if (this.getPlayer().isPlaying()) {
			this.getPlayer().restoreComponentsHover();
		}
		this.getScreen().fadeOut(400);

	},
	showScreen: function(){
		this._hideAllScreens(this.pluginName);
		if( this.hasPreviewPlayer() ){
			this.resizePlayer();
		} else {
			this.pausePlayback();
		}
		this.getPlayer().disableComponentsHover();
		this.getScreen().fadeIn(400);

	},
	toggleScreen: function(){
		if( this.isDisabled ) return ;
		if( this.isScreenVisible() ){
			this.hideScreen();
		} else {
			this.showScreen();
		}
	},
	isScreenVisible: function(){
		return (!this.$screen) ? false : this.getScreen().is(':visible');
	},
	hasPreviewPlayer: function(){
		return this.getConfig('usePreviewPlayer') && this.getConfig('previewPlayerEnabled');
	},
	pausePlayback: function(){
		this.wasPlaying = this.getPlayer().isPlaying();
		if( this.wasPlaying ){
			this.getPlayer().pause();
		}
	},<commit_msg>FEC-1839 don't null tempalteData in base screen class<commit_after>( function( mw, $ ) {"use strict";

/** 
 * Base screen component that allow to show overlay on top of the player 
**/

mw.KBaseScreen = mw.KBaseComponent.extend({

	$screen: null,
	templateData: null,
	iconBtnClass: '',

	// Returns KBaseComponent config with screen config
	getBaseConfig: function(){
		var parentConfig = this._super();
		return $.extend({}, parentConfig, {
			usePreviewPlayer: false,
			previewPlayerEnabled: false
		});
	},

	_addBindings: function(){
		var _this = this;
		// Make sure we will call _addBindings on KBaseComponent
		this._super();

		this.bind('playerReady', $.proxy(function(){
			this.removeScreen();
		}, this));

		this.bind('onplay', $.proxy(function(){
			if( this.isScreenVisible() ){
				setTimeout(function(){
					_this.getPlayer().disableComponentsHover();
				},50);
				if( this.hasPreviewPlayer() ){
					this.resizePlayer();

				} else {
					this.hideScreen();

				}
			}
		}, this));

		this.bind('playerSizeClassUpdate', $.proxy(function(e, size){
			if( size == 'tiny' ){
				this.setConfig('previewPlayerEnabled', false);
			} else {
				this.setConfig('previewPlayerEnabled', true);
			}
		}, this));

		this.bind('closeOpenScreens', $.proxy(function(e, opener){
			if( this.pluginName !== opener )
				this.hideScreen();
		}, this));
	},

	removeScreen: function(){
		if( this.$screen ){
			this.$screen.remove();
			this.$screen = null;
		}
	},
	hideScreen: function(){
		if( this.hasPreviewPlayer() ){
			this.restorePlayer();
		} else {
			this.restorePlayback();
		}
		if (this.getPlayer().isPlaying()) {
			this.getPlayer().restoreComponentsHover();
		}
		this.getScreen().fadeOut(400);

	},
	showScreen: function(){
		debugger;
		this._hideAllScreens(this.pluginName);
		if( this.hasPreviewPlayer() ){
			this.resizePlayer();
		} else {
			this.pausePlayback();
		}
		this.getPlayer().disableComponentsHover();
		this.getScreen().fadeIn(400);

	},
	toggleScreen: function(){
		if( this.isDisabled ) return ;
		if( this.isScreenVisible() ){
			this.hideScreen();
		} else {
			this.showScreen();
		}
	},
	isScreenVisible: function(){
		return (!this.$screen) ? false : this.getScreen().is(':visible');
	},
	hasPreviewPlayer: function(){
		return this.getConfig('usePreviewPlayer') && this.getConfig('previewPlayerEnabled');
	},
	pausePlayback: function(){
		this.wasPlaying = this.getPlayer().isPlaying();
		if( this.wasPlaying ){
			this.getPlayer().pause();
		}
	},
{'fraction_non_alphanumeric': 0.17185304155792008, 'fraction_numerical': 0.004015257980325236, 'mean_word_length': 3.908374384236453, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5930284', 'n_tokens_mistral': 1876, 'n_tokens_neox': 1589, 'n_words': 310}