<commit_before>
define( function() {

	var handleHeaderRowCellRendered = function( e, args ) {
	
		if ( args.column.filter ) {
			$( args.node ).html( "<input type='text' data-column-field='" + args.column.field + "' placeholder='Search...' >" );
		} else if ( args.column.id === "_checkbox_selector" ) {
			$( args.node ).html( "<button class='slick-filter-clear'></button>" );
		}
	}
	
	, getSort = function() {
		
		var sortColumn = this.getSortColumns()[ 0 ], column;

		if ( !sortColumn ) {
		
			return {};
		}
		
		column = $G.getColumns()[ $G.getColumnIndex( sortColumn.columnId ) ];

		return {
			remoteSortField: column.field,
			remoteSortOrder: sortColumn.sortAsc ? "asc" : "desc"
		};
	};

	return function( $G, fastQuery ) {
	
		var dataView = $G.getData()
		
		, bar = $( $G.getHeaderRow() )

		, filters = {};
	
		$G.onHeaderRowCellRendered.unsubscribe( handleHeaderRowCellRendered );
		$G.onHeaderRowCellRendered.subscribe( handleHeaderRowCellRendered );

		/** Set the filter */
		dataView.setFilter( function( row, args ) {
			
			var value;

			/** Skip the new line */
			if ( row[ "_isNew" ] ) { return true; }

			for ( var field in filters ) {

				value = filters[ field ];

				if ( value 
					/** Fuzzy search */
					&& (row[ field ] || "").toString().toLowerCase().indexOf( value.toLowerCase() ) === -1 ) {
					return false;
				}
			}

			return true;
		} );

		bar

		/** Remove all keyup handler */
		.undelegate( "input:visible", "keyup" )	

		.delegate( "input:visible", "keyup", function( e ) {
			
			var self = $( this )
			, field = self.attr( "data-column-field" );

			e.stopPropagation();

			if ( field ) {
				
				filters[ field ] = self.val().replace( /^\s+|\s+$/g, "" );
				dataView.refresh();

				if ( fastQuery.is( ":checked" ) && 13 === e.keyCode ) {
					
					dataView.onPagingInfoChanged.notify( { doSearch: 1 } );

					e.stopPropagation();
				}
			}
		} )

		.delegate( "button.slick-filter-clear", "click", function( e ) {
		
			bar.find( "div.slick-headerrow-column input[data-column-field]" )

				.each( function() {
					$( this ).val( "" );
				} );

			/** Reset filter */
			dataView.setFilter();

			e.stopPropagation();
			e.preventDefault();
		} )
		
		.delegate( ".slick-headerrow-column", "click", function( e ) {
		
			$G.getEditorLock().isActive() && $G.getEditorLock().cancelCurrentEdit();

			e.stopPropagation();
		} );

		return {<commit_msg>Update Conditions.js<commit_after>
define( function() {

	var handleHeaderRowCellRendered = function( e, args ) {
	
		if ( args.column.filter ) {
			$( args.node ).html( "<input type='text' data-column-field='" + args.column.field + "' placeholder='Search...' >" );
		} else if ( args.column.id === "_checkbox_selector" ) {
			$( args.node ).html( "<button class='slick-filter-clear'></button>" );
		}
	}
	
	, getSort = function() {
		
		var sortColumn = this.getSortColumns()[ 0 ], column;

		if ( !sortColumn ) {
		
			return {};
		}
		
		column = $G.getColumns()[ $G.getColumnIndex( sortColumn.columnId ) ];

		return {
			remoteSortField: column.field,
			remoteSortOrder: sortColumn.sortAsc ? "asc" : "desc"
		};
	};

	return function( $G, fastQuery ) {
	
		var dataView = $G.getData()
		
		, bar = $( $G.getHeaderRow() )

		, filters = {};
	
		$G.onHeaderRowCellRendered.unsubscribe( handleHeaderRowCellRendered );
		$G.onHeaderRowCellRendered.subscribe( handleHeaderRowCellRendered );

		/** Set the filter */
		dataView.setFilter( function( row, args ) {
			
			var value;

			/** Skip the new line */
			if ( row[ "_isNew" ] ) { return true; }

			for ( var field in filters ) {

				value = filters[ field ];

				if ( value 
					/** Fuzzy search */
					&& (row[ field ] || "").toString().toLowerCase().indexOf( value.toLowerCase() ) === -1 ) {
					return false;
				}
			}

			return true;
		} );

		bar

		/** Remove all keyup handler */
		.undelegate( "input:visible", "keyup" )	

		.delegate( "input:visible", "keyup", function( e ) {
			
			var self = $( this )
			, field = self.attr( "data-column-field" );

			e.stopPropagation();

			if ( field ) {
				
				filters[ field ] = self.val().replace( /^\s+|\s+$/g, "" );
				dataView.refresh();

				if ( fastQuery.is( ":checked" ) && 13 === e.keyCode ) {
					
					dataView.onPagingInfoChanged.notify( { doSearch: 1 } );

					e.stopPropagation();
				}
			}
		} )

		.delegate( "button.slick-filter-clear", "click", function( e ) {
		
			bar.find( "div.slick-headerrow-column input[data-column-field]" )

				.each( function() {
					$( this ).val( "" );
				} );

			filters = {};
			dataView.refresh();

			e.stopPropagation();
			e.preventDefault();
		} )
		
		.delegate( ".slick-headerrow-column", "click", function( e ) {
		
			$G.getEditorLock().isActive() && $G.getEditorLock().cancelCurrentEdit();

			e.stopPropagation();
		} );

		return {
{'fraction_non_alphanumeric': 0.1846725883082008, 'fraction_numerical': 0.002065688907250568, 'mean_word_length': 2.736111111111111, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 9, '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': '6579313', 'n_tokens_mistral': 1995, 'n_tokens_neox': 1623, 'n_words': 322}