From 83355f37897ad73129157900c38dcefa9365cb74 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Mon, 21 Oct 2013 15:10:25 +0200 Subject: [PATCH] A bit more reasonable autocomplete (II) --- public_html/media/js/core.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public_html/media/js/core.js b/public_html/media/js/core.js index f7a8f4d0..26e24bcf 100644 --- a/public_html/media/js/core.js +++ b/public_html/media/js/core.js @@ -192,7 +192,10 @@ function getTagItOptions() var term = request.term.toLowerCase(); var results = $.grep(this.options.availableTags, function(a) { - return a.toLowerCase().indexOf(term) != -1; + if (term.length < 3) + return a.toLowerCase().indexOf(term) == 0; + else + return a.toLowerCase().indexOf(term) != -1; }); if (!this.options.allowDuplicates) results = this._subtractArray(results, this.assignedTags());