Skip to content
This repository
Browse code

Extracted the js prototype from the README file.

  • Loading branch information...
commit ec8d4750792aab033df5b2a816ce6595bf781bb6 1 parent c86fb34
Loïc Vernet authored March 10, 2013
49  README.markdown
Source Rendered
@@ -8,8 +8,7 @@ Tag-it is a simple and configurable tag editing widget with autocomplete support
8 8
 
9 9
 ![Screenshot](http://aehlke.github.com/tag-it/_static/screenshot.png)
10 10
 
11  
-Check the [examples.html](http://aehlke.github.com/tag-it/examples.html) for several demos.
12  
-
  11
+Check the [examples.html](http://aehlke.github.com/tag-it/examples.html) for several demos and the [prototype.js](http://aehlke.github.com/tag-it/prototype.js) file for a JavaScipt prototype with all options and events.
13 12
 
14 13
 ## Usage
15 14
 
@@ -241,52 +240,6 @@ The function receives the click event and an objecting containing `tag` and `tag
241 240
 Called when attempting to create a tag while the tag limit has already been reached. Receives a null event,
242 241
 and an object with the property `duringInitialization`. This can only be called if **tagLimit** is set.
243 242
 
244  
-## Prototype
245  
-
246  
-Here is a prototype with all the default options and events:
247  
-
248  
-    $("#myTags").tagit({
249  
-   
250  
-        // Options
251  
-        fieldName: "skills",
252  
-        availableTags: ["c++", "java", "php", "javascript", "ruby", "python", "c"],
253  
-        autocomplete: {delay: 0, minLength: 2},
254  
-        showAutocompleteOnFocus: false,
255  
-        removeConfirmation: false,
256  
-        caseSensitive: true,
257  
-        allowDuplicates: false,
258  
-        allowSpaces: false,
259  
-        readOnly: false,
260  
-        tagLimit: null,
261  
-        singleField: false,
262  
-        singleFieldDelimiter: ',',
263  
-        singleFieldNode: null,
264  
-        tabIndex: null,
265  
-        placeholderText: null,
266  
-
267  
-        // Events
268  
-        beforeTagAdded: function(event, ui) {
269  
-            console.log(ui.tag);
270  
-        },
271  
-        afterTagAdded: function(event, ui) {
272  
-            console.log(ui.tag);
273  
-        },
274  
-        beforeTagRemoved: function(event, ui) {
275  
-            console.log(ui.tag);
276  
-        },
277  
-        onTagExists: function(event, ui) {
278  
-            console.log(ui.tag);
279  
-        },
280  
-        onTagClicked: function(event, ui) {
281  
-            console.log(ui.tag);
282  
-        },
283  
-        onTagLimitExceeded: function(event, ui) {
284  
-            console.log(ui.tag);
285  
-        }
286  
-
287  
-    });
288  
-
289  
-
290 243
 ## Methods
291 244
 
292 245
 ### assignedTags()
40  prototype.js
... ...
@@ -0,0 +1,40 @@
  1
+$("#myTags").tagit({
  2
+
  3
+    // Options
  4
+    fieldName: "skills",
  5
+    availableTags: ["c++", "java", "php", "javascript", "ruby", "python", "c"],
  6
+    autocomplete: {delay: 0, minLength: 2},
  7
+    showAutocompleteOnFocus: false,
  8
+    removeConfirmation: false,
  9
+    caseSensitive: true,
  10
+    allowDuplicates: false,
  11
+    allowSpaces: false,
  12
+    readOnly: false,
  13
+    tagLimit: null,
  14
+    singleField: false,
  15
+    singleFieldDelimiter: ',',
  16
+    singleFieldNode: null,
  17
+    tabIndex: null,
  18
+    placeholderText: null,
  19
+
  20
+    // Events
  21
+    beforeTagAdded: function(event, ui) {
  22
+        console.log(ui.tag);
  23
+    },
  24
+    afterTagAdded: function(event, ui) {
  25
+        console.log(ui.tag);
  26
+    },
  27
+    beforeTagRemoved: function(event, ui) {
  28
+        console.log(ui.tag);
  29
+    },
  30
+    onTagExists: function(event, ui) {
  31
+        console.log(ui.tag);
  32
+    },
  33
+    onTagClicked: function(event, ui) {
  34
+        console.log(ui.tag);
  35
+    },
  36
+    onTagLimitExceeded: function(event, ui) {
  37
+        console.log(ui.tag);
  38
+    }
  39
+
  40
+});

0 notes on commit ec8d475

Please sign in to comment.
Something went wrong with that request. Please try again.