From 25fdaf66b883786311287d422683b0eabec3d183 Mon Sep 17 00:00:00 2001 From: Floorb <132411956+Neetpone@users.noreply.github.com> Date: Sun, 22 Aug 2021 22:08:43 -0400 Subject: [PATCH] Delete probably unused stuff --- assets/.htaccess | 1 - assets/app.css | 66 -- assets/app.js | 15 - assets/app_bs2.js | 84 --- assets/app_bs3.js | 101 --- assets/cities.json | 77 --- assets/citynames.json | 17 - assets/jquery.limitText.js | 155 ----- assets/jquery.limitText.min.js | 2 - dist/bootstrap-tagsinput-angular.js | 93 --- dist/bootstrap-tagsinput-angular.min.js | 7 - dist/bootstrap-tagsinput-angular.min.js.map | 61 -- dist/bootstrap-tagsinput.css | 66 -- dist/bootstrap-tagsinput.js | 667 -------------------- dist/bootstrap-tagsinput.less | 53 -- dist/bootstrap-tagsinput.min.js | 7 - dist/bootstrap-tagsinput.min.js.map | 194 ------ dist/bootstrap-tagsinput.zip | Bin 52110 -> 0 bytes 18 files changed, 1666 deletions(-) delete mode 100644 assets/.htaccess delete mode 100644 assets/app.css delete mode 100644 assets/app.js delete mode 100644 assets/app_bs2.js delete mode 100644 assets/app_bs3.js delete mode 100644 assets/cities.json delete mode 100644 assets/citynames.json delete mode 100644 assets/jquery.limitText.js delete mode 100644 assets/jquery.limitText.min.js delete mode 100644 dist/bootstrap-tagsinput-angular.js delete mode 100644 dist/bootstrap-tagsinput-angular.min.js delete mode 100644 dist/bootstrap-tagsinput-angular.min.js.map delete mode 100644 dist/bootstrap-tagsinput.css delete mode 100644 dist/bootstrap-tagsinput.js delete mode 100644 dist/bootstrap-tagsinput.less delete mode 100644 dist/bootstrap-tagsinput.min.js delete mode 100644 dist/bootstrap-tagsinput.min.js.map delete mode 100644 dist/bootstrap-tagsinput.zip diff --git a/assets/.htaccess b/assets/.htaccess deleted file mode 100644 index 3418e55..0000000 --- a/assets/.htaccess +++ /dev/null @@ -1 +0,0 @@ -deny from all \ No newline at end of file diff --git a/assets/app.css b/assets/app.css deleted file mode 100644 index 31bc6c3..0000000 --- a/assets/app.css +++ /dev/null @@ -1,66 +0,0 @@ -.icon-github { - background: no-repeat url('../img/github-16px.png'); - width: 16px; - height: 16px; -} - -.bootstrap-tagsinput { - width: 100%; -} - -.accordion { - margin-bottom: -3px; -} - -.accordion-group { - border: none; -} - -.twitter-typeahead .tt-query, -.twitter-typeahead .tt-hint { - margin-bottom: 0; -} - -.twitter-typeahead .tt-hint { - display: none; -} - -.tt-menu { - position: absolute; - top: 100%; - left: 0; - z-index: 1000; - display: none; - float: left; - min-width: 160px; - padding: 5px 0; - margin: 2px 0 0; - list-style: none; - font-size: 14px; - background-color: #ffffff; - border: 1px solid #cccccc; - border: 1px solid rgba(0, 0, 0, 0.15); - border-radius: 4px; - -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); - box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); - background-clip: padding-box; - cursor: pointer; -} - -.tt-suggestion { - display: block; - padding: 3px 20px; - clear: both; - font-weight: normal; - line-height: 1.428571429; - color: #333333; - white-space: nowrap; -} - -.tt-suggestion:hover, -.tt-suggestion:focus { - color: #ffffff; - text-decoration: none; - outline: 0; - background-color: #428bca; -} diff --git a/assets/app.js b/assets/app.js deleted file mode 100644 index 5bba856..0000000 --- a/assets/app.js +++ /dev/null @@ -1,15 +0,0 @@ -$(function () { - $('input, select').on('change', function (event) { - var $element = $(event.target), - $container = $element.closest('.example'); - - if (!$element.data('tagsinput')) - return; - - var val = $element.val(); - if (val === null) - val = "null"; - $('code', $('pre.val', $container)).html(($.isArray(val) ? JSON.stringify(val) : "\"" + val.replace('"', '\\"') + "\"")); - $('code', $('pre.items', $container)).html(JSON.stringify($element.tagsinput('items'))); - }).trigger('change'); -}); \ No newline at end of file diff --git a/assets/app_bs2.js b/assets/app_bs2.js deleted file mode 100644 index 2de912f..0000000 --- a/assets/app_bs2.js +++ /dev/null @@ -1,84 +0,0 @@ -$('.example_typeahead > > input').tagsinput({ - typeahead: { - source: function (query) { - return $.getJSON('assets/citynames.json'); - } - } -}); - -$('.example_objects_as_tags > > input').tagsinput({ - itemValue: 'value', - itemText: 'text', - typeahead: { - source: function (query) { - return $.getJSON('assets/cities.json'); - } - } -}); -$('.example_objects_as_tags > > input').tagsinput('add', {"value": 1, "text": "Amsterdam", "continent": "Europe"}); -$('.example_objects_as_tags > > input').tagsinput('add', {"value": 4, "text": "Washington", "continent": "America"}); -$('.example_objects_as_tags > > input').tagsinput('add', {"value": 7, "text": "Sydney", "continent": "Australia"}); -$('.example_objects_as_tags > > input').tagsinput('add', {"value": 10, "text": "Beijing", "continent": "Asia"}); -$('.example_objects_as_tags > > input').tagsinput('add', {"value": 13, "text": "Cairo", "continent": "Africa"}); - -$('.example_tagclass > > input').tagsinput({ - tagClass: function (item) { - switch (item.continent) { - case 'Europe' : - return 'label label-info'; - case 'America' : - return 'label label-danger label-important'; - case 'Australia': - return 'label label-success'; - case 'Africa' : - return 'label'; - case 'Asia' : - return 'label label-warning'; - } - }, - itemValue: 'value', - itemText: 'text', - typeahead: { - source: function (query) { - return $.getJSON('assets/cities.json'); - } - } -}); -$('.example_tagclass > > input').tagsinput('add', {"value": 1, "text": "Amsterdam", "continent": "Europe"}); -$('.example_tagclass > > input').tagsinput('add', {"value": 4, "text": "Washington", "continent": "America"}); -$('.example_tagclass > > input').tagsinput('add', {"value": 7, "text": "Sydney", "continent": "Australia"}); -$('.example_tagclass > > input').tagsinput('add', {"value": 10, "text": "Beijing", "continent": "Asia"}); -$('.example_tagclass > > input').tagsinput('add', {"value": 13, "text": "Cairo", "continent": "Africa"}); - -angular.module('AngularExample', ['bootstrap-tagsinput']) - .controller('CityTagsInputController', - function CityTagsInputController($scope, $http) { - // Init with some cities - $scope.cities = [ - {"value": 1, "text": "Amsterdam", "continent": "Europe"}, - {"value": 4, "text": "Washington", "continent": "America"}, - {"value": 7, "text": "Sydney", "continent": "Australia"}, - {"value": 10, "text": "Beijing", "continent": "Asia"}, - {"value": 13, "text": "Cairo", "continent": "Africa"} - ]; - - $scope.queryCities = function (query) { - return $http.get('assets/cities.json'); - }; - - $scope.getTagClass = function (city) { - switch (city.continent) { - case 'Europe' : - return 'label label-info'; - case 'America' : - return 'label label-danger label-important'; - case 'Australia': - return 'label label-success'; - case 'Africa' : - return 'label'; - case 'Asia' : - return 'label label-warning'; - } - }; - } - ); \ No newline at end of file diff --git a/assets/app_bs3.js b/assets/app_bs3.js deleted file mode 100644 index cc019ba..0000000 --- a/assets/app_bs3.js +++ /dev/null @@ -1,101 +0,0 @@ -var citynames = new Bloodhound({ - datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'), - queryTokenizer: Bloodhound.tokenizers.whitespace, - prefetch: { - url: 'assets/citynames.json', - filter: function (list) { - return $.map(list, function (cityname) { - return {name: cityname}; - }); - } - } -}); -citynames.initialize(); - -var cities = new Bloodhound({ - datumTokenizer: Bloodhound.tokenizers.obj.whitespace('text'), - queryTokenizer: Bloodhound.tokenizers.whitespace, - prefetch: 'assets/cities.json' -}); -cities.initialize(); - -/** - * Typeahead - */ -var elt = $('.example_typeahead > > input'); -elt.tagsinput({ - typeaheadjs: { - name: 'citynames', - displayKey: 'name', - valueKey: 'name', - source: citynames.ttAdapter() - } -}); - -/** - * Objects as tags - */ -elt = $('.example_objects_as_tags > > input'); -elt.tagsinput({ - itemValue: 'value', - itemText: 'text', - typeaheadjs: { - name: 'cities', - displayKey: 'text', - source: cities.ttAdapter() - } -}); - -elt.tagsinput('add', {"value": 1, "text": "Amsterdam", "continent": "Europe"}); -elt.tagsinput('add', {"value": 4, "text": "Washington", "continent": "America"}); -elt.tagsinput('add', {"value": 7, "text": "Sydney", "continent": "Australia"}); -elt.tagsinput('add', {"value": 10, "text": "Beijing", "continent": "Asia"}); -elt.tagsinput('add', {"value": 13, "text": "Cairo", "continent": "Africa"}); - -/** - * Categorizing tags - */ -elt = $('.example_tagclass > > input'); -elt.tagsinput({ - tagClass: function (item) { - switch (item.continent) { - case 'Europe' : - return 'label label-primary'; - case 'America' : - return 'label label-danger label-important'; - case 'Australia': - return 'label label-success'; - case 'Africa' : - return 'label label-default'; - case 'Asia' : - return 'label label-warning'; - } - }, - itemValue: 'value', - itemText: 'text', - // typeaheadjs: { - // name: 'cities', - // displayKey: 'text', - // source: cities.ttAdapter() - // } - typeaheadjs: [ - { - hint: true, - highlight: true, - minLength: 2 - }, - { - name: 'cities', - displayKey: 'text', - source: cities.ttAdapter() - } - ] -}); -elt.tagsinput('add', {"value": 1, "text": "Amsterdam", "continent": "Europe"}); -elt.tagsinput('add', {"value": 4, "text": "Washington", "continent": "America"}); -elt.tagsinput('add', {"value": 7, "text": "Sydney", "continent": "Australia"}); -elt.tagsinput('add', {"value": 10, "text": "Beijing", "continent": "Asia"}); -elt.tagsinput('add', {"value": 13, "text": "Cairo", "continent": "Africa"}); - -// HACK: overrule hardcoded display inline-block of typeahead.js -$(".twitter-typeahead").css('display', 'inline'); diff --git a/assets/cities.json b/assets/cities.json deleted file mode 100644 index a270b6e..0000000 --- a/assets/cities.json +++ /dev/null @@ -1,77 +0,0 @@ -[ - { - "value": 1, - "text": "Amsterdam", - "continent": "Europe" - }, - { - "value": 2, - "text": "London", - "continent": "Europe" - }, - { - "value": 3, - "text": "Paris", - "continent": "Europe" - }, - { - "value": 4, - "text": "Washington", - "continent": "America" - }, - { - "value": 5, - "text": "Mexico City", - "continent": "America" - }, - { - "value": 6, - "text": "Buenos Aires", - "continent": "America" - }, - { - "value": 7, - "text": "Sydney", - "continent": "Australia" - }, - { - "value": 8, - "text": "Wellington", - "continent": "Australia" - }, - { - "value": 9, - "text": "Canberra", - "continent": "Australia" - }, - { - "value": 10, - "text": "Beijing", - "continent": "Asia" - }, - { - "value": 11, - "text": "New Delhi", - "continent": "Asia" - }, - { - "value": 12, - "text": "Kathmandu", - "continent": "Asia" - }, - { - "value": 13, - "text": "Cairo", - "continent": "Africa" - }, - { - "value": 14, - "text": "Cape Town", - "continent": "Africa" - }, - { - "value": 15, - "text": "Kinshasa", - "continent": "Africa" - } -] \ No newline at end of file diff --git a/assets/citynames.json b/assets/citynames.json deleted file mode 100644 index 5e2ab9e..0000000 --- a/assets/citynames.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - "Amsterdam", - "London", - "Paris", - "Washington", - "New York", - "Los Angeles", - "Sydney", - "Melbourne", - "Canberra", - "Beijing", - "New Delhi", - "Kathmandu", - "Cairo", - "Cape Town", - "Kinshasa" -] \ No newline at end of file diff --git a/assets/jquery.limitText.js b/assets/jquery.limitText.js deleted file mode 100644 index 5c7e3b1..0000000 --- a/assets/jquery.limitText.js +++ /dev/null @@ -1,155 +0,0 @@ -/* ======================================================================== - * jquery.limitText.js v0.0.1 - * - * ======================================================================== - * Copyright 2015 Phillip Molaro - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== - * - * Usage: - * - -
- - - * - * Options: - * @param limit (integer) - The cutoff character count for the field - * Default: 200 - * @param warningLimit (integer) - The remaining character count to trigger class change - * Default: 10 - * @param statusMessage (string) - A jQuery selector to id an existing status container DOM element - * If left empty, a default will be added after the element - * Default: '' - * @param counterClass (string) - Class to apply to the status area, and replaced on warning - * Default: 'text-primary' (Bootstrap helper class) - * @param warningClass (string) - Class applied to status area when warningLimit is reached. - * Replaces the counterClass on warning - * Default: 'text-danger' (Bootstrap helper class) - * @param containerElement (string) - DOM element to be inserted if statusMessage is undefined - * Default: '
' - * @param containerClass (string) - Class applied to the status container. - * Default: 'limit-text-status' (no definition) - */ - - -+function ($) { - - 'use strict'; - - /** - * LimitText Class Definition - */ - var LimitText = function (element, options) { - this.options = options; - this.$element = $(element); - // if an existing container is not defined, then a default will be created - this.$status = (this.options.statusMessage.length) ? - $(this.options.statusMessage) : $(this.options.containerElement); - - // Add classes to the status container, and insert base text - this.$status - .addClass(this.options.containerClass + ' ' + this.options.counterClass) - .append('' + - this.options.limit + ' characters remaining'); - - // reference not available til we've appended the html snippet - this.$count = $('strong', this.$status); - - // insert the default message container if one isn't already defined - if (!this.options.statusMessage.length) this.$element.after(this.$status); - - // set our event handler and proxy it to properly set the context - this.$element.on('input.limitText.data-api propertychange.limitText.data-api', $.proxy(this.checkCount, this)); - - // and run initial check of current value - this.checkCount(); - }; - - LimitText.VERSION = '0.0.1'; - LimitText.NAME = 'limitText'; - - LimitText.DEFAULTS = { - limit: 200, - warningLimit: 10, - statusMessage: '', - // These two are Bootstrap text emphasis classes - // that you can override in the config, or roll - // your own of the same name - counterClass: 'text-primary', - warningClass: 'text-danger', - // The default container element is only used if an - // existing container (statusMessage) is not defined - containerElement: '
', - containerClass: 'limit-text-status' - }; - - LimitText.prototype.checkCount = function () { - var currVal = this.$element.val(); - - if (currVal.length > this.options.limit) { - // reset the currVal, so that it stays within the limit - currVal = currVal.substr(0, this.options.limit - 1); - this.$element.val(currVal); - } - - var remaining = this.options.limit - currVal.length; - - this.$count.html(remaining); - - if (remaining <= this.options.warningLimit) { - this.$status.removeClass(this.options.counterClass).addClass(this.options.warningClass); - } else { - this.$status.removeClass(this.options.warningClass).addClass(this.options.counterClass); - } - }; - - LimitText.prototype.destroy = function () { - $.removeData(this.$element[0], 'limitText'); - - // remove the inserted status container - if (!this.options.statusMessage.length) { - this.$status.remove(); - } else { - this.$status - .removeClass( - this.options.containerClass + ' ' + - this.options.counterClass + ' ' + - this.options.warningClass) - .empty(); - } - - this.$element.off('input.limitText.data-api propertychange.limitText.data-api'); - this.$element = null; - }; - - // limitText Plugin Definition - - function Plugin(option) { - return this.each(function () { - var $this = $(this), - data = $this.data('limitText'), - options = $.extend({}, LimitText.DEFAULTS, $this.data(), typeof option == 'object' && option); - - if (!data) $this.data('limitText', (data = new LimitText(this, options))); - if (typeof option == 'string') data[option](); - }); - } - - var old = $.fn.limitText; - - $.fn.limitText = Plugin; - $.fn.limitText.Constructor = LimitText; - - // limitText No Conflict - - $.fn.limitText.noConflict = function () { - $.fn.limitText = old; - return this; - }; - -}(jQuery); \ No newline at end of file diff --git a/assets/jquery.limitText.min.js b/assets/jquery.limitText.min.js deleted file mode 100644 index 69108bc..0000000 --- a/assets/jquery.limitText.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/* jquery.limitText.js v0.0.1 - (c)2015 Phillip Molaro - MIT Licensed https://github.com/twbs/bootstrap/blob/master/LICENSE */ -+function(t){"use strict";var s=function(s,i){this.options=i,this.$element=t(s),this.$status=t(this.options.statusMessage.length?this.options.statusMessage:this.options.containerElement),this.$status.addClass(this.options.containerClass+" "+this.options.counterClass).append(""+this.options.limit+" characters remaining"),this.$count=t("strong",this.$status),this.options.statusMessage.length||this.$element.after(this.$status),this.$element.on("input.limitText.data-api propertychange.limitText.data-api",t.proxy(this.checkCount,this)),this.checkCount()};s.VERSION="0.0.1",s.NAME="limitText",s.DEFAULTS={limit:200,warningLimit:10,statusMessage:"",counterClass:"text-primary",warningClass:"text-danger",containerElement:"
",containerClass:"limit-text-status"},s.prototype.checkCount=function(){var t=this.$element.val();t.length>this.options.limit&&(t=t.substr(0,this.options.limit-1),this.$element.val(t));var s=this.options.limit-t.length;this.$count.html(s),s<=this.options.warningLimit?this.$status.removeClass(this.options.counterClass).addClass(this.options.warningClass):this.$status.removeClass(this.options.warningClass).addClass(this.options.counterClass)},s.prototype.destroy=function(){t.removeData(this.$element[0],"limitText"),this.options.statusMessage.length?this.$status.removeClass(this.options.containerClass+" "+this.options.counterClass+" "+this.options.warningClass).empty():this.$status.remove(),this.$element.off("input.limitText.data-api propertychange.limitText.data-api"),this.$element=null};var i=t.fn.limitText;t.fn.limitText=function(i){return this.each(function(){var n=t(this),e=n.data("limitText"),a=t.extend({},s.DEFAULTS,n.data(),"object"==typeof i&&i);e||n.data("limitText",e=new s(this,a)),"string"==typeof i&&e[i]()})},t.fn.limitText.Constructor=s,t.fn.limitText.noConflict=function(){return t.fn.limitText=i,this}}(jQuery); \ No newline at end of file diff --git a/dist/bootstrap-tagsinput-angular.js b/dist/bootstrap-tagsinput-angular.js deleted file mode 100644 index 7ba1d14..0000000 --- a/dist/bootstrap-tagsinput-angular.js +++ /dev/null @@ -1,93 +0,0 @@ -angular.module('bootstrap-tagsinput', []) - .directive('bootstrapTagsinput', [function () { - - function getItemProperty(scope, property) { - if (!property) - return undefined; - - if (angular.isFunction(scope.$parent[property])) - return scope.$parent[property]; - - return function (item) { - return item[property]; - }; - } - - return { - restrict: 'EA', - scope: { - model: '=ngModel' - }, - template: '', - replace: false, - link: function (scope, element, attrs) { - $(function () { - if (!angular.isArray(scope.model)) - scope.model = []; - - var select = $('select', element); - var typeaheadSourceArray = attrs.typeaheadSource ? attrs.typeaheadSource.split('.') : null; - var typeaheadSource = typeaheadSourceArray ? - (typeaheadSourceArray.length > 1 ? - scope.$parent[typeaheadSourceArray[0]][typeaheadSourceArray[1]] - : scope.$parent[typeaheadSourceArray[0]]) - : null; - - select.tagsinput(scope.$parent[attrs.options || ''] || { - typeahead: { - source: angular.isFunction(typeaheadSource) ? typeaheadSource : null - }, - itemValue: getItemProperty(scope, attrs.itemvalue), - itemText: getItemProperty(scope, attrs.itemtext), - confirmKeys: getItemProperty(scope, attrs.confirmkeys) ? JSON.parse(attrs.confirmkeys) : [13], - tagClass: angular.isFunction(scope.$parent[attrs.tagclass]) ? scope.$parent[attrs.tagclass] : function (item) { - return attrs.tagclass; - } - }); - - for (var i = 0; i < scope.model.length; i++) { - select.tagsinput('add', scope.model[i]); - } - - select.on('itemAdded', function (event) { - if (scope.model.indexOf(event.item) === -1) - scope.model.push(event.item); - }); - - select.on('itemRemoved', function (event) { - var idx = scope.model.indexOf(event.item); - if (idx !== -1) - scope.model.splice(idx, 1); - }); - - // create a shallow copy of model's current state, needed to determine - // diff when model changes - var prev = scope.model.slice(); - scope.$watch("model", function () { - var added = scope.model.filter(function (i) { - return prev.indexOf(i) === -1; - }), - removed = prev.filter(function (i) { - return scope.model.indexOf(i) === -1; - }), - i; - - prev = scope.model.slice(); - - // Remove tags no longer in binded model - for (i = 0; i < removed.length; i++) { - select.tagsinput('remove', removed[i]); - } - - // Refresh remaining tags - select.tagsinput('refresh'); - - // Add new items in model as tags - for (i = 0; i < added.length; i++) { - select.tagsinput('add', added[i]); - } - }, true); - }); - } - }; - }]); diff --git a/dist/bootstrap-tagsinput-angular.min.js b/dist/bootstrap-tagsinput-angular.min.js deleted file mode 100644 index b1372b1..0000000 --- a/dist/bootstrap-tagsinput-angular.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - * bootstrap-tagsinput v0.6.1 by Tim Schlechter - * - */ - -angular.module("bootstrap-tagsinput",[]).directive("bootstrapTagsinput",[function(){function a(a,b){return b?angular.isFunction(a.$parent[b])?a.$parent[b]:function(a){return a[b]}:void 0}return{restrict:"EA",scope:{model:"=ngModel"},template:"",replace:!1,link:function(b,c,d){$(function(){angular.isArray(b.model)||(b.model=[]);var e=$("select",c),f=d.typeaheadSource?d.typeaheadSource.split("."):null,g=f?f.length>1?b.$parent[f[0]][f[1]]:b.$parent[f[0]]:null;e.tagsinput(b.$parent[d.options||""]||{typeahead:{source:angular.isFunction(g)?g:null},itemValue:a(b,d.itemvalue),itemText:a(b,d.itemtext),confirmKeys:a(b,d.confirmkeys)?JSON.parse(d.confirmkeys):[13],tagClass:angular.isFunction(b.$parent[d.tagclass])?b.$parent[d.tagclass]:function(a){return d.tagclass}});for(var h=0;h
'); - this.$input = $('').appendTo(this.$container); - - this.$element.before(this.$container); - - this.build(options); - } - - TagsInput.prototype = { - constructor: TagsInput, - - /** - * Adds the given item as a new tag. Pass true to dontPushVal to prevent - * updating the elements val() - */ - add: function (item, dontPushVal, options) { - var self = this; - - if (self.options.maxTags && self.itemsArray.length >= self.options.maxTags) - return; - - // Ignore falsey values, except false - if (item !== false && !item) - return; - - // Trim value - if (typeof item === "string" && self.options.trimValue) { - item = $.trim(item); - } - - // Throw an error when trying to add an object while the itemValue option was not set - if (typeof item === "object" && !self.objectItems) - throw("Can't add objects when itemValue option is not set"); - - // Ignore strings only containg whitespace - if (item.toString().match(/^\s*$/)) - return; - - // If SELECT but not multiple, remove current tag - if (self.isSelect && !self.multiple && self.itemsArray.length > 0) - self.remove(self.itemsArray[0]); - - if (typeof item === "string" && this.$element[0].tagName === 'INPUT') { - var delimiter = (self.options.delimiterRegex) ? self.options.delimiterRegex : self.options.delimiter; - var items = item.split(delimiter); - if (items.length > 1) { - for (var i = 0; i < items.length; i++) { - this.add(items[i], true); - } - - if (!dontPushVal) - self.pushVal(); - return; - } - } - - var itemValue = self.options.itemValue(item), - itemText = self.options.itemText(item), - tagClass = self.options.tagClass(item), - itemTitle = self.options.itemTitle(item); - - // Ignore items allready added - var existing = $.grep(self.itemsArray, function (item) { - return self.options.itemValue(item) === itemValue; - })[0]; - if (existing && !self.options.allowDuplicates) { - // Invoke onTagExists - if (self.options.onTagExists) { - var $existingTag = $(".tag", self.$container).filter(function () { - return $(this).data("item") === existing; - }); - self.options.onTagExists(item, $existingTag); - } - return; - } - - // if length greater than limit - if (self.items().toString().length + item.length + 1 > self.options.maxInputLength) - return; - - // raise beforeItemAdd arg - var beforeItemAddEvent = $.Event('beforeItemAdd', {item: item, cancel: false, options: options}); - self.$element.trigger(beforeItemAddEvent); - if (beforeItemAddEvent.cancel) - return; - - // register item in internal array and map - self.itemsArray.push(item); - - // add a tag element - - var $tag = $('' + htmlEncode(itemText) + ''); - $tag.data('item', item); - self.findInputWrapper().before($tag); - $tag.after(' '); - - // add