-{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"}
-<script language="JavaScript">
-$(document).ready(function()
-{
- $('#lf_tags').autocomplete({source:'{$source}?ws=tags',minLength:1});
-});
+{/if}
+{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn())"}
+<script>
+ $ = Awesomplete.$;
+ new Awesomplete($('input[data-multiple]'), {
+ filter: function(text, input) {
+ return Awesomplete.FILTER_CONTAINS(text, input.match(/[^ ]*$/)[0]);
+ },
+ replace: function(text) {
+ var before = this.input.value.match(/^.+ \s*|/)[0];
+ this.input.value = before + text + " ";
+ },
+ minChars: 1
+ });