46 |
47 |
89 |
90 |
91 |
95 |
96 |
102 |
103 | 1st arg: File name to send data by Ajax
104 | 2nd arg: Options
105 |
106 |
107 | 第1引数にAjax送信先のファイル名を、
108 | 第2引数にオプションを設定します。
109 |
110 |
HTML
111 |
112 | <link rel="stylesheet" href="jquery.ajax-combobox.css">
113 |
114 | <input id="foo" type="text">
115 |
116 | <script src="../../node_modules/jquery/dist/jquery.min.js"></script>
117 | <script src="jquery.ajax-combobox.min.js"></script>
118 |
119 |
JavaScript
120 |
121 | $('#foo').ajaxComboBox(
122 | 'jquery.ajax-combobox.php',
123 | {
124 | lang: 'en', // Set language to English
125 | db_table: 'nation', // DB table to search
126 | button_img: 'btn.png', // Image for pull-down button
127 | }
128 | );
129 |
130 |
131 |
132 |
133 |
134 |
138 |
139 |
145 |
146 | $('#foo').ajaxComboBox(
147 | 'jquery.ajax-combobox.php',
148 | {
149 | per_page: 20, // Amount of list items
150 | navi_num: 10 // Amount of pages
151 | }
152 | );
153 |
154 |
155 |
156 |
157 |
158 |
162 |
163 |
169 |
When you set options below, besides its name, you can search by id.
170 |
下記のように指定することで、名前の他にIDでも検索できます。
171 |
172 | $('#foo').ajaxComboBox(
173 | 'jquery.ajax-combobox.php',
174 | {
175 | search_field: 'name, id'
176 | }
177 | );
178 |
179 |
180 |
181 |
182 |
183 |
187 |
188 |
194 |
195 | Default is "AND". You can change it to "OR".
196 |
197 |
198 | デフォルトはAND検索ですがOR検索にすることもできます。
199 |
200 |
201 | $('#foo').ajaxComboBox(
202 | 'jquery.ajax-combobox.php',
203 | {
204 | and_or: 'OR'
205 | }
206 | );
207 |
208 |
209 |
210 |
211 |
212 |
216 |
217 |
223 |
224 | Basically, list is ordered by search_field
option.
225 | You can change it by order_by
option.
226 |
227 |
228 | 基本的には、"search_field"オプションに指定されたフィールドの昇順に並べ替えられます。
229 | "order_by"オプションで任意に指定することもできます。
230 |
231 |
232 | $('#foo').ajaxComboBox(
233 | 'jquery.ajax-combobox.php',
234 | {
235 | order_by: [
236 | 'name DESC', // ASC or DESC should be UPPERCASE.
237 | 'created'
238 | ]
239 | }
240 | );
241 |
242 |
243 |
244 |
245 |
246 |
250 |
251 |
257 |
258 | Set lang
option to choose language used in this plugin's UI.
259 |
260 |
261 | このプラグインのUIで使う言語をlang
オプションで指定してください。
262 |
263 |
264 | Option value | Language |
265 |
266 | de | German (Thanks Sebastian Gohres) |
267 | en (default) | English |
268 | es | Spanish (Thanks Joaquin G. de la Zerda) |
269 | pt-br | Brazilian Portuguese (Thanks Marcio de Souza) |
270 | ja | Japanese |
271 |
272 |
273 |
274 |
275 |
276 |
280 |
281 |
287 |
288 | Set navi_simple
when you want to narrow the width of the ComboBox as much as possible.
289 | Shortcut key is still enable. (Shift+Left/Right)
290 |
291 |
292 | ComboBoxの幅をできるだけ狭くしたい場合は、navi_simple
オプションで先頭・末尾のページへのリンクを非表示にできます。
293 | なお、キーボードのショートカットは有効のままです。(Shift+右/左)
294 |
295 |
296 | $('#foo').ajaxComboBox(
297 | 'jquery.ajax-combobox.php',
298 | {
299 | navi_simple: true
300 | }
301 | );
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
--------------------------------------------------------------------------------
/sample/button-image/btn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sutara79/jquery.ajax-combobox/b52bdaa936713d8c79c16b0707c07a4d49c19f1b/sample/button-image/btn.png
--------------------------------------------------------------------------------
/sample/button-image/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Button image: jquery.ajax-combobox
7 |
8 |
9 |
10 |
45 |
46 |
47 |
Button image: jquery.ajax-combobox
48 |
67 |
68 |
--------------------------------------------------------------------------------
/sample/button-image/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/sample/disable/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Sample: Disable Combobox (using option.instance)
7 |
8 |
9 |
10 |
55 |
56 |
57 |
Sample: Disable Combobox (using option.instance)
58 |
61 |
62 |
66 |
67 |
--------------------------------------------------------------------------------
/sample/disable/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/sample/get-instance/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Get instance: jquery.ajax-combobox
7 |
8 |
9 |
10 |
25 |
26 |
27 |
Get instance: jquery.ajax-combobox
28 |
33 |
34 |
--------------------------------------------------------------------------------
/sample/get-instance/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/sample/img/001.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sutara79/jquery.ajax-combobox/b52bdaa936713d8c79c16b0707c07a4d49c19f1b/sample/img/001.png
--------------------------------------------------------------------------------
/sample/img/002.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sutara79/jquery.ajax-combobox/b52bdaa936713d8c79c16b0707c07a4d49c19f1b/sample/img/002.png
--------------------------------------------------------------------------------
/sample/img/003.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sutara79/jquery.ajax-combobox/b52bdaa936713d8c79c16b0707c07a4d49c19f1b/sample/img/003.png
--------------------------------------------------------------------------------
/sample/img/readme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sutara79/jquery.ajax-combobox/b52bdaa936713d8c79c16b0707c07a4d49c19f1b/sample/img/readme.png
--------------------------------------------------------------------------------
/sample/initial-value/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Initial value: jquery.ajax-combobox
7 |
8 |
9 |
10 |
21 |
22 |
23 |
Initial value: jquery.ajax-combobox
24 |
29 |
30 |
--------------------------------------------------------------------------------
/sample/initial-value/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/sample/instance/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Sample: option.instance
7 |
8 |
9 |
10 |
38 |
39 |
40 |
Sample: option.instance
41 |
42 |
46 |
47 |
--------------------------------------------------------------------------------
/sample/js-object/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
JS object instead of DB: jquery.ajax-combobox
7 |
8 |
9 |
10 |
49 |
50 |
51 |
JS object instead of DB: jquery.ajax-combobox
52 |
57 |
58 |
--------------------------------------------------------------------------------
/sample/js-object/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/sample/language/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Language: jquery.ajax-combobox
7 |
8 |
9 |
10 |
49 |
50 |
51 |
Language: jquery.ajax-combobox
52 |
75 |
76 |
--------------------------------------------------------------------------------
/sample/language/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/sample/or-search/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
"OR" search: jquery.ajax-combobox
7 |
8 |
9 |
10 |
21 |
22 |
23 |
"OR" search: jquery.ajax-combobox
24 |
Input ame ja to the text box below
25 |
30 |
31 |
--------------------------------------------------------------------------------
/sample/or-search/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/sample/sample.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #eee;
3 | -webkit-text-size-adjust: 100%;
4 | }
5 | .main {
6 | position: relative;
7 | }
8 | footer {
9 | background: #eee;
10 | }
11 | footer div {
12 | padding: 16px 0;
13 | text-align: right;
14 | }
15 |
16 | article form a.btn,
17 | article form input,
18 | article form button {
19 | margin-bottom: 4px;
20 | }
21 | .green {
22 | color: #5cb85c;
23 | }
24 | .red {
25 | color: #d9534f;
26 | }
27 | .btn-container {
28 | margin-bottom: 1.2em;
29 | }
30 |
31 | /**
32 | * 見出し横に表示される、自身へのリンク
33 | */
34 | .js-anchor {
35 | font-size: 1em;
36 | left: 4px;
37 | position: absolute;
38 | visibility: hidden;
39 | }
40 | .card-header:hover .js-anchor {
41 | visibility: visible;
42 | }
43 | .js-anchor,
44 | .js-anchor:hover,
45 | .js-anchor:active {
46 | color: inherit;
47 | }
48 | .octicon {
49 | display: inline-block;
50 | fill: currentColor;
51 | height: 1.4em;
52 | vertical-align: text-bottom;
53 | }
54 | pre {
55 | background-color: #f5f5f5;
56 | border: 1px solid #ccc;
57 | border-radius: 2px;
58 | font-size: 0.9rem;
59 | line-height: 1.2;
60 | margin-bottom: 1em;
61 | padding: 0.5em;
62 | }
63 |
64 | .toc,
65 | .toc .btn {
66 | font-size: 0.95rem;
67 | }
68 |
69 |
70 | /**
71 | * Override Bootstrap4
72 | */
73 | a,
74 | a:active {
75 | color: #486;
76 | }
77 | a:hover,
78 | a:focus {
79 | color: #375;
80 | }
81 | h5 {
82 | font-weight: normal;
83 | }
84 | h6 {
85 | color: #777;
86 | font-size: 14px;
87 | }
88 | .jumbotron {
89 | background-color: #486;
90 | background-image: linear-gradient(30deg, #3d8260 12%, transparent 12.5%, transparent 87%, #3d8260 87.5%, #3d8260),
91 | linear-gradient(150deg, #3d8260 12%, transparent 12.5%, transparent 87%, #3d8260 87.5%, #3d8260),
92 | linear-gradient(30deg, #3d8260 12%, transparent 12.5%, transparent 87%, #3d8260 87.5%, #3d8260),
93 | linear-gradient(150deg, #3d8260 12%, transparent 12.5%, transparent 87%, #3d8260 87.5%, #3d8260),
94 | linear-gradient(60deg, #4a8e6c 25%, transparent 25.5%, transparent 75%, #4a8e6c 75%, #4a8e6c),
95 | linear-gradient(60deg, #4a8e6c 25%, transparent 25.5%, transparent 75%, #4a8e6c 75%, #4a8e6c);
96 | background-position: 0 0, 0 0, 40px 70px, 40px 70px, 0 0, 40px 70px;
97 | background-size: 80px 140px;
98 | color: #fff;
99 | text-shadow: 0 1px 1px #333;
100 | }
101 | .page-title {
102 | font-family: Arial;
103 | }
104 | .jumbotron-link,
105 | .jumbotron-link:hover {
106 | color: inherit;
107 | }
108 | .list-group-item:first-child {
109 | border-top-left-radius: 2px;
110 | border-top-right-radius: 2px;
111 | }
112 | .list-group-item:last-child {
113 | border-bottom-left-radius: 2px;
114 | border-bottom-right-radius: 2px;
115 | }
116 | .card {
117 | margin-bottom: 1.5em;
118 | }
119 | .card > .card-header {
120 | background-color: #777;
121 | border-color: #777;
122 | border-top-left-radius: 2px;
123 | border-top-right-radius: 2px;
124 | color: #fff;
125 | }
126 | .btn-primary {
127 | background-color: #597;
128 | border-color: #509472;
129 | }
130 | .btn-primary:disabled,
131 | .btn-primary:disabled:focus,
132 | .btn-primary:disabled:hover {
133 | background-color: #597;
134 | border-color: #509472;
135 | }
136 | .btn-primary:hover {
137 | background-color: #486;
138 | border-color: #3f8361;
139 | }
140 | .btn-primary:not([disabled]):not(.disabled).active,
141 | .btn-primary:not([disabled]):not(.disabled):active,
142 | .show > .btn-primary.dropdown-toggle,
143 | .btn-primary:active,
144 | .btn-primary:active:hover,
145 | .btn-primary:active:focus,
146 | .btn-primary:focus {
147 | background-color: #375;
148 | border-color: #2d7250;
149 | }
150 | .btn-primary:not([disabled]):not(.disabled).active,
151 | .btn-primary:not([disabled]):not(.disabled):active,
152 | .show > .btn-primary.dropdown-toggle,
153 | .btn-primary.focus,
154 | .btn-primary:focus {
155 | box-shadow: 0 0 0 0.2rem #6a8;
156 | color: #fff;
157 | }
158 | .list-group-item-action {
159 | outline: #fff none 0;
160 | }
161 | .list-group-item-action:focus,
162 | .list-group-item-action:hover,
163 | .list-group-item-action:active {
164 | background-color: #eee;
165 | }
166 |
167 | /* ONLY ajax-combobox */
168 | body {
169 | padding-top: 3.5rem; /* for Bootstrap navbar */
170 | }
--------------------------------------------------------------------------------
/sample/sample.js:
--------------------------------------------------------------------------------
1 | // ページ内リンク(固定グローバルナビに対応) ajax-comboboxのみ
2 | $(document).on('click', '#contents a[href^="#"]', function(ev) {
3 | ev.preventDefault();
4 | var href= $(this).attr('href');
5 | var target = $((href == '#' || href === '') ? 'html' : href);
6 | var position = target.offset().top - 54; // -54 is .navbar height
7 | console.log(position);
8 | $('body, html').scrollTop(position); // can not use .animate on jquery.slim
9 | history.pushState('', '', $(this)[0].href);
10 | return false;
11 | });
12 |
13 | // 英語・日本語切り替え
14 | $('.js-btn-lang').click(function(ev) {
15 | $('body [lang]').hide();
16 | $('.js-btn-lang').removeAttr('disabled');
17 | $('body [lang="' + $(ev.currentTarget).data('lang') + '"]').show();
18 | $(ev.currentTarget).attr('disabled', 'disabled');
19 | });
20 | $('#lang-en').trigger('click');
21 |
22 | // 追尾スクロール (英語・日本語切り替えよりも後にすること)
23 | $('#js-menu-follow').simpleScrollFollow({
24 | min_width: 960,
25 | limit_elem: 'article',
26 | upper_side: '.navbar'
27 | });
28 |
29 | // 見出し横のリンクを生成
30 | $('section.card').each(function() {
31 | var link = $('
#');
32 | $(link).attr('href', '#' + $(this).attr('id'));
33 | $(this).find('.card-header').prepend(link);
34 | });
--------------------------------------------------------------------------------
/sample/sample.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sutara79/jquery.ajax-combobox/b52bdaa936713d8c79c16b0707c07a4d49c19f1b/sample/sample.sqlite3
--------------------------------------------------------------------------------
/sample/search-multi-fields/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Search multi fields: jquery.ajax-combobox
7 |
8 |
9 |
10 |
21 |
22 |
23 |
Search multi fields: jquery.ajax-combobox
24 |
Input 23 to the text box below
25 |
30 |
31 |
--------------------------------------------------------------------------------
/sample/search-multi-fields/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/sample/select-only-basic/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Select only: Basic: jquery.ajax-combobox
7 |
8 |
9 |
10 |
22 |
23 |
24 |
Select only: Basic: jquery.ajax-combobox
25 |
30 |
31 |
--------------------------------------------------------------------------------
/sample/select-only-basic/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/sample/select-only-primary-key/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Select only: Primary key: jquery.ajax-combobox
7 |
8 |
9 |
10 |
23 |
24 |
25 |
Select only: Primary key: jquery.ajax-combobox
26 |
31 |
32 |
--------------------------------------------------------------------------------
/sample/select-only-primary-key/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/sample/shorten-url/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Shorten URL: jquery.ajax-combobox
7 |
8 |
13 |
14 |
15 |
28 |
29 |
30 |
Shorten URL: jquery.ajax-combobox
31 |
32 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/sample/simple-page-navi/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Simple page navi: jquery.ajax-combobox
7 |
8 |
9 |
10 |
21 |
22 |
23 |
Simple page navi: jquery.ajax-combobox
24 |
29 |
30 |
--------------------------------------------------------------------------------
/sample/simple-page-navi/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/sample/simple-text-box/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Simple text box: jquery.ajax-combobox
7 |
8 |
9 |
10 |
21 |
22 |
23 |
Simple text box: jquery.ajax-combobox
24 |
29 |
30 |
--------------------------------------------------------------------------------
/sample/simple-text-box/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/sample/sorting/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Sorting: jquery.ajax-combobox
7 |
8 |
9 |
10 |
24 |
25 |
26 |
Sorting: jquery.ajax-combobox
27 |
32 |
33 |
--------------------------------------------------------------------------------
/sample/sorting/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/sample/sub-info-basic/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Sub info: Basic: jquery.ajax-combobox
7 |
8 |
9 |
10 |
21 |
22 |
23 |
Sub info: Basic: jquery.ajax-combobox
24 |
29 |
30 |
--------------------------------------------------------------------------------
/sample/sub-info-basic/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/sample/sub-info-change-title/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Sub info: Change the title: jquery.ajax-combobox
7 |
8 |
9 |
10 |
26 |
27 |
28 |
Sub info: Change the title: jquery.ajax-combobox
29 |
34 |
35 |
--------------------------------------------------------------------------------
/sample/sub-info-change-title/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/sample/sub-info-divert/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Sub info: Divert: jquery.ajax-combobox
7 |
8 |
9 |
10 |
31 |
32 |
33 |
Sub info: Divert: jquery.ajax-combobox
34 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/sample/sub-info-divert/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/sample/sub-info-hidden-field/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Sub info: Hidden field: jquery.ajax-combobox
7 |
8 |
9 |
10 |
27 |
28 |
29 |
Sub info: Hidden field: jquery.ajax-combobox
30 |
35 |
36 |
--------------------------------------------------------------------------------
/sample/sub-info-hidden-field/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/sample/sub-info-simple/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Sub info: Simple: jquery.ajax-combobox
7 |
8 |
9 |
10 |
22 |
23 |
24 |
Sub info: Simple: jquery.ajax-combobox
25 |
30 |
31 |
--------------------------------------------------------------------------------
/sample/sub-info-simple/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/sample/sub-info-visible-field/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Sub info: Visible field: jquery.ajax-combobox
7 |
8 |
9 |
10 |
27 |
28 |
29 |
Sub info: Visible field: jquery.ajax-combobox
30 |
35 |
36 |
--------------------------------------------------------------------------------
/sample/sub-info-visible-field/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/sample/sub-info.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Sub info: jquery.ajax-combobox
7 |
8 |
9 |
10 |
11 |
37 |
45 |
46 |
47 |
85 |
86 |
87 |
91 |
92 |
98 |
99 | Even though duplicate names exist, you can identify it by sub name.
100 |
101 |
102 | 名前が重複していてもサブ情報で区別できます。
103 |
104 |
105 | $('#foo').ajaxComboBox(
106 | 'jquery.ajax-combobox.php',
107 | {
108 | sub_info: true
109 | }
110 | );
111 |
112 |
113 |
114 |
115 |
116 |
120 |
121 |
127 |
128 | sub_as
option can change the title.
129 |
130 |
131 | 何も設定しないと、サブ情報の表の項目名はデータベースのカラム名が表示されてしまいます。
132 | sub_as
オプションで表示名を変更できます。
133 |
134 |
135 | $('#foo').ajaxComboBox(
136 | 'jquery.ajax-combobox.php',
137 | {
138 | sub_info: true,
139 | sub_as: {
140 | id: 'Employer ID',
141 | post: 'Post',
142 | position: 'Position'
143 | }
144 | }
145 | );
146 |
147 |
148 |
149 |
150 |
151 |
155 |
156 |
162 |
You can specify visible fields by show_field
option which accepts comma separated text.
163 |
カンマ区切りもできるshow_field
オプションで表示フィールドを指定できます。
164 |
165 | $('#foo').ajaxComboBox(
166 | 'jquery.ajax-combobox.php',
167 | {
168 | sub_info: true,
169 | sub_as: {
170 | post: 'Post',
171 | position: 'Position'
172 | },
173 | show_field: 'position, post'
174 | }
175 | );
176 |
177 |
178 |
179 |
180 |
181 |
185 |
186 |
192 |
You can specify hidden fields by hide_field
option which accepts comma separated text.
193 |
カンマ区切りもできるhide_field
オプションで非表示フィールドを指定できます。
194 |
195 | $('#foo').ajaxComboBox(
196 | 'jquery.ajax-combobox.php',
197 | {
198 | sub_info: true,
199 | sub_as: {
200 | post: 'Post',
201 | position: 'Position'
202 | },
203 | hide_field: 'position, post'
204 | }
205 | );
206 |
207 |
208 |
209 |
210 |
211 |
215 |
216 |
222 |
You can hide field column by setting 'simple'
to sub_info
option instead of true
.
223 |
sub_info
オプションにtrue
の代わりに'simple'
と指定することでサブ情報の項目名を非表示にできます。
224 |
225 | $('#foo').ajaxComboBox(
226 | 'jquery.ajax-combobox.php',
227 | {
228 | sub_info: 'simple',
229 | show_field: 'post'
230 | }
231 | );
232 |
233 |
234 |
235 |
236 |
237 |
241 |
242 |
248 |
249 | When you select from list, the custom attribute sub_info
which contains sub info as JSON is added to the text box
250 | Then you can use Sub-info for other purpose.
251 |
252 |
253 | 候補を選択した際、テキストボックスのsub_info
という独自の属性にJSON形式でサブ情報が格納されるので、他で利用することが可能です。
254 |
255 |
256 | $('#foo').ajaxComboBox();
257 |
258 | var json = $('#foo').attr('sub_info');
259 |
260 |
261 |
262 |
263 |
264 |
265 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
--------------------------------------------------------------------------------
/sample/text-area-basic/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Text area: Basic: jquery.ajax-combobox
7 |
8 |
13 |
14 |
15 |
31 |
32 |
33 |
Text area: Basic: jquery.ajax-combobox
34 |
35 |
37 |
38 |
--------------------------------------------------------------------------------
/sample/text-area-complex/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Text area: Complex: jquery.ajax-combobox
7 |
8 |
13 |
14 |
15 |
41 |
42 |
43 |
Text area: Complex: jquery.ajax-combobox
44 |
45 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/sample/text-area-js-object/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Text area: JS object: jquery.ajax-combobox
7 |
8 |
13 |
14 |
15 |
52 |
53 |
54 |
Text area: JS object: jquery.ajax-combobox
55 |
56 |
58 |
59 |
--------------------------------------------------------------------------------
/sample/text-area-multi-tag-pattern/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Text area: Multi tag pattern: jquery.ajax-combobox
7 |
8 |
13 |
14 |
15 |
41 |
42 |
43 |
Text area: Multi tag pattern: jquery.ajax-combobox
44 |
45 |
47 |
48 |
--------------------------------------------------------------------------------
/sample/text-area-no-space/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Text area: No space: jquery.ajax-combobox
7 |
8 |
13 |
14 |
15 |
32 |
33 |
34 |
Text area: No space: jquery.ajax-combobox
35 |
36 |
38 |
39 |
--------------------------------------------------------------------------------
/sample/text-area-options/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Text area: Options: jquery.ajax-combobox
7 |
8 |
13 |
14 |
15 |
47 |
48 |
49 |
Text area: Options: jquery.ajax-combobox
50 |
51 |
53 |
54 |
--------------------------------------------------------------------------------
/sample/usage/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Usage: jquery.ajax-combobox
7 |
8 |
9 |
10 |
21 |
22 |
23 |
Usage: jquery.ajax-combobox
24 |
29 |
30 |
--------------------------------------------------------------------------------
/sample/usage/send.php:
--------------------------------------------------------------------------------
1 |
2 |
Back
--------------------------------------------------------------------------------
/src/ajaxCombobox.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @class external:jQuery.ajaxComboBox
3 | * @classdesc 要素ごとに適用される処理を集めたクラス
4 | * @param {Object} combo_input - プラグインを適用するHTML要素。
5 | * @param {string|Object} source - サーバ側のプログラム、もしくは連想配列そのもの。
6 | * @param {Object} option - オプションを収めた連想配列。
7 | */
8 | export default function (combo_input, source, option) {
9 | this.option = this._setOption(source, option);
10 | this._setMessage();
11 | this._setCssClass();
12 | this._setProp();
13 | this._setElem(combo_input);
14 |
15 | this._setButtonAttrDefault();
16 | this._setInitRecord();
17 |
18 | this._ehButton();
19 | this._ehComboInput();
20 | this._ehWhole();
21 | this._ehTextArea();
22 |
23 | if (this.option.shorten_btn) this._findUrlToShorten(this);
24 | }
25 |
--------------------------------------------------------------------------------
/src/fn_ajaxCombobox.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @function external:"jQuery.fn".ajaxComboBox
3 | * @param {string|Object} source - サーバ側のプログラム、もしくは連想配列そのもの。
4 | * @param {Object} option - オプションを収めた連想配列。
5 | * @param {boolean} [option.instance] - プラグインを呼び出すとき、jQueryオブジェクトではなくインスタンスを返すかどうか
6 | * @param {string} [option.lang='en'] - Language used in this plugin's UI. ('en', 'es', 'pt-br' and 'ja')
7 | * @param {string} [option.db_table='tbl'] - 問い合わせるデータベースのテーブル。
8 | * @param {string} [option.field='name'] - JavaScript側での結果表示に用いるフィールド。
9 | * @param {string} [option.search_field=option.field] - 検索対象のフィールド名。カンマ区切りで複数指定可能。 (e.g.: 'id, name, job')
10 | * @param {string|Array} [option.order_by=option.search_field] - 並替の基準となるフィールド。配列でも可。 (e.g.: 'name DESC' or ['name ASC', 'age DESC'])
11 | * @param {number} [option.per_page=10] - 候補一覧の1ページあたりに表示する数。
12 | * @param {number} [option.navi_num=5] - ページナビで表示する、隣接ページの数。
13 | * @param {boolean} [option.navi_simple=false] - 先頭・末尾のページへのリンクを非表示にして、ComboBoxの幅をできるだけ狭くする。
14 | * @param {string} [option.plugin_type='combobox'] - 'combobox', 'simple', 'textarea'
15 | * @param {string} [option.init_record=false] - 初期値に指定するレコード。プライマリキーの値で指定する。
16 | * @param {string} [option.bind_to] - 候補選択後に実行されるイベントの名前
17 | * @param {string} [option.and_or='AND'] - AND検索、もしくはOR検索 ('AND' or 'OR')
18 | * @param {boolean|string} [option.sub_info=false] - サブ情報を表示。'simple'と指定することで項目名を非表示にできる。 (true, false or 'simple')
19 | * @param {Object} [option.sub_as={}] - サブ情報のフィールドの別名。連想配列で指定する。
20 | * @param {string} [option.show_field] - サブ情報で表示するフィールド。カンマ区切りで複数指定可能。 (e.g.: 'id' or 'id, job, age')
21 | * @param {string} [option.hide_field] - サブ情報で非表示にするフィールド。カンマ区切りで複数指定可能。 (e.g.: 'id' or 'id, job, age')
22 | * @param {boolean} [option.select_only=false] - セレクト専用にする。(データベースに登録された値しか受け入れない)
23 | * @param {string} [option.primary_key='id'] - セレクト専用時、Form の hidden の値に指定される、レコードを特定できるフィールド。
24 | * @param {string} [option.button_img='
'] - ボタンに使われる画像
25 | * @param {string} [option.shorten_btn] - (option.plugin_type='textarea' の場合に限り、)短縮実行ボタンのセレクタ。
26 | * @param {string} [option.shorten_src='dist/bitly.php'] - URL短縮を外部に依頼するスクリプトのパス。
27 | * @param {number} [option.shorten_min=20] - URL短縮を実行する最小の文字数。
28 | * @param {Object} [option.shorten_reg] - URLを検出するための正規表現。
29 | * @param {Array} [option.tags=false] - (option.plugin_type='textarea' の場合に限り、)タグ検索の設定。
30 | * @param {Array} [option.tags.pattern] - タグを囲む記号。開始文字と終了文字を配列で指定する。 (e.g.: pattern: [ '<', '>' ])
31 | * @param {Array} [option.tags.space] - タグ選択後に、前後に空白を挿入するかどうかを配列で指定する。
32 | * @param {string} [option.tags.db_table=option.db_table]
33 | * @param {string} [option.tags.field=option.field]
34 | * @param {string} [option.tags.search_field=option.search_field]
35 | * @param {string|Array} [option.tags.order_by=option.order_by]
36 | * @param {boolean|string} [option.tags.sub_info=option.sub_info]
37 | * @param {Object} [option.tags.sub_as=option.sub_as]
38 | * @param {string} [option.tags.show_field=option.show_field]
39 | * @param {string} [option.tags.hide_field=option.hide_field]
40 | */
41 | /*global $*/
42 | export default function (source, option) {
43 | var arr = [];
44 | this.each(function() {
45 | arr.push(new $.ajaxComboBox(this, source, option));
46 | });
47 | return (option !== undefined && option.instance !== undefined && option.instance) ? $(arr) : this;
48 | }
49 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | /** @external "jQuery.fn" */
2 | /*global $*/
3 | import fn_ajaxComboBox from './fn_ajaxComboBox';
4 | import ajaxComboBox from './ajaxComboBox';
5 | import m03 from './method/03-_setOption';
6 | import m04 from './method/04-_setMessage';
7 | import m05 from './method/05-_setCssClass';
8 | import m06 from './method/06-_setElem';
9 | import m07 from './method/07-_setInitRecord';
10 | import m08 from './method/08-_ehButton.js';
11 | import m10 from './method/10-_getShortURL.js';
12 | import m12 from './method/12-_scrollWindow.js';
13 | import m14 from './method/14-_setTimerCheckValue.js';
14 | import m16 from './method/16-_processKey.js';
15 | import m18 from './method/18-_suggest.js';
16 | import m20 from './method/20-_searchForDb.js';
17 | import m22 from './method/22-_searchForJson.js';
18 | import m24 from './method/24-_sortAsc.js';
19 | import m26 from './method/26-_prepareResults.js';
20 | import m28 from './method/28-_displayResults.js';
21 | import m30 from './method/30-_firstPage.js';
22 | import m32 from './method/32-_selectCurrentLine.js';
23 | import m34 from './method/34-_nextLine.js';
24 |
25 | $.fn.ajaxComboBox = fn_ajaxComboBox;
26 | $.ajaxComboBox = ajaxComboBox;
27 | $.extend(
28 | $.ajaxComboBox.prototype,
29 | m03,
30 | m04,
31 | m05,
32 | m06,
33 | m07,
34 | m08,
35 | m10,
36 | m12,
37 | m14,
38 | m16,
39 | m18,
40 | m20,
41 | m22,
42 | m24,
43 | m26,
44 | m28,
45 | m30,
46 | m32,
47 | m34
48 | );
--------------------------------------------------------------------------------
/src/method/03-_setOption.js:
--------------------------------------------------------------------------------
1 | /*global $*/
2 | /** @lends external:jQuery.ajaxComboBox.prototype */
3 | export default {
4 | /**
5 | * Initialize options
6 | *
7 | * @private
8 | * @arg {string|object} source - Server side file such as PHP. Or, JS object which contains data.
9 | * @arg {object} option - Options sent by user.
10 | * @returns {object} Initialized options
11 | */
12 | _setOption: function(source, option) {
13 | option = this._setOption1st(source, option);
14 | option = this._setOption2nd(option);
15 | return option;
16 | },
17 |
18 | /**
19 | * Initialize options (1st step)
20 | *
21 | * @private
22 | * @arg {string|object} source - Server side file such as PHP. Or, JS object which contains data.
23 | * @arg {object} option - Options sent by user.
24 | * @return {object} - Options at which the 1st step has ended.
25 | */
26 | _setOption1st: function(source, option) {
27 | return $.extend({
28 | // Basic
29 | source: source,
30 | lang: 'en',
31 | plugin_type: 'combobox',
32 | init_record: false,
33 | db_table: 'tbl',
34 | field: 'name',
35 | and_or: 'AND',
36 | per_page: 10,
37 | navi_num: 5,
38 | primary_key: 'id',
39 | button_img: '
',
40 | bind_to: false,
41 | navi_simple: false,
42 |
43 | // Sub-info
44 | sub_info: false,
45 | sub_as: {},
46 | show_field: '',
47 | hide_field: '',
48 |
49 | // Select-only
50 | select_only: false,
51 |
52 | // Tags
53 | tags: false,
54 |
55 | // Shorten URL
56 | shorten_btn: false,
57 | shorten_src: 'dist/bitly.php',
58 | shorten_min: 20,
59 | shorten_reg: false
60 | }, option);
61 | },
62 |
63 | /**
64 | * Initialize options (2nd step)
65 | *
66 | * @private
67 | * @arg {object} option - Options at which the 1st step has ended.
68 | * @return {object} - Options at which the 2nd step has ended.
69 | */
70 | _setOption2nd: function(option) {
71 | // A field to search (allows comma separated)
72 | option.search_field = (option.search_field) ? option.search_field : option.field;
73 |
74 | // Unify with uppercase
75 | option.and_or = option.and_or.toUpperCase();
76 |
77 | // Split string into array by comma
78 | option.hide_field = this._strToArray(option.hide_field);
79 | option.show_field = this._strToArray(option.show_field);
80 | option.search_field = this._strToArray(option.search_field);
81 |
82 | // Show whole rest fields as sub info, if "show_field" is not set.
83 | if (option.show_field[0] === '') {
84 | option.show_field[0] = '*'
85 | }
86 |
87 | // "ORDER BY" after "CASE WHEN"
88 | option.order_by = (option.order_by === undefined) ?
89 | option.search_field :
90 | option.order_by;
91 |
92 | // Make order_by to multidimensional array
93 | // Example: [ ['id', 'ASC'], ['name', 'DESC'] ]
94 | option.order_by = this._setOrderbyOption(option.order_by, option.field);
95 |
96 | // Text area
97 | if (option.plugin_type == 'textarea') {
98 | option.shorten_reg = this._setRegExpShort(option.shorten_reg, option.shorten_min);
99 | }
100 |
101 | // Tags
102 | if (option.tags) {
103 | option.tags = this._setTagPattern(option);
104 | }
105 | return option;
106 | },
107 |
108 | /**
109 | * Split string into array by comma.
110 | *
111 | * @private
112 | * @arg {string} str - Comma separated string
113 | * @return {array} Array splitted by comma
114 | */
115 | _strToArray: function(str) {
116 | return str.replace(/[\s ]+/g, '').split(',');
117 | },
118 |
119 | /**
120 | * Create regex to search URL.
121 | *
122 | * @private
123 | * @arg {object|boolean} shorten_reg - Regex object set by user. Or false.
124 | * @return {object} - Regex object
125 | */
126 | _setRegExpShort: function(shorten_reg, shorten_min) {
127 | // Use regex set by user if it exists
128 | if (shorten_reg) return shorten_reg;
129 |
130 | var reg = '(?:^|[\\s| \\[(<「『(【[<〈《]+)';
131 | reg += '(';
132 | reg += 'https:\\/\\/[^\\s| \\])>」』)】]>〉》]{' + (shorten_min - 7) + ',}';
133 | reg += '|';
134 | reg += 'http:\\/\\/[^\\s| \\])>」』)】]>〉》]{' + (shorten_min - 6) + ',}';
135 | reg += '|';
136 | reg += 'ftp:\\/\\/[^\\s| \\])>」』)】]>〉》]{' + (shorten_min - 5) + ',}';
137 | reg += ')';
138 | return new RegExp(reg, 'g');
139 | },
140 |
141 | /**
142 | * Initialize options for tags.
143 | *
144 | * @private
145 | * @arg {object} option - Options
146 | * @return {object} - Options for tags
147 | */
148 | _setTagPattern: function(option) {
149 | for (var i = 0; i < option.tags.length; i++) {
150 | option.tags[i] = this._setTagOptions(option, i);
151 | option.tags[i].pattern = this._setRegExpTag(option.tags[i].pattern, option.tags[i].space);
152 | }
153 | return option.tags;
154 | },
155 |
156 | /**
157 | * Initialize options (except for regex) for a tag.
158 | *
159 | * @private
160 | * @arg {object} option - Options
161 | * @arg {number} idx - Index of current selected tag
162 | * @return {object} - Options (except for regex) of a tag
163 | */
164 | _setTagOptions: function(option, idx) {
165 | option.tags[idx] = $.extend({
166 | // Insert space
167 | space: [true, true],
168 |
169 | // DB
170 | db_table: option.db_table,
171 | field: option.field,
172 | search_field: option.search_field,
173 | primary_key: option.primary_key,
174 |
175 | // Sub-info
176 | sub_info: option.sub_info,
177 | sub_as: option.sub_as,
178 | show_field: option.show_field,
179 | hide_field: option.hide_field
180 | }, option.tags[idx]);
181 |
182 | // Convert comma separated options to array.
183 | var arr = ['hide_field', 'show_field', 'search_field'];
184 | for (var i = 0; i < arr.length; i++) {
185 | if (typeof option.tags[idx][arr[i]] != 'object') {
186 | option.tags[idx][arr[i]] = this._strToArray(option.tags[idx][arr[i]]);
187 | }
188 | }
189 |
190 | // Make order_by to array.
191 | option.tags[idx].order_by = (option.tags[idx].order_by === undefined) ?
192 | option.order_by :
193 | this._setOrderbyOption(option.tags[idx].order_by, option.tags[idx].field);
194 |
195 | return option.tags[idx];
196 | },
197 |
198 | /**
199 | * Create regex to search tags.
200 | *
201 | * @private
202 | * @arg {Array} pattern - Pair of start and end of tag
203 | * @arg {Array} space - Pair of start and end of space
204 | * @return {object} - Object of regexes
205 | */
206 | _setRegExpTag: function(pattern, space) {
207 | // Escape for regex
208 | var esc_left = pattern[0].replace(/[\s\S]*/, this._escapeForReg);
209 | var esc_right = pattern[1].replace(/[\s\S]*/, this._escapeForReg);
210 |
211 | return {
212 | // Save original parentheses
213 | left: pattern[0],
214 | right: pattern[1],
215 |
216 | // Regex that extracts from the caret to the start of the tag in a string.
217 | reg_left: new RegExp(esc_left + '((?:(?!' + esc_left + '|' + esc_right + ')[^\\s ])*)$'),
218 |
219 | // Regex that extracts from the caret to the end of the tag in a string.
220 | reg_right: new RegExp('^((?:(?!' + esc_left + '|' + esc_right + ')[^\\s ])+)'),
221 |
222 | // Regex to decide whether to insert space before the start of tag after user select.
223 | space_left: new RegExp('^' + esc_left + '$|[\\s ]+' + esc_left + '$'),
224 |
225 | // Regex to decide whether to insert space after the end of tag after user select.
226 | space_right: new RegExp('^$|^[\\s ]+'),
227 |
228 | // Regex to decide whether to complement parentheses after user select.
229 | comp_right: new RegExp('^' + esc_right)
230 | };
231 | },
232 |
233 | /**
234 | * Callback function to escape for regex.
235 | *
236 | * @private
237 | * @arg {string} text - The matched substring.
238 | * @return {string} - Escaped string
239 | */
240 | _escapeForReg: function(text) {
241 | return '\\u' + (0x10000 + text.charCodeAt(0)).toString(16).slice(1);
242 | },
243 |
244 | /**
245 | * Adjust an array of "ORDER BY" to use it in the code.
246 | *
247 | * @private
248 | * @arg {Array|string} orders - Array of "ORDER BY" (not have processed).
249 | * @arg {string} field - Field to search.
250 | * @return {Array} - Array of "ORDER BY" (have processed).
251 | */
252 | _setOrderbyOption: function(orders, field) {
253 | if (typeof orders == 'string') orders = new Array(orders);
254 |
255 | var result = [];
256 | var arrSplit = [];
257 |
258 | for (var i = 0; i < orders.length; i++) {
259 | arrSplit = $.trim(orders[i]).split(/ +/);
260 | result[i] = (arrSplit.length == 2) ?
261 | arrSplit :
262 | (arrSplit[0].match(/^(ASC|DESC)$/i)) ? // In the future, lowercase "asc" or "desc" are judged to be field names.
263 | [field, arrSplit[0]] :
264 | [arrSplit[0], 'ASC'];
265 | }
266 |
267 | return result;
268 | }
269 | };
--------------------------------------------------------------------------------
/src/method/04-_setMessage.js:
--------------------------------------------------------------------------------
1 | /*global $*/
2 | /** @lends external:jQuery.ajaxComboBox.prototype */
3 | export default {
4 | /**
5 | * @private
6 | * @desc プラグインの中で使うメッセージを設定する
7 | */
8 | _setMessage: function() {
9 | var message;
10 | switch (this.option.lang) {
11 | // German (Thanks Sebastian Gohres)
12 | case 'de':
13 | message = {
14 | add_btn : 'Hinzufügen-Button',
15 | add_title : 'Box hinzufügen',
16 | del_btn : 'Löschen-Button',
17 | del_title : 'Box löschen',
18 | next : 'Nächsten',
19 | next_title : 'Nächsten' + this.option.per_page + ' (Pfeil-rechts)',
20 | prev : 'Vorherigen',
21 | prev_title : 'Vorherigen' + this.option.per_page + ' (Pfeil-links)',
22 | first_title : 'Ersten (Umschalt + Pfeil-links)',
23 | last_title : 'Letzten (Umschalt + Pfeil-rechts)',
24 | get_all_btn : 'alle (Pfeil-runter)',
25 | get_all_alt : '(Button)',
26 | close_btn : 'Schließen (Tab)',
27 | close_alt : '(Button)',
28 | loading : 'lade...',
29 | loading_alt : '(lade)',
30 | page_info : 'num_page_top - num_page_end von cnt_whole',
31 | select_ng : 'Achtung: Bitte wählen Sie aus der Liste aus.',
32 | select_ok : 'OK : Richtig ausgewählt.',
33 | not_found : 'nicht gefunden',
34 | ajax_error : 'Bei der Verbindung zum Server ist ein Fehler aufgetreten. (ajax-combobox)'
35 | };
36 | break;
37 |
38 | // English
39 | case 'en':
40 | message = {
41 | add_btn : 'Add button',
42 | add_title : 'add a box',
43 | del_btn : 'Del button',
44 | del_title : 'delete a box',
45 | next : 'Next',
46 | next_title : 'Next' + this.option.per_page + ' (Right key)',
47 | prev : 'Prev',
48 | prev_title : 'Prev' + this.option.per_page + ' (Left key)',
49 | first_title : 'First (Shift + Left key)',
50 | last_title : 'Last (Shift + Right key)',
51 | get_all_btn : 'Get All (Down key)',
52 | get_all_alt : '(button)',
53 | close_btn : 'Close (Tab key)',
54 | close_alt : '(button)',
55 | loading : 'loading...',
56 | loading_alt : '(loading)',
57 | page_info : 'num_page_top - num_page_end of cnt_whole',
58 | select_ng : 'Attention : Please choose from among the list.',
59 | select_ok : 'OK : Correctly selected.',
60 | not_found : 'not found',
61 | ajax_error : 'An error occurred while connecting to server. (ajax-combobox)'
62 | };
63 | break;
64 |
65 | // Spanish (Thanks Joaquin G. de la Zerda)
66 | case 'es':
67 | message = {
68 | add_btn : 'Agregar boton',
69 | add_title : 'Agregar una opcion',
70 | del_btn : 'Borrar boton',
71 | del_title : 'Borrar una opcion',
72 | next : 'Siguiente',
73 | next_title : 'Proximas ' + this.option.per_page + ' (tecla derecha)',
74 | prev : 'Anterior',
75 | prev_title : 'Anteriores ' + this.option.per_page + ' (tecla izquierda)',
76 | first_title : 'Primera (Shift + Left)',
77 | last_title : 'Ultima (Shift + Right)',
78 | get_all_btn : 'Ver todos (tecla abajo)',
79 | get_all_alt : '(boton)',
80 | close_btn : 'Cerrar (tecla TAB)',
81 | close_alt : '(boton)',
82 | loading : 'Cargando...',
83 | loading_alt : '(Cargando)',
84 | page_info : 'num_page_top - num_page_end de cnt_whole',
85 | select_ng : 'Atencion: Elija una opcion de la lista.',
86 | select_ok : 'OK: Correctamente seleccionado.',
87 | not_found : 'no encuentre',
88 | ajax_error : 'Un error ocurrió mientras conectando al servidor. (ajax-combobox)'
89 | };
90 | break;
91 |
92 | // Brazilian Portuguese (Thanks Marcio de Souza)
93 | case 'pt-br':
94 | message = {
95 | add_btn : 'Adicionar botão',
96 | add_title : 'Adicionar uma caixa',
97 | del_btn : 'Apagar botão',
98 | del_title : 'Apagar uma caixa',
99 | next : 'Próxima',
100 | next_title : 'Próxima ' + this.option.per_page + ' (tecla direita)',
101 | prev : 'Anterior',
102 | prev_title : 'Anterior ' + this.option.per_page + ' (tecla esquerda)',
103 | first_title : 'Primeira (Shift + Left)',
104 | last_title : 'Última (Shift + Right)',
105 | get_all_btn : 'Ver todos (Seta para baixo)',
106 | get_all_alt : '(botão)',
107 | close_btn : 'Fechar (tecla TAB)',
108 | close_alt : '(botão)',
109 | loading : 'Carregando...',
110 | loading_alt : '(Carregando)',
111 | page_info : 'num_page_top - num_page_end de cnt_whole',
112 | select_ng : 'Atenção: Escolha uma opção da lista.',
113 | select_ok : 'OK: Selecionado Corretamente.',
114 | not_found : 'não encontrado',
115 | ajax_error : 'Um erro aconteceu enquanto conectando a servidor. (ajax-combobox)'
116 | };
117 | break;
118 |
119 | // Japanese (ja)
120 | default:
121 | message = {
122 | add_btn : '追加ボタン',
123 | add_title : '入力ボックスを追加します',
124 | del_btn : '削除ボタン',
125 | del_title : '入力ボックスを削除します',
126 | next : '次へ',
127 | next_title : '次の' + this.option.per_page + '件 (右キー)',
128 | prev : '前へ',
129 | prev_title : '前の' + this.option.per_page + '件 (左キー)',
130 | first_title : '最初のページへ (Shift + 左キー)',
131 | last_title : '最後のページへ (Shift + 右キー)',
132 | get_all_btn : '全件取得 (下キー)',
133 | get_all_alt : '画像:ボタン',
134 | close_btn : '閉じる (Tabキー)',
135 | close_alt : '画像:ボタン',
136 | loading : '読み込み中...',
137 | loading_alt : '画像:読み込み中...',
138 | page_info : 'num_page_top - num_page_end 件 (全 cnt_whole 件)',
139 | select_ng : '注意 : リストの中から選択してください',
140 | select_ok : 'OK : 正しく選択されました。',
141 | not_found : '(0 件)',
142 | ajax_error : 'サーバとの通信でエラーが発生しました。(ajax-combobox)'
143 | };
144 | }
145 | this.message = message;
146 | },
147 | };
--------------------------------------------------------------------------------
/src/method/05-_setCssClass.js:
--------------------------------------------------------------------------------
1 | /*global $*/
2 | /** @lends external:jQuery.ajaxComboBox.prototype */
3 | export default {
4 | /**
5 | * @private
6 | * @desc CSSクラスの名前を設定する
7 | */
8 | _setCssClass: function() {
9 | // 各モード共通
10 | var css_class = {
11 | container : 'ac_container', // ComboBoxを包むdivタグ
12 | container_open : 'ac_container_open',
13 | selected : 'ac_selected',
14 | re_area : 'ac_result_area', // 結果リストの