<commit_before>( function( mw, $ ) {"use strict";
	mw.PluginManager.add( 'customButton', mw.KBaseComponent.extend({
			//indicates we were explicitly asked to show the button (will be used when re-enabling the button)
			shouldShow : false,
			isDisabled: false,
			defaultConfig: {
				'ariaText': '',
				'parent': 'videoHolder',
				'order': 20,
				'eventName' : 'custom_button_clicked'
			},
			setup: function() {
				this.addBindings();
			},

			addBindings: function() {
				var _this = this;
				$(this.getPlayer()).on('mouseenter', function() {
					_this.show();
				});
				$(this.getPlayer()).on('mouseleave', function(event) {
					if (event.relatedTarget !== _this.getComponent()) {
						_this.hide();
					}
				});

				this.bind('onpause onRemovePlayerSpinner', function(){
					if( !_this.embedPlayer.isPlaying() && !_this.embedPlayer.isInSequence() ){
						_this.show();
					}
				});
				this.bind('playing AdSupport_StartAdPlayback onAddPlayerSpinner onHideControlBar', function(){
					_this.hide(true);
				});
				this.bind('onPlayerStateChange', function(e, newState){
					if( newState === 'load' ){
						_this.show();
					}
					if( newState === 'pause' && _this.getPlayer().isPauseLoading ) {
						_this.hide();
					}
					if (newState === 'start') {
						_this.show();
					}
					if (newState === 'play') {
						_this.hide(true);
					}
				});

				this.bind('customButton.disable', function() {
					_this.onDisable();
				});

                this.bind('customButton.enable', function() {
                    _this.onEnable();
                });

			},
			show: function(){
				if ( !this.isDisabled ) {
					this.getComponent().show();
				}
				this.shouldShow = true;
			},
			hide: function( force ){
				this.hideComponent( force );
				this.shouldShow = false;
			},
			hideComponent: function( force ) {
				if( force ) {
					this.getComponent().hide();
				}
			},
			clickButton: function( event ){
				event.preventDefault();
				event.stopPropagation();
				this.embedPlayer.getPlayerElement().pause();
				this.getPlayer().sendNotification(this.getConfig('eventName'), this.embedPlayer.currentTime);
			},
			onEnable: function(){
				this.isDisabled = false;
				if ( this.shouldShow ) {
					this.getComponent().show();
				}
			},
			onDisable: function(){
				this.isDisabled = true;
				this.hideComponent(true);
			},
			getComponent: function() {
				var _this = this;
				var eventName = 'click';
				if (mw.isAndroid()){
					eventName = 'touchstart';
				}
				if( !this.$el ) {
					this.$el = $( '<a />' )
						.attr( {
							'tabindex': '-1',
							'href' : '#',
							'aria-label': this.getConfig("ariaText"),
							'title' : gM( 'mwe-customButton-label' ),
							'class'	: this.getCssClass()
						} )
						.hide()
						// Add click hook:
						.on(eventName, function(e) {<commit_msg>KMS-15695 can't access playerElement on yt entries (#3595)<commit_after>( function( mw, $ ) {"use strict";
	mw.PluginManager.add( 'customButton', mw.KBaseComponent.extend({
			//indicates we were explicitly asked to show the button (will be used when re-enabling the button)
			shouldShow : false,
			isDisabled: false,
			defaultConfig: {
				'ariaText': '',
				'parent': 'videoHolder',
				'order': 20,
				'eventName' : 'custom_button_clicked'
			},
			setup: function() {
				this.addBindings();
			},

			addBindings: function() {
				var _this = this;
				$(this.getPlayer()).on('mouseenter', function() {
					_this.show();
				});
				$(this.getPlayer()).on('mouseleave', function(event) {
					if (event.relatedTarget !== _this.getComponent()) {
						_this.hide();
					}
				});

				this.bind('onpause onRemovePlayerSpinner', function(){
					if( !_this.embedPlayer.isPlaying() && !_this.embedPlayer.isInSequence() ){
						_this.show();
					}
				});
				this.bind('playing AdSupport_StartAdPlayback onAddPlayerSpinner onHideControlBar', function(){
					_this.hide(true);
				});
				this.bind('onPlayerStateChange', function(e, newState){
					if( newState === 'load' ){
						_this.show();
					}
					if( newState === 'pause' && _this.getPlayer().isPauseLoading ) {
						_this.hide();
					}
					if (newState === 'start') {
						_this.show();
					}
					if (newState === 'play') {
						_this.hide(true);
					}
				});

				this.bind('customButton.disable', function() {
					_this.onDisable();
				});

                this.bind('customButton.enable', function() {
                    _this.onEnable();
                });

			},
			show: function(){
				if ( !this.isDisabled ) {
					this.getComponent().show();
				}
				this.shouldShow = true;
			},
			hide: function( force ){
				this.hideComponent( force );
				this.shouldShow = false;
			},
			hideComponent: function( force ) {
				if( force ) {
					this.getComponent().hide();
				}
			},
			clickButton: function( event ){
				event.preventDefault();
				event.stopPropagation();
                this.getPlayer().sendNotification('doPause');
				this.getPlayer().sendNotification(this.getConfig('eventName'), this.embedPlayer.currentTime);
			},
			onEnable: function(){
				this.isDisabled = false;
				if ( this.shouldShow ) {
					this.getComponent().show();
				}
			},
			onDisable: function(){
				this.isDisabled = true;
				this.hideComponent(true);
			},
			getComponent: function() {
				var _this = this;
				var eventName = 'click';
				if (mw.isAndroid()){
					eventName = 'touchstart';
				}
				if( !this.$el ) {
					this.$el = $( '<a />' )
						.attr( {
							'tabindex': '-1',
							'href' : '#',
							'aria-label': this.getConfig("ariaText"),
							'title' : gM( 'mwe-customButton-label' ),
							'class'	: this.getCssClass()
						} )
						.hide()
						// Add click hook:
						.on(eventName, function(e) {
{'fraction_non_alphanumeric': 0.17132987910189984, 'fraction_numerical': 0.0025906735751295338, 'mean_word_length': 2.5267965895249693, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4661106', 'n_tokens_mistral': 2514, 'n_tokens_neox': 1833, 'n_words': 337}