]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/CoreBundle/Resources/views/_global/public/js/autoCompleteTags.js
3 function split( val
) {
4 return val
.split( /,\s*/ );
6 function extractLast( term
) {
7 return split( term
).pop();
11 $("#value").bind("keydown", function(event
) {
12 if (event
.keyCode
=== $.ui
.keyCode
.TAB
&& $(this).data("ui-autocomplete").menu
.active
) {
13 event
.preventDefault();
16 source : function(request
, response
) {
17 $.getJSON("./?view=tags", {
18 term : extractLast(request
.term
),
19 //id: $(':hidden#entry_id').val()
24 var term
= extractLast(this.value
);
25 if (term
.length
< 1) {
30 // prevent value inserted on focus
33 select : function(event
, ui
) {
34 var terms
= split(this.value
);
35 // remove the current input
37 // add the selected item
38 terms
.push(ui
.item
.value
);
39 // add placeholder to get the comma-and-space at the end
41 this.value
= terms
.join(", ");