<commit_before>//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
//>>description: Custom-styled native input/buttons
//>>label: Buttons: Input or button-based
//>>group: Forms
//>>css.structure: ../css/structure/jquery.mobile.button.css
//>>css.theme: ../css/themes/default/jquery.mobile.theme.css

define( [ "jquery", "../../jquery.mobile.widget", "../../jquery.mobile.registry"  ], function( jQuery ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {

$.widget( "mobile.button", $.mobile.widget, {
	options: {
		theme: null,
		icon: null,
		iconpos: null,
		iconshadow: true,
		corners: true,
		shadow: true,
		inline: null,
		mini: null,
		disabled: false
	},

	_create: function() {
		var $button,
			$el = this.element,
			isInput = $el[ 0 ].tagName === "INPUT",
			classes = "ui-btn";
			
		if ( isInput ) {
			// TODO: When we have time to test thoroughly--any classes manually applied to the original element should be carried over to the enhanced element, with an `-enhanced` suffix. See https://github.com/jquery/jquery-mobile/issues/3577
			/* if ( $el[0].className.length ) {
				classes = $el[0].className;
			} */
			if ( !!~$el[ 0 ].className.indexOf( "ui-btn-left" ) ) {
				classes += " ui-btn-left";
			}
	
			if ( !!~$el[ 0 ].className.indexOf( "ui-btn-right" ) ) {
				classes += " ui-btn-right";
			}
	
			if ( $el.attr( "type" ) === "submit" || $el.attr( "type" ) === "reset" ) {
				classes += " ui-submit";
			}
			$( "label[for='" + $el.attr( "id" ) + "']" ).addClass( "ui-submit" );

			this.button = $( "<div></div>" )
				[ "text" ]( $el.val() )
				.insertBefore( $el )
				.addClass( classes )
				.append( $el.addClass( "ui-btn-hidden" ) );
				
			$button = this.button;
			
			this._on( $el, {
				focus: function() {
					$button.addClass( $.mobile.focusClass );
				},
	
				blur: function() {
					$button.removeClass( $.mobile.focusClass );
				}
			});
		} else {
			this.button = $el.addClass( classes );
		}
		
		if ( $el.is( ".ui-header > a, .ui-footer > a" ) ) {
			this.options.mini ? false : this._setOption( "mini", true );
			this.options.inline ? false : this._setOption( "inline", true );
		}
		
		$.extend( this, {
			isInput: isInput,
			buttonClasses: classes,
			styleClasses: ""
		});
		
		this.refresh( true );
	},
	
	widget: function() {
		return this.button;
	},
	
	_destroy: function() {
		if ( this.isInput ) {
			var $button = this.button;
			
			this.element.insertBefore( $button );
			
			$button.remove();
		} else {
			var removeClasses = this.buttonClasses + " " + this.styleClasses;
			
			this.button.removeClass( removeClasses );
		}
	},

	disable: function() {
		return this._setOption( "disabled", true );
	},
	
	enable: function() {
		return this._setOption( "disabled", false );
	},

	refresh: function( create ) {
		var o = this.options,
			$el = this.element,
			classes = "";

		if ( !o.theme ) {
			 o.theme = "a";<commit_msg>Button: Removed option disabled and enable/disable methods because the Widget Factory already implements them. Thanks Gabriel!<commit_after>//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
//>>description: Custom-styled native input/buttons
//>>label: Buttons: Input or button-based
//>>group: Forms
//>>css.structure: ../css/structure/jquery.mobile.button.css
//>>css.theme: ../css/themes/default/jquery.mobile.theme.css

define( [ "jquery", "../../jquery.mobile.widget", "../../jquery.mobile.registry"  ], function( jQuery ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {

$.widget( "mobile.button", $.mobile.widget, {
	options: {
		theme: null,
		icon: null,
		iconpos: null,
		iconshadow: true,
		corners: true,
		shadow: true,
		inline: null,
		mini: null
	},

	_create: function() {
		var $button,
			$el = this.element,
			isInput = $el[ 0 ].tagName === "INPUT",
			classes = "ui-btn";
			
		if ( isInput ) {
			// TODO: When we have time to test thoroughly--any classes manually applied to the original element should be carried over to the enhanced element, with an `-enhanced` suffix. See https://github.com/jquery/jquery-mobile/issues/3577
			/* if ( $el[0].className.length ) {
				classes = $el[0].className;
			} */
			if ( !!~$el[ 0 ].className.indexOf( "ui-btn-left" ) ) {
				classes += " ui-btn-left";
			}
	
			if ( !!~$el[ 0 ].className.indexOf( "ui-btn-right" ) ) {
				classes += " ui-btn-right";
			}
	
			if ( $el.attr( "type" ) === "submit" || $el.attr( "type" ) === "reset" ) {
				classes += " ui-submit";
			}
			$( "label[for='" + $el.attr( "id" ) + "']" ).addClass( "ui-submit" );

			this.button = $( "<div></div>" )
				[ "text" ]( $el.val() )
				.insertBefore( $el )
				.addClass( classes )
				.append( $el.addClass( "ui-btn-hidden" ) );
				
			$button = this.button;
			
			this._on( $el, {
				focus: function() {
					$button.addClass( $.mobile.focusClass );
				},
	
				blur: function() {
					$button.removeClass( $.mobile.focusClass );
				}
			});
		} else {
			this.button = $el.addClass( classes );
		}
		
		if ( $el.is( ".ui-header > a, .ui-footer > a" ) ) {
			this.options.mini ? false : this._setOption( "mini", true );
			this.options.inline ? false : this._setOption( "inline", true );
		}
		
		$.extend( this, {
			isInput: isInput,
			buttonClasses: classes,
			styleClasses: ""
		});
		
		this.refresh( true );
	},
	
	widget: function() {
		return this.button;
	},
	
	_destroy: function() {
		if ( this.isInput ) {
			var $button = this.button;
			
			this.element.insertBefore( $button );
			
			$button.remove();
		} else {
			var removeClasses = this.buttonClasses + " " + this.styleClasses;
			
			this.button.removeClass( removeClasses );
		}
	},

	refresh: function( create ) {
		var o = this.options,
			$el = this.element,
			classes = "";

		if ( !o.theme ) {
			 o.theme = "a";
{'fraction_non_alphanumeric': 0.19196967085990005, 'fraction_numerical': 0.003101843873858349, 'mean_word_length': 2.8108995403808272, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 39, 'https://': 2, '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': '4008326', 'n_tokens_mistral': 2354, 'n_tokens_neox': 1982, 'n_words': 444}