<commit_before>//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
//>>description: Responsive presentation and behavior for HTML data panels
//>>label: Panel
//>>group: Widgets
//>>css.structure: ../css/structure/jquery.mobile.panel.css
//>>css.theme: ../css/themes/default/jquery.mobile.theme.css

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

$.widget( "mobile.panel", $.mobile.widget, {
	options: {
		classes: {
			panel: "ui-panel"
		},
		theme: null,
		position: "left",
		dismissible: true,
		display: "push",
		initSelector: ":jqmData(role='panel')"
	},
	_handleLink: function( roleType , callback ){
		var elId = this.element.attr( "id" );
		$( document ).bind( "pagebeforechange", function( e, data ) {
			var $link, id;
			if ( data.options.role === roleType ) {
				e.preventDefault();

				$link = data.options.link;
				id = $link.attr( "href" ).split( "#" )[1];
				if( elId === id ){
					callback( $link , id );
				}
				return false;
			}
		});
	},
	_create: function() {
		var o = this.options,
			klass = o.classes.panel,
			$el = this.element,
			$closeLink = $el.find( "[data-rel=close]" );

		$el.addClass( klass + "-hide" )
			.addClass( klass );
		if( o.theme ){
			$el.addClass( "ui-body-" + o.theme );
		}
		this._handleLink( "panel" , function( $link , id ){
			$( "#" + id ).panel( "toggle" , {
				position: $link.jqmData( "position" ),//left right top
				dismissible: $link.jqmData( "dismissible" ),//true or false
				display: $link.jqmData( "display" )// overlay or push
			});
		});
		$closeLink.on( "click" , function( e ){
			e.preventDefault();
			$el.panel( "close" );
			return false;
		});
		this._trigger( "create" );
	},
	_destroy: function(){},
	open: function( options ){
		var o = this.options,
			klass = o.classes.panel,
			$el = this.element;
		options = options || {};
		options.position = options.position || o.position;
		options.dismissible = options.dismissible === false ? false : o.dismissible;
		options.display = options.display || o.display;

		$el.addClass( klass + "-position-" + options.position )
			.addClass( klass + "-dismissible-" + options.dismissible )
			.addClass( klass + "-display-" + options.display )
			.removeClass( klass + "-hide" )
			.jqmData( "position" , options.position )
			.jqmData( "display" , options.display )
			.jqmData( "dismissible" , options.dismissible );
		if( options.display === "push" ){
			$( ".ui-content, .ui-header, .ui-footer" ).addClass( "panel-shift-" + options.position );
		} else {
			$( ".ui-content, .ui-header, .ui-footer" ).removeClass( "panel-shift-" + options.position );
		}
		$el.removeClass( klass + "-hidden" );
		$.mobile.panel.active = this;
		this._trigger( "open" );
		return this;
	},
	close: function(){
		var klass = this.options.classes.panel,
			$el = this.element,
			position = $el.jqmData( "position" ),
			display = $el.jqmData( "display" ),
			dismissible = $el.jqmData( "dismissible" );
		$( ".ui-content, .ui-header, .ui-footer" ).removeClass( "panel-shift-" + position );
		$el.removeClass( klass + "-position-" + position )
			.removeClass( klass + "-display-" + display )<commit_msg>A little code cleanup.<commit_after>//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
//>>description: Responsive presentation and behavior for HTML data panels
//>>label: Panel
//>>group: Widgets
//>>css.structure: ../css/structure/jquery.mobile.panel.css
//>>css.theme: ../css/themes/default/jquery.mobile.theme.css

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

$.widget( "mobile.panel", $.mobile.widget, {
	options: {
		classes: {
			panel: "ui-panel"
		},
		theme: null,
		position: "left",
		dismissible: true,
		display: "push",
		initSelector: ":jqmData(role='panel')"
	},
	_handleLink: function( roleType , callback ){
		var elId = this.element.attr( "id" );
		$( document ).bind( "pagebeforechange", function( e, data ) {
			var $link, id;
			if ( data.options.role === roleType ) {
				e.preventDefault();

				$link = data.options.link;
				id = $link.attr( "href" ).split( "#" )[1];
				if( elId === id ){
					callback( $link , id );
				}
				return false;
			}
		});
	},
	_create: function() {
		var o = this.options,
			klass = o.classes.panel,
			$el = this.element,
			$closeLink = $el.find( "[data-rel=close]" );

		$el.addClass( klass + "-hide" )
			.addClass( klass );
		if( o.theme ){
			$el.addClass( "ui-body-" + o.theme );
		}
		this._handleLink( "panel" , function( $link , id ){
			$( "#" + id ).panel( "toggle" , {
				position: $link.jqmData( "position" ),//left right top
				dismissible: $link.jqmData( "dismissible" ),//true or false
				display: $link.jqmData( "display" )// overlay or push
			});
		});
		$closeLink.on( "click" , function( e ){
			e.preventDefault();
			$el.panel( "close" );
			return false;
		});
		this._trigger( "create" );
	},
	_destroy: function(){},
	open: function( options ){
		var o = this.options,
			klass = o.classes.panel,
			$el = this.element;
		for( var i in options ){
			if( options.hasOwnProperty( i ) ){
				o[ i ] = options [ i ];
			}
		}
		$el.addClass( klass + "-position-" + o.position )
			.addClass( klass + "-dismissible-" + o.dismissible )
			.addClass( klass + "-display-" + o.display )
			.removeClass( klass + "-hide" )
			.jqmData( "position" , o.position )
			.jqmData( "display" , o.display )
			.jqmData( "dismissible" , o.dismissible );
		if( o.display === "push" ){
			$( ".ui-content, .ui-header, .ui-footer" ).addClass( "panel-shift-" + o.position );
		} else {
			$( ".ui-content, .ui-header, .ui-footer" ).removeClass( "panel-shift-" + o.position );
		}
		$el.removeClass( klass + "-hidden" );
		$.mobile.panel.active = this;
		this._trigger( "open" );
		return this;
	},
	close: function(){
		var klass = this.options.classes.panel,
			$el = this.element,
			position = $el.jqmData( "position" ),
			display = $el.jqmData( "display" ),
			dismissible = $el.jqmData( "dismissible" );
		$( ".ui-content, .ui-header, .ui-footer" ).removeClass( "panel-shift-" + position );
		$el.removeClass( klass + "-position-" + position )
			.removeClass( klass + "-display-" + display )
{'fraction_non_alphanumeric': 0.20142067876874506, 'fraction_numerical': 0.00031570639305445933, 'mean_word_length': 3.1932495036399735, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 31, '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': '4510773', 'n_tokens_mistral': 2503, 'n_tokens_neox': 2206, 'n_words': 490}