]> projects.mako.cc - scuttle/commitdiff
Merge branch 'autocomplete-tags'
authorBenjamin Mako Hill <mako@atdot.cc>
Sun, 8 Apr 2012 19:35:53 +0000 (15:35 -0400)
committerBenjamin Mako Hill <mako@atdot.cc>
Sun, 8 Apr 2012 19:35:53 +0000 (15:35 -0400)
templates/dynamictags.inc.php

index 51d12b94a356dfca524a0b9cbde056c78d802ba9..d7f094a5d377f79602cd5319671d9dfbde85d5e4 100644 (file)
@@ -138,11 +138,16 @@ $( "#tags" )
     }
   })
   .autocomplete({
-    minLength: 0,
+    minLength: 2,
+    delay: 50,
     source: function( request, response ) {
-      // delegate back to autocomplete, but extract the last term
-      response( $.ui.autocomplete.filter(
-        availableTags, extractLast( request.term ) ) );
+      // if the term is >2 in legth delegate back to autocomplete
+      if (extractLast ( request.term ).length < 3) {
+        response( [] );
+      } else {
+        response( $.ui.autocomplete.filter(
+          availableTags, extractLast( request.term ) ) );
+      }
     },
     focus: function() {
       // prevent value inserted on focus

Benjamin Mako Hill || Want to submit a patch?