/**
* Inputosaurus Text
*
* Must be instantiated on an element
* Allows multiple input items. Each item is represented with a removable tag that appears to be inside the input area.
*
* @requires:
*
* jQuery 1.7+
* jQueryUI 1.8+ Core
*
* @version 0.1.6
* @author Dan Kielp
* @created October 3,2012
*
*/
(function($) {
var inputosaurustext = {
version: "0.1.6",
eventprefix: "inputosaurus",
options: {
// bindable events
//
// 'change' - triggered whenever a tag is added or removed (should be similar to binding the the change event of the instantiated input
// 'keyup' - keyup event on the newly created input
// while typing, the user can separate values using these delimiters
// the value tags are created on the fly when an inputDelimiter is detected
inputDelimiters : [',', ';'],
// this separator is used to rejoin all input items back to the value of the original
outputDelimiter : ',',
allowDuplicates : false,
parseOnBlur : false,
// optional wrapper for widget
wrapperElement : null,
width : null,
// simply passing an autoComplete source (array, string or function) will instantiate autocomplete functionality
autoCompleteSource : '',
// When forcing users to select from the autocomplete list, allow them to press 'Enter' to select an item if it's the only option left.
activateFinalResult : false,
// manipulate and return the input value after parseInput() parsing
// the array of tag names is passed and expected to be returned as an array after manipulation
parseHook : null,
// define a placeholder to display when the input is empty
placeholder: null,
// when you check for duplicates it check for the case
caseSensitiveDuplicates: false
},
_create: function() {
var widget = this,
els = {},
o = widget.options,
placeholder = o.placeholder || this.element.attr('placeholder') || null;
this._chosenValues = [];
// Create the elements
els.ul = $('