aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/awesomplete-multiple-tags.js
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2018-07-28 11:07:55 +0200
committerArthurHoaro <arthur@hoa.ro>2018-07-28 11:07:55 +0200
commit83faedadff76c5bdca036f39f13943f63b27e164 (patch)
tree6f44cede16ec6a60f10b9699e211e0818f06d2c8 /inc/awesomplete-multiple-tags.js
parent1d9eb22a3df85b67fe6652c0876cd7382c2fb525 (diff)
parent658988f3aeba7a5a938783249ccf2765251e5597 (diff)
downloadShaarli-83faedadff76c5bdca036f39f13943f63b27e164.tar.gz
Shaarli-83faedadff76c5bdca036f39f13943f63b27e164.tar.zst
Shaarli-83faedadff76c5bdca036f39f13943f63b27e164.zip
Merge tag 'v0.9.7' into stable
Release v0.9.7
Diffstat (limited to 'inc/awesomplete-multiple-tags.js')
-rw-r--r--inc/awesomplete-multiple-tags.js49
1 files changed, 40 insertions, 9 deletions
diff --git a/inc/awesomplete-multiple-tags.js b/inc/awesomplete-multiple-tags.js
index 4cc8429f..c38dc38e 100644
--- a/inc/awesomplete-multiple-tags.js
+++ b/inc/awesomplete-multiple-tags.js
@@ -1,13 +1,44 @@
1/** @licstart The following is the entire license notice for the
2 * JavaScript code in this page.
3 *
4 * Copyright: (c) 2011-2015 Sébastien SAUVAGE <sebsauvage@sebsauvage.net>
5 * (c) 2011-2017 The Shaarli Community, see AUTHORS
6 *
7 * This software is provided 'as-is', without any express or implied warranty.
8 * In no event will the authors be held liable for any damages arising from
9 * the use of this software.
10 *
11 * Permission is granted to anyone to use this software for any purpose,
12 * including commercial applications, and to alter it and redistribute it
13 * freely, subject to the following restrictions:
14 *
15 * 1. The origin of this software must not be misrepresented; you must not
16 * claim that you wrote the original software. If you use this software
17 * in a product, an acknowledgment in the product documentation would
18 * be appreciated but is not required.
19 *
20 * 2. Altered source versions must be plainly marked as such, and must
21 * not be misrepresented as being the original software.
22 *
23 * 3. This notice may not be removed or altered from any source distribution.
24 *
25 * @licend The above is the entire license notice
26 * for the JavaScript code in this page.
27 */
28
1var awp = Awesomplete.$; 29var awp = Awesomplete.$;
2awesomplete = new Awesomplete(awp('input[data-multiple]'), { 30var autocompleteFields = document.querySelectorAll('input[data-multiple]');
3 filter: function(text, input) { 31[].forEach.call(autocompleteFields, function(autocompleteField) {
4 return Awesomplete.FILTER_CONTAINS(text, input.match(/[^ ]*$/)[0]); 32 awesomplete = new Awesomplete(awp(autocompleteField), {
5 }, 33 filter: function (text, input) {
6 replace: function(text) { 34 return Awesomplete.FILTER_CONTAINS(text, input.match(/[^ ]*$/)[0]);
7 var before = this.input.value.match(/^.+ \s*|/)[0]; 35 },
8 this.input.value = before + text + " "; 36 replace: function (text) {
9 }, 37 var before = this.input.value.match(/^.+ \s*|/)[0];
10 minChars: 1 38 this.input.value = before + text + " ";
39 },
40 minChars: 1
41 })
11}); 42});
12 43
13/** 44/**