Bug 13501: Add JS library select2 3.5.4
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / select2.inc
1 <script src="[% interface %]/lib/select2/js/select2.min.js"></script>
2 <link rel="stylesheet" type="text/css" href="[% interface %]/lib/select2/css/select2.min.css" />
3 <script>
4   jQuery.extend($.fn.select2.defaults, {
5     allowClear: true,
6     width: function() {
7       var width = this.element.outerWidth();
8
9       // 18 is the width of .select2-arrow
10       width -= 18;
11
12       if (this.allowClear) {
13         // 42 is the margin-right of .select2-chosen when allowClear is true
14         width += 42;
15       } else {
16         // 26 is the margin-right of .select2-chosen when allowClear is false
17         width += 26;
18       }
19
20       return width;
21     },
22
23     // Internationalization
24     formatMatches: function (matches) {
25       if (matches === 1) {
26         return _("One result is available, press enter to select it.");
27       }
28       return _("%s results are available, use up and down arrow keys to navigate.").format(matches);
29     },
30     formatNoMatches: function () {
31       return _("No matches found");
32     },
33     formatInputTooShort: function (input, min) {
34       var n = min - input.length;
35       return _("Please enter %n or more characters").format(n);
36     },
37     formatInputTooLong: function (input, max) {
38       var n = input.length - max;
39       return _("Please delete %d character(s)").format(n);
40     },
41     formatSelectionTooBig: function (limit) {
42       return _("You can only select %s item(s)").format(limit);
43     },
44     formatLoadMore: function (pageNumber) {
45       return _("Loading more results…");
46     },
47     formatSearching: function () {
48       return _("Searching…");
49     }
50   });
51 </script>