<commit_before>jQuery List Builder
====================
By: <NAME>   
Version: 1.0   
Requires: jQuery UI 1.7+ and jQuery 1.3.2+   
Demo: [http://jsfiddle.net/th3uiguy/MRu67/](http://jsfiddle.net/th3uiguy/MRu67/)



## Description ##

jQuery List Builder uses the jQuery UI [autocomplete](http://jqueryui.com/demos/autocomplete/) to convert a basic input into an email client like "To" field with autocompletion.




## Options ##
```
maxItems:
onAddButtonClick:
onlyAddFromSource:
beforeAddItem:
items:
onAddItem: 
onRemoveItem:
onMaxReached:
showRemoveIcon: 
autocompleteOptions: //see: http://jqueryui.com/demos/autocomplete/#options for these options
```

	
	
## Methods ##
### Add ###
Add an item to the list. Pass the new item as an object with `label`, `value` and `locked`.
  
	$('input').listBuilder('add', {label:"Apples", value:"100", locked:false});

### Count ###
Get the current number of items in the list

	$('input').listBuilder('count');
<commit_msg>Readme update<commit_after>jQuery List Builder
====================
By: <NAME>   
Version: 1.0   
Requires: jQuery UI 1.7+ and jQuery 1.3.2+   
Demo: [http://jsfiddle.net/th3uiguy/MRu67/](http://jsfiddle.net/th3uiguy/MRu67/)


## Description ##

jQuery List Builder uses the jQuery UI [autocomplete](http://jqueryui.com/demos/autocomplete/) to convert a basic input into an email client like "To" field with autocompletion.




## Options ##
#### maxItems ###
(Integer) The maximum number of items that the list should accept. When this limit is reached the `onMaxReached` function is called.

#### onMaxReached ###
(Function) Triggered when the number of items entered is more than `maxItems`.

	onMaxReached: function(item, $list){
		alert(item.label + ' could not be added');
	}

#### onAddButtonClick ###
(Function) Places an add button to the right of the input and triggers this function when the add button is clicked.

	onAddButtonClick: function(){
		
	}

#### onlyAddFromSource ###
(Boolean) When set to true, the user is only able to add items from the autocomplete `source`.

#### beforeAddItem ###
(Function) Called before an item is added. This function should return `true` or `false` to the callback signifying if the item should be added or not.

	beforeAddItem: function(item, callback){
		var toAdd = (item.value !== 'peas');
		callback(toAdd);
	}

#### items ###
(Array) An array of items to be added when listBuilder is being initialized. Items may have a `label`, `value` or `locked` attribute. 

*	The `label` should always be specified. 
*	When `value` is not specified the `label` attribute is used instead. 
*	The `locked` attribute will prevent a user from removing that element from the list and makes the list item appear like normal text in the field.

```
	items: [
		{"label": "Sharks"},
		{"label": "Sharks", "value": 233},
		{"label": "Sharks", "locked": true}
	]
```

#### onAddItem ###
(Function) Triggered after an item is added to the list.

	onAddItem: function(item){
		
	}

#### onRemoveItem ###
(Function) Triggered before an item is removed,  from the list.

	onRemoveItem: function(item, callback){
		var toRemove = (item.value === 'peas');
		callback(toRemove);
	}

#### showRemoveIcon ###
(Boolean) Flag to show the 'X' icon on each list item.

#### autocompleteOptions ###
See [http://jqueryui.com/demos/autocomplete/#options](http://jqueryui.com/demos/autocomplete/#options) for a full description of these options.




	
## Methods ##
### Add ###
Add an item to the list. Pass the new item as an object with `label`, `value` and `locked`.
  
	$('input').listBuilder('add', {label:"Apples", value:"100", locked:false});

### Count ###
Get the current number of items in the list

	$('input').listBuilder('count');

{'fraction_non_alphanumeric': 0.1482573726541555, 'fraction_numerical': 0.00938337801608579, 'mean_word_length': 4.430858806404658, 'pattern_counts': {'":': 5, '<': 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': '582302', 'n_tokens_mistral': 1199, 'n_tokens_neox': 1125, 'n_words': 417}