/* Script: TextboxList.js Displays a textbox as a combination of boxes an inputs (eg: facebook tokenizer) Authors: Guillermo Rauch Note: TextboxList is not priceless for commercial use. See . Purchase to remove this message. */ (function($){ $.TextboxList = function(element, _options){ var original, container, list, current, focused = false, index = [], blurtimer, events = {}; var options = $.extend(true, { prefix: 'textboxlist', max: null, unique: false, uniqueInsensitive: true, startEditableBit: true, hideEditableBits: true, inBetweenEditableBits: true, keys: {previous: 37, next: 39}, bitsOptions: {editable: {}, box: {}}, plugins: {}, // tip: you can change encode/decode with JSON.stringify and JSON.parse encode: function(o){ return $.grep($.map(o, function(v){ v = (chk(v[0]) ? v[0] : v[1]); return chk(v) ? v.toString().replace(/,/, '') : null; }), function(o){ return o != undefined; }).join(','); }, decode: function(o){ return o.split(','); } }, _options); element = $(element); var self = this; var init = function(){ original = element.css('display', 'none').attr('autocomplete', 'off').focus(focusLast); container = $('
') .insertAfter(element) .click(function(e){ if ((e.target == list.get(0) || e.target == container.get(0)) && (!focused || (current && current.toElement().get(0) != list.find(':last-child').get(0)))) focusLast(); }); list = $('