Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add copyright and versioning info

JS cleanup
  • Loading branch information...
commit fb09577d3c648158066cb1a4bbec9c7dfa304c16 1 parent ab0f4e1
@aehlke aehlke authored
Showing with 58 additions and 18 deletions.
  1. +1 −1  README.markdown
  2. +1 −1  examples.html
  3. +56 −16 js/tag-it.js
View
2  README.markdown
@@ -12,7 +12,7 @@ Check the [example.html](http://aehlke.github.com/tag-it/example.html) for sever
## Usage
-First, load [jQuery](http://jquery.com/) (1.5.x or greater), [jQuery UI](http://jqueryui.com/) (1.8.x or greater), and the plugin:
+First, load [jQuery](http://jquery.com/) (v1.4 or greater), [jQuery UI](http://jqueryui.com/) (v1.8 or greater), and the plugin:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script>
View
2  examples.html
@@ -21,7 +21,7 @@
<link href="css/tagit.ui-zendesk.css" rel="stylesheet" type="text/css">
<!-- jQuery and jQuery UI are required dependencies. -->
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script>
<!-- The real deal -->
View
72 js/tag-it.js
@@ -1,4 +1,29 @@
-
+/*
+* jQuery UI Tag-it!
+*
+* @version v2.0 (06/2011)
+*
+* Copyright 2011, Levy Carneiro Jr.
+* Released under the MIT license.
+* http://aehlke.github.com/tag-it/LICENSE
+*
+* Homepage:
+* http://aehlke.github.com/tag-it/
+*
+* Authors:
+* Levy Carneiro Jr.
+* Martin Rehfeld
+* Tobias Schmidt
+* Skylar Challand
+* Alex Ehlke
+*
+* Maintainer:
+* Alex Ehlke - Twitter: @aehlke
+*
+* Dependencies:
+* jQuery v1.4+
+* jQuery UI v1.8+
+*/
(function($) {
$.widget('ui.tagit', {
@@ -9,19 +34,33 @@
tagSource : null,
removeConfirmation: false,
caseSensitive : true,
- allowSpaces : false, // when enabled, quotes are not neccesary for inputting multi-word tags
- // The below options are for using a single field instead of several for our form values.
- singleField: false, // When enabled, will use a single hidden field for the form, rather than
- // one per tag. It will delimit tags in the field with singleFieldDelimiter.
+ // When enabled, quotes are not neccesary
+ // for inputting multi-word tags.
+ allowSpaces: false,
+
+ // The below options are for using a single field instead of several
+ // for our form values.
+ //
+ // When enabled, will use a single hidden field for the form,
+ // rather than one per tag. It will delimit tags in the field
+ // with singleFieldDelimiter.
+ singleField: false,
+
singleFieldDelimiter: ',',
- singleFieldNode: null, // Set this to an input DOM node to use an existing form field.
- // Any text in it will be erased on init. But it will be populated with
- // the text of tags as they are created, delimited by singleFieldDelimiter.
- // If this is not set, we create an input node for it, with the name
- // given in settings.fieldName, ignoring settings.itemName.
- tabIndex: null, // Optionally set a tabindex attribute on the input that gets created for tag-it.
+ // Set this to an input DOM node to use an existing form field.
+ // Any text in it will be erased on init. But it will be
+ // populated with the text of tags as they are created,
+ // delimited by singleFieldDelimiter.
+ // If this is not set, we create an input node for it,
+ // with the name // given in settings.fieldName,
+ // ignoring settings.itemName.
+ singleFieldNode: null,
+
+ // Optionally set a tabindex attribute on the input that gets
+ // created for tag-it.
+ tabIndex: null,
// Event callbacks.
@@ -37,8 +76,8 @@
// There are 2 kinds of DOM nodes this widget can be instantiated on:
// 1. UL, OL, or some element containing either of these.
- // 2. INPUT, in which case 'singleField' is overridden to true, a UL is created
- // and the INPUT is hidden.
+ // 2. INPUT, in which case 'singleField' is overridden to true,
+ // a UL is created and the INPUT is hidden.
if (this.element.is('input')) {
this.tagList = $('<ul></ul>').insertAfter(this.element);
this.options.singleField = true;
@@ -66,15 +105,16 @@
this.tagList
.addClass('tagit')
.addClass('ui-widget ui-widget-content ui-corner-all')
- // create the input field.
+ // Create the input field.
.append($('<li class="tagit-new"></li>').append(this._tagInput))
.click(function(e) {
var target = $(e.target);
if (target.hasClass('tagit-label')) {
that._trigger('onTagClicked', e, target.closest('.tagit-choice'));
} else {
- // Sets the focus() to the input field, if the user clicks anywhere inside the UL.
- // This is needed because the input field needs to be of a small size.
+ // Sets the focus() to the input field, if the user
+ // clicks anywhere inside the UL. This is needed
+ // because the input field needs to be of a small size.
that._tagInput.focus();
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.