bootstrap-bookingsync-sass 0.0.16 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -1
- data/CHANGELOG.md +11 -0
- data/assets/stylesheets/_bootstrap-bookingsync.scss +5 -2
- data/assets/stylesheets/bookingsync/_layout.scss +0 -49
- data/assets/stylesheets/bookingsync/_menu.scss +282 -0
- data/assets/stylesheets/bookingsync/_sheet.scss +27 -0
- data/assets/stylesheets/bookingsync/_switch.scss +0 -4
- data/assets/stylesheets/bookingsync/_theme.scss +0 -301
- data/assets/stylesheets/bookingsync/_type.scss +0 -4
- data/assets/stylesheets/bookingsync/_utilities.scss +46 -3
- data/assets/stylesheets/bookingsync/_variables.scss +130 -108
- data/docs/Gemfile +16 -0
- data/docs/Guardfile +25 -0
- data/docs/Rakefile +53 -0
- data/docs/Rules +58 -0
- data/docs/config.ru +15 -0
- data/docs/content/CNAME +1 -0
- data/docs/content/assets/javascripts/application.js.coffee +7 -0
- data/docs/content/assets/stylesheets/_base.scss +41 -0
- data/docs/content/assets/stylesheets/_callout.scss +50 -0
- data/docs/content/assets/stylesheets/_code.scss +18 -0
- data/docs/content/assets/stylesheets/_panels.scss +4 -0
- data/docs/content/assets/stylesheets/_variables.scss +14 -0
- data/docs/content/assets/stylesheets/application.scss +11 -0
- data/docs/content/components.html +23 -0
- data/docs/content/components/chosen.md +54 -0
- data/docs/content/components/menu.md +184 -0
- data/docs/content/components/sheet.md +36 -0
- data/docs/content/components/switch.md +44 -0
- data/docs/content/css.html +42 -0
- data/docs/content/css/forms.md +1138 -0
- data/docs/content/css/helpers.md +49 -0
- data/docs/content/highlight.css +1 -0
- data/docs/content/index.html +5 -0
- data/docs/layouts/default.html +12 -0
- data/docs/layouts/head.html +17 -0
- data/docs/layouts/navbar.html +27 -0
- data/docs/lib/default.rb +13 -0
- data/docs/nanoc.yaml +74 -0
- data/docs/vendor/assets/javascripts/chosen.js +1284 -0
- data/docs/vendor/assets/stylesheets/chosen.scss +448 -0
- data/lib/bootstrap/bookingsync/version.rb +1 -1
- metadata +36 -3
@@ -0,0 +1,49 @@
|
|
1
|
+
# Helper classes
|
2
|
+
|
3
|
+
## Vertical alignment
|
4
|
+
|
5
|
+
Vertical align inline elements having different line height.
|
6
|
+
|
7
|
+
<div class="example">
|
8
|
+
<h1>
|
9
|
+
<small class="valign-top">Top</small> aligned text.
|
10
|
+
</h1>
|
11
|
+
<h1>
|
12
|
+
<small class="valign-middle">Middle</small> aligned text.
|
13
|
+
</h1>
|
14
|
+
<h1>
|
15
|
+
<small class="valign-bottom">Bottom</small> aligned text.
|
16
|
+
</h1>
|
17
|
+
</div>
|
18
|
+
~~~ html
|
19
|
+
<h1><small class="valign-top">Top</small> aligned text.</h1>
|
20
|
+
<h1><small class="valign-middle">Middle</small> aligned text.</h1>
|
21
|
+
<h1><small class="valign-bottom">Bottom</small> aligned text.</h1>
|
22
|
+
~~~
|
23
|
+
|
24
|
+
Vertical align elements inside table cells.
|
25
|
+
|
26
|
+
<div class="example">
|
27
|
+
<table class="table">
|
28
|
+
<tr>
|
29
|
+
<th>Example<br/>row</th>
|
30
|
+
<td class="valign-top">Top</td>
|
31
|
+
<td class="valign-middle">Middle</td>
|
32
|
+
<td class="valign-bottom">Bottom</td>
|
33
|
+
</tr>
|
34
|
+
</table>
|
35
|
+
</div>
|
36
|
+
~~~ html
|
37
|
+
<table>
|
38
|
+
<tr>
|
39
|
+
<td class="valign-top">Top</td>
|
40
|
+
<td class="valign-middle">Middle</td>
|
41
|
+
<td class="valign-bottom">Bottom</td>
|
42
|
+
</tr>
|
43
|
+
</table>
|
44
|
+
~~~
|
45
|
+
|
46
|
+
<div class="bs-callout bs-callout-warning">
|
47
|
+
<h4>Vertical alignment inside block elements</h4>
|
48
|
+
<p>This helper classes will not vertically align content inside block elements.</p>
|
49
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= Pygments.css(style: "tango") %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<head>
|
2
|
+
<meta charset="utf-8">
|
3
|
+
<title>Bootstrap BookingSync SASS documentation</title>
|
4
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
6
|
+
|
7
|
+
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,700' rel='stylesheet' type='text/css'>
|
8
|
+
<link rel="stylesheet" href="/assets/stylesheets/application.css">
|
9
|
+
<link rel="stylesheet" href="/highlight.css">
|
10
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
|
11
|
+
|
12
|
+
<script src="http://code.jquery.com/jquery-1.12.0.min.js"></script>
|
13
|
+
<script src="/assets/javascripts/application.js"></script>
|
14
|
+
|
15
|
+
<!-- you don't need to keep this, but it's cool for stats! -->
|
16
|
+
<meta name="generator" content="nanoc <%= Nanoc::VERSION %>">
|
17
|
+
</head>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<nav class="navbar navbar-default navbar-static-top" role="navigation">
|
2
|
+
<div class="container">
|
3
|
+
<div class="navbar-header">
|
4
|
+
<button type="button" class="navbar-toggle sidebar-toggle collapsed" data-toggle="collapse" data-target="#navigation" aria-expanded="false">
|
5
|
+
<span class="sr-only">Toggle navigation</span>
|
6
|
+
<span class="icon-bar"></span>
|
7
|
+
<span class="icon-bar"></span>
|
8
|
+
<span class="icon-bar"></span>
|
9
|
+
</button>
|
10
|
+
|
11
|
+
<a class="navbar-brand" href="/">
|
12
|
+
BookingSync Styleguide
|
13
|
+
</a>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<div class="collapse navbar-collapse" id="navigation">
|
17
|
+
<ul class="nav navbar-nav navbar-right">
|
18
|
+
<li class="<%= "active" if @item_rep.path.start_with?("/css") %>">
|
19
|
+
<%= link_to("CSS", "/css") %>
|
20
|
+
</li>
|
21
|
+
<li class="<%= "active" if @item_rep.path.start_with?("/components") %>">
|
22
|
+
<%= link_to("Components", "/components") %>
|
23
|
+
</li>
|
24
|
+
</ul>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
</nav>
|
data/docs/lib/default.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# All files in the 'lib' directory will be loaded
|
2
|
+
# before nanoc starts compiling.
|
3
|
+
|
4
|
+
require 'pygments.rb'
|
5
|
+
|
6
|
+
require 'nanoc-sprockets'
|
7
|
+
|
8
|
+
require 'bootstrap-sass'
|
9
|
+
require 'bootstrap-bookingsync-sass'
|
10
|
+
|
11
|
+
include Nanoc::Helpers::Rendering
|
12
|
+
include Nanoc::Helpers::LinkTo
|
13
|
+
include Nanoc::Sprockets::Helper
|
data/docs/nanoc.yaml
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# A list of file extensions that nanoc will consider to be textual rather than
|
2
|
+
# binary. If an item with an extension not in this list is found, the file
|
3
|
+
# will be considered as binary.
|
4
|
+
text_extensions: [ 'coffee', 'css', 'erb', 'haml', 'handlebars', 'hb', 'htm', 'html', 'js', 'less', 'markdown', 'md', 'ms', 'mustache', 'php', 'rb', 'sass', 'scss', 'slim', 'txt', 'xhtml', 'xml' ]
|
5
|
+
|
6
|
+
# The path to the directory where all generated files will be written to. This
|
7
|
+
# can be an absolute path starting with a slash, but it can also be path
|
8
|
+
# relative to the site directory.
|
9
|
+
output_dir: output
|
10
|
+
|
11
|
+
# A list of index filenames, i.e. names of files that will be served by a web
|
12
|
+
# server when a directory is requested. Usually, index files are named
|
13
|
+
# “index.html”, but depending on the web server, this may be something else,
|
14
|
+
# such as “default.htm”. This list is used by nanoc to generate pretty URLs.
|
15
|
+
index_filenames: [ 'index.html' ]
|
16
|
+
|
17
|
+
# Whether or not to generate a diff of the compiled content when compiling a
|
18
|
+
# site. The diff will contain the differences between the compiled content
|
19
|
+
# before and after the last site compilation.
|
20
|
+
enable_output_diff: false
|
21
|
+
|
22
|
+
prune:
|
23
|
+
# Whether to automatically remove files not managed by nanoc from the output
|
24
|
+
# directory. For safety reasons, this is turned off by default.
|
25
|
+
auto_prune: false
|
26
|
+
|
27
|
+
# Which files and directories you want to exclude from pruning. If you version
|
28
|
+
# your output directory, you should probably exclude VCS directories such as
|
29
|
+
# .git, .svn etc.
|
30
|
+
exclude: [ '.git', '.hg', '.svn', 'CVS' ]
|
31
|
+
|
32
|
+
# The data sources where nanoc loads its data from. This is an array of
|
33
|
+
# hashes; each array element represents a single data source. By default,
|
34
|
+
# there is only a single data source that reads data from the “content/” and
|
35
|
+
# “layout/” directories in the site directory.
|
36
|
+
data_sources:
|
37
|
+
-
|
38
|
+
# The type is the identifier of the data source. By default, this will be
|
39
|
+
# `filesystem_unified`.
|
40
|
+
type: filesystem_unified
|
41
|
+
|
42
|
+
# The path where items should be mounted (comparable to mount points in
|
43
|
+
# Unix-like systems). This is “/” by default, meaning that items will have
|
44
|
+
# “/” prefixed to their identifiers. If the items root were “/en/”
|
45
|
+
# instead, an item at content/about.html would have an identifier of
|
46
|
+
# “/en/about/” instead of just “/about/”.
|
47
|
+
items_root: /
|
48
|
+
|
49
|
+
# The path where layouts should be mounted. The layouts root behaves the
|
50
|
+
# same as the items root, but applies to layouts rather than items.
|
51
|
+
layouts_root: /
|
52
|
+
|
53
|
+
# Whether to allow periods in identifiers. When turned off, everything
|
54
|
+
# past the first period is considered to be the extension, and when
|
55
|
+
# turned on, only the characters past the last period are considered to
|
56
|
+
# be the extension. For example, a file named “content/about.html.erb”
|
57
|
+
# will have the identifier “/about/” when turned off, but when turned on
|
58
|
+
# it will become “/about.html/” instead.
|
59
|
+
allow_periods_in_identifiers: false
|
60
|
+
|
61
|
+
# The encoding to use for input files. If your input files are not in
|
62
|
+
# UTF-8 (which they should be!), change this.
|
63
|
+
encoding: utf-8
|
64
|
+
|
65
|
+
# Configuration for the “check” command, which run unit tests on the site.
|
66
|
+
checks:
|
67
|
+
# Configuration for the “internal_links” checker, which checks whether all
|
68
|
+
# internal links are valid.
|
69
|
+
internal_links:
|
70
|
+
# A list of patterns, specified as regular expressions, to exclude from the check.
|
71
|
+
# If an internal link matches this pattern, the validity check will be skipped.
|
72
|
+
# E.g.:
|
73
|
+
# exclude: ['^/server_status']
|
74
|
+
exclude: []
|
@@ -0,0 +1,1284 @@
|
|
1
|
+
/*!
|
2
|
+
Chosen, a Select Box Enhancer for jQuery and Prototype
|
3
|
+
by Patrick Filler for Harvest, http://getharvest.com
|
4
|
+
|
5
|
+
Version 1.5.0
|
6
|
+
Full source at https://github.com/harvesthq/chosen
|
7
|
+
Copyright (c) 2011-2016 Harvest http://getharvest.com
|
8
|
+
|
9
|
+
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
10
|
+
This file is generated by `grunt build`, do not edit it by hand.
|
11
|
+
*/
|
12
|
+
|
13
|
+
(function() {
|
14
|
+
var $, AbstractChosen, Chosen, SelectParser, _ref,
|
15
|
+
__hasProp = {}.hasOwnProperty,
|
16
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
17
|
+
|
18
|
+
SelectParser = (function() {
|
19
|
+
function SelectParser() {
|
20
|
+
this.options_index = 0;
|
21
|
+
this.parsed = [];
|
22
|
+
}
|
23
|
+
|
24
|
+
SelectParser.prototype.add_node = function(child) {
|
25
|
+
if (child.nodeName.toUpperCase() === "OPTGROUP") {
|
26
|
+
return this.add_group(child);
|
27
|
+
} else {
|
28
|
+
return this.add_option(child);
|
29
|
+
}
|
30
|
+
};
|
31
|
+
|
32
|
+
SelectParser.prototype.add_group = function(group) {
|
33
|
+
var group_position, option, _i, _len, _ref, _results;
|
34
|
+
group_position = this.parsed.length;
|
35
|
+
this.parsed.push({
|
36
|
+
array_index: group_position,
|
37
|
+
group: true,
|
38
|
+
label: this.escapeExpression(group.label),
|
39
|
+
title: group.title ? group.title : void 0,
|
40
|
+
children: 0,
|
41
|
+
disabled: group.disabled,
|
42
|
+
classes: group.className
|
43
|
+
});
|
44
|
+
_ref = group.childNodes;
|
45
|
+
_results = [];
|
46
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
47
|
+
option = _ref[_i];
|
48
|
+
_results.push(this.add_option(option, group_position, group.disabled));
|
49
|
+
}
|
50
|
+
return _results;
|
51
|
+
};
|
52
|
+
|
53
|
+
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
|
54
|
+
if (option.nodeName.toUpperCase() === "OPTION") {
|
55
|
+
if (option.text !== "") {
|
56
|
+
if (group_position != null) {
|
57
|
+
this.parsed[group_position].children += 1;
|
58
|
+
}
|
59
|
+
this.parsed.push({
|
60
|
+
array_index: this.parsed.length,
|
61
|
+
options_index: this.options_index,
|
62
|
+
value: option.value,
|
63
|
+
text: option.text,
|
64
|
+
html: option.innerHTML,
|
65
|
+
title: option.title ? option.title : void 0,
|
66
|
+
selected: option.selected,
|
67
|
+
disabled: group_disabled === true ? group_disabled : option.disabled,
|
68
|
+
group_array_index: group_position,
|
69
|
+
group_label: group_position != null ? this.parsed[group_position].label : null,
|
70
|
+
classes: option.className,
|
71
|
+
style: option.style.cssText
|
72
|
+
});
|
73
|
+
} else {
|
74
|
+
this.parsed.push({
|
75
|
+
array_index: this.parsed.length,
|
76
|
+
options_index: this.options_index,
|
77
|
+
empty: true
|
78
|
+
});
|
79
|
+
}
|
80
|
+
return this.options_index += 1;
|
81
|
+
}
|
82
|
+
};
|
83
|
+
|
84
|
+
SelectParser.prototype.escapeExpression = function(text) {
|
85
|
+
var map, unsafe_chars;
|
86
|
+
if ((text == null) || text === false) {
|
87
|
+
return "";
|
88
|
+
}
|
89
|
+
if (!/[\&\<\>\"\'\`]/.test(text)) {
|
90
|
+
return text;
|
91
|
+
}
|
92
|
+
map = {
|
93
|
+
"<": "<",
|
94
|
+
">": ">",
|
95
|
+
'"': """,
|
96
|
+
"'": "'",
|
97
|
+
"`": "`"
|
98
|
+
};
|
99
|
+
unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
|
100
|
+
return text.replace(unsafe_chars, function(chr) {
|
101
|
+
return map[chr] || "&";
|
102
|
+
});
|
103
|
+
};
|
104
|
+
|
105
|
+
return SelectParser;
|
106
|
+
|
107
|
+
})();
|
108
|
+
|
109
|
+
SelectParser.select_to_array = function(select) {
|
110
|
+
var child, parser, _i, _len, _ref;
|
111
|
+
parser = new SelectParser();
|
112
|
+
_ref = select.childNodes;
|
113
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
114
|
+
child = _ref[_i];
|
115
|
+
parser.add_node(child);
|
116
|
+
}
|
117
|
+
return parser.parsed;
|
118
|
+
};
|
119
|
+
|
120
|
+
AbstractChosen = (function() {
|
121
|
+
function AbstractChosen(form_field, options) {
|
122
|
+
this.form_field = form_field;
|
123
|
+
this.options = options != null ? options : {};
|
124
|
+
if (!AbstractChosen.browser_is_supported()) {
|
125
|
+
return;
|
126
|
+
}
|
127
|
+
this.is_multiple = this.form_field.multiple;
|
128
|
+
this.set_default_text();
|
129
|
+
this.set_default_values();
|
130
|
+
this.setup();
|
131
|
+
this.set_up_html();
|
132
|
+
this.register_observers();
|
133
|
+
this.on_ready();
|
134
|
+
}
|
135
|
+
|
136
|
+
AbstractChosen.prototype.set_default_values = function() {
|
137
|
+
var _this = this;
|
138
|
+
this.click_test_action = function(evt) {
|
139
|
+
return _this.test_active_click(evt);
|
140
|
+
};
|
141
|
+
this.activate_action = function(evt) {
|
142
|
+
return _this.activate_field(evt);
|
143
|
+
};
|
144
|
+
this.active_field = false;
|
145
|
+
this.mouse_on_container = false;
|
146
|
+
this.results_showing = false;
|
147
|
+
this.result_highlighted = null;
|
148
|
+
this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
|
149
|
+
this.disable_search_threshold = this.options.disable_search_threshold || 0;
|
150
|
+
this.disable_search = this.options.disable_search || false;
|
151
|
+
this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
|
152
|
+
this.group_search = this.options.group_search != null ? this.options.group_search : true;
|
153
|
+
this.search_contains = this.options.search_contains || false;
|
154
|
+
this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
|
155
|
+
this.max_selected_options = this.options.max_selected_options || Infinity;
|
156
|
+
this.inherit_select_classes = this.options.inherit_select_classes || false;
|
157
|
+
this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
|
158
|
+
this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
|
159
|
+
this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
|
160
|
+
return this.max_shown_results = this.options.max_shown_results || Number.POSITIVE_INFINITY;
|
161
|
+
};
|
162
|
+
|
163
|
+
AbstractChosen.prototype.set_default_text = function() {
|
164
|
+
if (this.form_field.getAttribute("data-placeholder")) {
|
165
|
+
this.default_text = this.form_field.getAttribute("data-placeholder");
|
166
|
+
} else if (this.is_multiple) {
|
167
|
+
this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
|
168
|
+
} else {
|
169
|
+
this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
|
170
|
+
}
|
171
|
+
return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
|
172
|
+
};
|
173
|
+
|
174
|
+
AbstractChosen.prototype.choice_label = function(item) {
|
175
|
+
if (this.include_group_label_in_selected && (item.group_label != null)) {
|
176
|
+
return "<b class='group-name'>" + item.group_label + "</b>" + item.html;
|
177
|
+
} else {
|
178
|
+
return item.html;
|
179
|
+
}
|
180
|
+
};
|
181
|
+
|
182
|
+
AbstractChosen.prototype.mouse_enter = function() {
|
183
|
+
return this.mouse_on_container = true;
|
184
|
+
};
|
185
|
+
|
186
|
+
AbstractChosen.prototype.mouse_leave = function() {
|
187
|
+
return this.mouse_on_container = false;
|
188
|
+
};
|
189
|
+
|
190
|
+
AbstractChosen.prototype.input_focus = function(evt) {
|
191
|
+
var _this = this;
|
192
|
+
if (this.is_multiple) {
|
193
|
+
if (!this.active_field) {
|
194
|
+
return setTimeout((function() {
|
195
|
+
return _this.container_mousedown();
|
196
|
+
}), 50);
|
197
|
+
}
|
198
|
+
} else {
|
199
|
+
if (!this.active_field) {
|
200
|
+
return this.activate_field();
|
201
|
+
}
|
202
|
+
}
|
203
|
+
};
|
204
|
+
|
205
|
+
AbstractChosen.prototype.input_blur = function(evt) {
|
206
|
+
var _this = this;
|
207
|
+
if (!this.mouse_on_container) {
|
208
|
+
this.active_field = false;
|
209
|
+
return setTimeout((function() {
|
210
|
+
return _this.blur_test();
|
211
|
+
}), 100);
|
212
|
+
}
|
213
|
+
};
|
214
|
+
|
215
|
+
AbstractChosen.prototype.results_option_build = function(options) {
|
216
|
+
var content, data, data_content, shown_results, _i, _len, _ref;
|
217
|
+
content = '';
|
218
|
+
shown_results = 0;
|
219
|
+
_ref = this.results_data;
|
220
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
221
|
+
data = _ref[_i];
|
222
|
+
data_content = '';
|
223
|
+
if (data.group) {
|
224
|
+
data_content = this.result_add_group(data);
|
225
|
+
} else {
|
226
|
+
data_content = this.result_add_option(data);
|
227
|
+
}
|
228
|
+
if (data_content !== '') {
|
229
|
+
shown_results++;
|
230
|
+
content += data_content;
|
231
|
+
}
|
232
|
+
if (options != null ? options.first : void 0) {
|
233
|
+
if (data.selected && this.is_multiple) {
|
234
|
+
this.choice_build(data);
|
235
|
+
} else if (data.selected && !this.is_multiple) {
|
236
|
+
this.single_set_selected_text(this.choice_label(data));
|
237
|
+
}
|
238
|
+
}
|
239
|
+
if (shown_results >= this.max_shown_results) {
|
240
|
+
break;
|
241
|
+
}
|
242
|
+
}
|
243
|
+
return content;
|
244
|
+
};
|
245
|
+
|
246
|
+
AbstractChosen.prototype.result_add_option = function(option) {
|
247
|
+
var classes, option_el;
|
248
|
+
if (!option.search_match) {
|
249
|
+
return '';
|
250
|
+
}
|
251
|
+
if (!this.include_option_in_results(option)) {
|
252
|
+
return '';
|
253
|
+
}
|
254
|
+
classes = [];
|
255
|
+
if (!option.disabled && !(option.selected && this.is_multiple)) {
|
256
|
+
classes.push("active-result");
|
257
|
+
}
|
258
|
+
if (option.disabled && !(option.selected && this.is_multiple)) {
|
259
|
+
classes.push("disabled-result");
|
260
|
+
}
|
261
|
+
if (option.selected) {
|
262
|
+
classes.push("result-selected");
|
263
|
+
}
|
264
|
+
if (option.group_array_index != null) {
|
265
|
+
classes.push("group-option");
|
266
|
+
}
|
267
|
+
if (option.classes !== "") {
|
268
|
+
classes.push(option.classes);
|
269
|
+
}
|
270
|
+
option_el = document.createElement("li");
|
271
|
+
option_el.className = classes.join(" ");
|
272
|
+
option_el.style.cssText = option.style;
|
273
|
+
option_el.setAttribute("data-option-array-index", option.array_index);
|
274
|
+
option_el.innerHTML = option.search_text;
|
275
|
+
if (option.title) {
|
276
|
+
option_el.title = option.title;
|
277
|
+
}
|
278
|
+
return this.outerHTML(option_el);
|
279
|
+
};
|
280
|
+
|
281
|
+
AbstractChosen.prototype.result_add_group = function(group) {
|
282
|
+
var classes, group_el;
|
283
|
+
if (!(group.search_match || group.group_match)) {
|
284
|
+
return '';
|
285
|
+
}
|
286
|
+
if (!(group.active_options > 0)) {
|
287
|
+
return '';
|
288
|
+
}
|
289
|
+
classes = [];
|
290
|
+
classes.push("group-result");
|
291
|
+
if (group.classes) {
|
292
|
+
classes.push(group.classes);
|
293
|
+
}
|
294
|
+
group_el = document.createElement("li");
|
295
|
+
group_el.className = classes.join(" ");
|
296
|
+
group_el.innerHTML = group.search_text;
|
297
|
+
if (group.title) {
|
298
|
+
group_el.title = group.title;
|
299
|
+
}
|
300
|
+
return this.outerHTML(group_el);
|
301
|
+
};
|
302
|
+
|
303
|
+
AbstractChosen.prototype.results_update_field = function() {
|
304
|
+
this.set_default_text();
|
305
|
+
if (!this.is_multiple) {
|
306
|
+
this.results_reset_cleanup();
|
307
|
+
}
|
308
|
+
this.result_clear_highlight();
|
309
|
+
this.results_build();
|
310
|
+
if (this.results_showing) {
|
311
|
+
return this.winnow_results();
|
312
|
+
}
|
313
|
+
};
|
314
|
+
|
315
|
+
AbstractChosen.prototype.reset_single_select_options = function() {
|
316
|
+
var result, _i, _len, _ref, _results;
|
317
|
+
_ref = this.results_data;
|
318
|
+
_results = [];
|
319
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
320
|
+
result = _ref[_i];
|
321
|
+
if (result.selected) {
|
322
|
+
_results.push(result.selected = false);
|
323
|
+
} else {
|
324
|
+
_results.push(void 0);
|
325
|
+
}
|
326
|
+
}
|
327
|
+
return _results;
|
328
|
+
};
|
329
|
+
|
330
|
+
AbstractChosen.prototype.results_toggle = function() {
|
331
|
+
if (this.results_showing) {
|
332
|
+
return this.results_hide();
|
333
|
+
} else {
|
334
|
+
return this.results_show();
|
335
|
+
}
|
336
|
+
};
|
337
|
+
|
338
|
+
AbstractChosen.prototype.results_search = function(evt) {
|
339
|
+
if (this.results_showing) {
|
340
|
+
return this.winnow_results();
|
341
|
+
} else {
|
342
|
+
return this.results_show();
|
343
|
+
}
|
344
|
+
};
|
345
|
+
|
346
|
+
AbstractChosen.prototype.winnow_results = function() {
|
347
|
+
var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
|
348
|
+
this.no_results_clear();
|
349
|
+
results = 0;
|
350
|
+
searchText = this.get_search_text();
|
351
|
+
escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
352
|
+
zregex = new RegExp(escapedSearchText, 'i');
|
353
|
+
regex = this.get_search_regex(escapedSearchText);
|
354
|
+
_ref = this.results_data;
|
355
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
356
|
+
option = _ref[_i];
|
357
|
+
option.search_match = false;
|
358
|
+
results_group = null;
|
359
|
+
if (this.include_option_in_results(option)) {
|
360
|
+
if (option.group) {
|
361
|
+
option.group_match = false;
|
362
|
+
option.active_options = 0;
|
363
|
+
}
|
364
|
+
if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
|
365
|
+
results_group = this.results_data[option.group_array_index];
|
366
|
+
if (results_group.active_options === 0 && results_group.search_match) {
|
367
|
+
results += 1;
|
368
|
+
}
|
369
|
+
results_group.active_options += 1;
|
370
|
+
}
|
371
|
+
option.search_text = option.group ? option.label : option.html;
|
372
|
+
if (!(option.group && !this.group_search)) {
|
373
|
+
option.search_match = this.search_string_match(option.search_text, regex);
|
374
|
+
if (option.search_match && !option.group) {
|
375
|
+
results += 1;
|
376
|
+
}
|
377
|
+
if (option.search_match) {
|
378
|
+
if (searchText.length) {
|
379
|
+
startpos = option.search_text.search(zregex);
|
380
|
+
text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
|
381
|
+
option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
|
382
|
+
}
|
383
|
+
if (results_group != null) {
|
384
|
+
results_group.group_match = true;
|
385
|
+
}
|
386
|
+
} else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
|
387
|
+
option.search_match = true;
|
388
|
+
}
|
389
|
+
}
|
390
|
+
}
|
391
|
+
}
|
392
|
+
this.result_clear_highlight();
|
393
|
+
if (results < 1 && searchText.length) {
|
394
|
+
this.update_results_content("");
|
395
|
+
return this.no_results(searchText);
|
396
|
+
} else {
|
397
|
+
this.update_results_content(this.results_option_build());
|
398
|
+
return this.winnow_results_set_highlight();
|
399
|
+
}
|
400
|
+
};
|
401
|
+
|
402
|
+
AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
|
403
|
+
var regex_anchor;
|
404
|
+
regex_anchor = this.search_contains ? "" : "^";
|
405
|
+
return new RegExp(regex_anchor + escaped_search_string, 'i');
|
406
|
+
};
|
407
|
+
|
408
|
+
AbstractChosen.prototype.search_string_match = function(search_string, regex) {
|
409
|
+
var part, parts, _i, _len;
|
410
|
+
if (regex.test(search_string)) {
|
411
|
+
return true;
|
412
|
+
} else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
|
413
|
+
parts = search_string.replace(/\[|\]/g, "").split(" ");
|
414
|
+
if (parts.length) {
|
415
|
+
for (_i = 0, _len = parts.length; _i < _len; _i++) {
|
416
|
+
part = parts[_i];
|
417
|
+
if (regex.test(part)) {
|
418
|
+
return true;
|
419
|
+
}
|
420
|
+
}
|
421
|
+
}
|
422
|
+
}
|
423
|
+
};
|
424
|
+
|
425
|
+
AbstractChosen.prototype.choices_count = function() {
|
426
|
+
var option, _i, _len, _ref;
|
427
|
+
if (this.selected_option_count != null) {
|
428
|
+
return this.selected_option_count;
|
429
|
+
}
|
430
|
+
this.selected_option_count = 0;
|
431
|
+
_ref = this.form_field.options;
|
432
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
433
|
+
option = _ref[_i];
|
434
|
+
if (option.selected) {
|
435
|
+
this.selected_option_count += 1;
|
436
|
+
}
|
437
|
+
}
|
438
|
+
return this.selected_option_count;
|
439
|
+
};
|
440
|
+
|
441
|
+
AbstractChosen.prototype.choices_click = function(evt) {
|
442
|
+
evt.preventDefault();
|
443
|
+
if (!(this.results_showing || this.is_disabled)) {
|
444
|
+
return this.results_show();
|
445
|
+
}
|
446
|
+
};
|
447
|
+
|
448
|
+
AbstractChosen.prototype.keyup_checker = function(evt) {
|
449
|
+
var stroke, _ref;
|
450
|
+
stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
|
451
|
+
this.search_field_scale();
|
452
|
+
switch (stroke) {
|
453
|
+
case 8:
|
454
|
+
if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
|
455
|
+
return this.keydown_backstroke();
|
456
|
+
} else if (!this.pending_backstroke) {
|
457
|
+
this.result_clear_highlight();
|
458
|
+
return this.results_search();
|
459
|
+
}
|
460
|
+
break;
|
461
|
+
case 13:
|
462
|
+
evt.preventDefault();
|
463
|
+
if (this.results_showing) {
|
464
|
+
return this.result_select(evt);
|
465
|
+
}
|
466
|
+
break;
|
467
|
+
case 27:
|
468
|
+
if (this.results_showing) {
|
469
|
+
this.results_hide();
|
470
|
+
}
|
471
|
+
return true;
|
472
|
+
case 9:
|
473
|
+
case 38:
|
474
|
+
case 40:
|
475
|
+
case 16:
|
476
|
+
case 91:
|
477
|
+
case 17:
|
478
|
+
case 18:
|
479
|
+
break;
|
480
|
+
default:
|
481
|
+
return this.results_search();
|
482
|
+
}
|
483
|
+
};
|
484
|
+
|
485
|
+
AbstractChosen.prototype.clipboard_event_checker = function(evt) {
|
486
|
+
var _this = this;
|
487
|
+
return setTimeout((function() {
|
488
|
+
return _this.results_search();
|
489
|
+
}), 50);
|
490
|
+
};
|
491
|
+
|
492
|
+
AbstractChosen.prototype.container_width = function() {
|
493
|
+
if (this.options.width != null) {
|
494
|
+
return this.options.width;
|
495
|
+
} else {
|
496
|
+
return "" + this.form_field.offsetWidth + "px";
|
497
|
+
}
|
498
|
+
};
|
499
|
+
|
500
|
+
AbstractChosen.prototype.include_option_in_results = function(option) {
|
501
|
+
if (this.is_multiple && (!this.display_selected_options && option.selected)) {
|
502
|
+
return false;
|
503
|
+
}
|
504
|
+
if (!this.display_disabled_options && option.disabled) {
|
505
|
+
return false;
|
506
|
+
}
|
507
|
+
if (option.empty) {
|
508
|
+
return false;
|
509
|
+
}
|
510
|
+
return true;
|
511
|
+
};
|
512
|
+
|
513
|
+
AbstractChosen.prototype.search_results_touchstart = function(evt) {
|
514
|
+
this.touch_started = true;
|
515
|
+
return this.search_results_mouseover(evt);
|
516
|
+
};
|
517
|
+
|
518
|
+
AbstractChosen.prototype.search_results_touchmove = function(evt) {
|
519
|
+
this.touch_started = false;
|
520
|
+
return this.search_results_mouseout(evt);
|
521
|
+
};
|
522
|
+
|
523
|
+
AbstractChosen.prototype.search_results_touchend = function(evt) {
|
524
|
+
if (this.touch_started) {
|
525
|
+
return this.search_results_mouseup(evt);
|
526
|
+
}
|
527
|
+
};
|
528
|
+
|
529
|
+
AbstractChosen.prototype.outerHTML = function(element) {
|
530
|
+
var tmp;
|
531
|
+
if (element.outerHTML) {
|
532
|
+
return element.outerHTML;
|
533
|
+
}
|
534
|
+
tmp = document.createElement("div");
|
535
|
+
tmp.appendChild(element);
|
536
|
+
return tmp.innerHTML;
|
537
|
+
};
|
538
|
+
|
539
|
+
AbstractChosen.browser_is_supported = function() {
|
540
|
+
if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
|
541
|
+
return false;
|
542
|
+
}
|
543
|
+
if (/Android/i.test(window.navigator.userAgent)) {
|
544
|
+
if (/Mobile/i.test(window.navigator.userAgent)) {
|
545
|
+
return false;
|
546
|
+
}
|
547
|
+
}
|
548
|
+
if (/IEMobile/i.test(window.navigator.userAgent)) {
|
549
|
+
return false;
|
550
|
+
}
|
551
|
+
if (/Windows Phone/i.test(window.navigator.userAgent)) {
|
552
|
+
return false;
|
553
|
+
}
|
554
|
+
if (/BlackBerry/i.test(window.navigator.userAgent)) {
|
555
|
+
return false;
|
556
|
+
}
|
557
|
+
if (/BB10/i.test(window.navigator.userAgent)) {
|
558
|
+
return false;
|
559
|
+
}
|
560
|
+
if (window.navigator.appName === "Microsoft Internet Explorer") {
|
561
|
+
return document.documentMode >= 8;
|
562
|
+
}
|
563
|
+
return true;
|
564
|
+
};
|
565
|
+
|
566
|
+
AbstractChosen.default_multiple_text = "Select Some Options";
|
567
|
+
|
568
|
+
AbstractChosen.default_single_text = "Select an Option";
|
569
|
+
|
570
|
+
AbstractChosen.default_no_result_text = "No results match";
|
571
|
+
|
572
|
+
return AbstractChosen;
|
573
|
+
|
574
|
+
})();
|
575
|
+
|
576
|
+
$ = jQuery;
|
577
|
+
|
578
|
+
$.fn.extend({
|
579
|
+
chosen: function(options) {
|
580
|
+
if (!AbstractChosen.browser_is_supported()) {
|
581
|
+
return this;
|
582
|
+
}
|
583
|
+
return this.each(function(input_field) {
|
584
|
+
var $this, chosen;
|
585
|
+
$this = $(this);
|
586
|
+
chosen = $this.data('chosen');
|
587
|
+
if (options === 'destroy') {
|
588
|
+
if (chosen instanceof Chosen) {
|
589
|
+
chosen.destroy();
|
590
|
+
}
|
591
|
+
return;
|
592
|
+
}
|
593
|
+
if (!(chosen instanceof Chosen)) {
|
594
|
+
$this.data('chosen', new Chosen(this, options));
|
595
|
+
}
|
596
|
+
});
|
597
|
+
}
|
598
|
+
});
|
599
|
+
|
600
|
+
Chosen = (function(_super) {
|
601
|
+
__extends(Chosen, _super);
|
602
|
+
|
603
|
+
function Chosen() {
|
604
|
+
_ref = Chosen.__super__.constructor.apply(this, arguments);
|
605
|
+
return _ref;
|
606
|
+
}
|
607
|
+
|
608
|
+
Chosen.prototype.setup = function() {
|
609
|
+
this.form_field_jq = $(this.form_field);
|
610
|
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
611
|
+
return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl");
|
612
|
+
};
|
613
|
+
|
614
|
+
Chosen.prototype.set_up_html = function() {
|
615
|
+
var container_classes, container_props;
|
616
|
+
container_classes = ["chosen-container"];
|
617
|
+
container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
|
618
|
+
if (this.inherit_select_classes && this.form_field.className) {
|
619
|
+
container_classes.push(this.form_field.className);
|
620
|
+
}
|
621
|
+
if (this.is_rtl) {
|
622
|
+
container_classes.push("chosen-rtl");
|
623
|
+
}
|
624
|
+
container_props = {
|
625
|
+
'class': container_classes.join(' '),
|
626
|
+
'style': "width: " + (this.container_width()) + ";",
|
627
|
+
'title': this.form_field.title
|
628
|
+
};
|
629
|
+
if (this.form_field.id.length) {
|
630
|
+
container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
|
631
|
+
}
|
632
|
+
this.container = $("<div />", container_props);
|
633
|
+
if (this.is_multiple) {
|
634
|
+
this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
|
635
|
+
} else {
|
636
|
+
this.container.html('<a class="chosen-single chosen-default"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
|
637
|
+
}
|
638
|
+
this.form_field_jq.hide().after(this.container);
|
639
|
+
this.dropdown = this.container.find('div.chosen-drop').first();
|
640
|
+
this.search_field = this.container.find('input').first();
|
641
|
+
this.search_results = this.container.find('ul.chosen-results').first();
|
642
|
+
this.search_field_scale();
|
643
|
+
this.search_no_results = this.container.find('li.no-results').first();
|
644
|
+
if (this.is_multiple) {
|
645
|
+
this.search_choices = this.container.find('ul.chosen-choices').first();
|
646
|
+
this.search_container = this.container.find('li.search-field').first();
|
647
|
+
} else {
|
648
|
+
this.search_container = this.container.find('div.chosen-search').first();
|
649
|
+
this.selected_item = this.container.find('.chosen-single').first();
|
650
|
+
}
|
651
|
+
this.results_build();
|
652
|
+
this.set_tab_index();
|
653
|
+
return this.set_label_behavior();
|
654
|
+
};
|
655
|
+
|
656
|
+
Chosen.prototype.on_ready = function() {
|
657
|
+
return this.form_field_jq.trigger("chosen:ready", {
|
658
|
+
chosen: this
|
659
|
+
});
|
660
|
+
};
|
661
|
+
|
662
|
+
Chosen.prototype.register_observers = function() {
|
663
|
+
var _this = this;
|
664
|
+
this.container.bind('touchstart.chosen', function(evt) {
|
665
|
+
_this.container_mousedown(evt);
|
666
|
+
return evt.preventDefault();
|
667
|
+
});
|
668
|
+
this.container.bind('touchend.chosen', function(evt) {
|
669
|
+
_this.container_mouseup(evt);
|
670
|
+
return evt.preventDefault();
|
671
|
+
});
|
672
|
+
this.container.bind('mousedown.chosen', function(evt) {
|
673
|
+
_this.container_mousedown(evt);
|
674
|
+
});
|
675
|
+
this.container.bind('mouseup.chosen', function(evt) {
|
676
|
+
_this.container_mouseup(evt);
|
677
|
+
});
|
678
|
+
this.container.bind('mouseenter.chosen', function(evt) {
|
679
|
+
_this.mouse_enter(evt);
|
680
|
+
});
|
681
|
+
this.container.bind('mouseleave.chosen', function(evt) {
|
682
|
+
_this.mouse_leave(evt);
|
683
|
+
});
|
684
|
+
this.search_results.bind('mouseup.chosen', function(evt) {
|
685
|
+
_this.search_results_mouseup(evt);
|
686
|
+
});
|
687
|
+
this.search_results.bind('mouseover.chosen', function(evt) {
|
688
|
+
_this.search_results_mouseover(evt);
|
689
|
+
});
|
690
|
+
this.search_results.bind('mouseout.chosen', function(evt) {
|
691
|
+
_this.search_results_mouseout(evt);
|
692
|
+
});
|
693
|
+
this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) {
|
694
|
+
_this.search_results_mousewheel(evt);
|
695
|
+
});
|
696
|
+
this.search_results.bind('touchstart.chosen', function(evt) {
|
697
|
+
_this.search_results_touchstart(evt);
|
698
|
+
});
|
699
|
+
this.search_results.bind('touchmove.chosen', function(evt) {
|
700
|
+
_this.search_results_touchmove(evt);
|
701
|
+
});
|
702
|
+
this.search_results.bind('touchend.chosen', function(evt) {
|
703
|
+
_this.search_results_touchend(evt);
|
704
|
+
});
|
705
|
+
this.form_field_jq.bind("chosen:updated.chosen", function(evt) {
|
706
|
+
_this.results_update_field(evt);
|
707
|
+
});
|
708
|
+
this.form_field_jq.bind("chosen:activate.chosen", function(evt) {
|
709
|
+
_this.activate_field(evt);
|
710
|
+
});
|
711
|
+
this.form_field_jq.bind("chosen:open.chosen", function(evt) {
|
712
|
+
_this.container_mousedown(evt);
|
713
|
+
});
|
714
|
+
this.form_field_jq.bind("chosen:close.chosen", function(evt) {
|
715
|
+
_this.input_blur(evt);
|
716
|
+
});
|
717
|
+
this.search_field.bind('blur.chosen', function(evt) {
|
718
|
+
_this.input_blur(evt);
|
719
|
+
});
|
720
|
+
this.search_field.bind('keyup.chosen', function(evt) {
|
721
|
+
_this.keyup_checker(evt);
|
722
|
+
});
|
723
|
+
this.search_field.bind('keydown.chosen', function(evt) {
|
724
|
+
_this.keydown_checker(evt);
|
725
|
+
});
|
726
|
+
this.search_field.bind('focus.chosen', function(evt) {
|
727
|
+
_this.input_focus(evt);
|
728
|
+
});
|
729
|
+
this.search_field.bind('cut.chosen', function(evt) {
|
730
|
+
_this.clipboard_event_checker(evt);
|
731
|
+
});
|
732
|
+
this.search_field.bind('paste.chosen', function(evt) {
|
733
|
+
_this.clipboard_event_checker(evt);
|
734
|
+
});
|
735
|
+
if (this.is_multiple) {
|
736
|
+
return this.search_choices.bind('click.chosen', function(evt) {
|
737
|
+
_this.choices_click(evt);
|
738
|
+
});
|
739
|
+
} else {
|
740
|
+
return this.container.bind('click.chosen', function(evt) {
|
741
|
+
evt.preventDefault();
|
742
|
+
});
|
743
|
+
}
|
744
|
+
};
|
745
|
+
|
746
|
+
Chosen.prototype.destroy = function() {
|
747
|
+
$(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
|
748
|
+
if (this.search_field[0].tabIndex) {
|
749
|
+
this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
|
750
|
+
}
|
751
|
+
this.container.remove();
|
752
|
+
this.form_field_jq.removeData('chosen');
|
753
|
+
return this.form_field_jq.show();
|
754
|
+
};
|
755
|
+
|
756
|
+
Chosen.prototype.search_field_disabled = function() {
|
757
|
+
this.is_disabled = this.form_field_jq[0].disabled;
|
758
|
+
if (this.is_disabled) {
|
759
|
+
this.container.addClass('chosen-disabled');
|
760
|
+
this.search_field[0].disabled = true;
|
761
|
+
if (!this.is_multiple) {
|
762
|
+
this.selected_item.unbind("focus.chosen", this.activate_action);
|
763
|
+
}
|
764
|
+
return this.close_field();
|
765
|
+
} else {
|
766
|
+
this.container.removeClass('chosen-disabled');
|
767
|
+
this.search_field[0].disabled = false;
|
768
|
+
if (!this.is_multiple) {
|
769
|
+
return this.selected_item.bind("focus.chosen", this.activate_action);
|
770
|
+
}
|
771
|
+
}
|
772
|
+
};
|
773
|
+
|
774
|
+
Chosen.prototype.container_mousedown = function(evt) {
|
775
|
+
if (!this.is_disabled) {
|
776
|
+
if (evt && evt.type === "mousedown" && !this.results_showing) {
|
777
|
+
evt.preventDefault();
|
778
|
+
}
|
779
|
+
if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
|
780
|
+
if (!this.active_field) {
|
781
|
+
if (this.is_multiple) {
|
782
|
+
this.search_field.val("");
|
783
|
+
}
|
784
|
+
$(this.container[0].ownerDocument).bind('click.chosen', this.click_test_action);
|
785
|
+
this.results_show();
|
786
|
+
} else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
|
787
|
+
evt.preventDefault();
|
788
|
+
this.results_toggle();
|
789
|
+
}
|
790
|
+
return this.activate_field();
|
791
|
+
}
|
792
|
+
}
|
793
|
+
};
|
794
|
+
|
795
|
+
Chosen.prototype.container_mouseup = function(evt) {
|
796
|
+
if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
|
797
|
+
return this.results_reset(evt);
|
798
|
+
}
|
799
|
+
};
|
800
|
+
|
801
|
+
Chosen.prototype.search_results_mousewheel = function(evt) {
|
802
|
+
var delta;
|
803
|
+
if (evt.originalEvent) {
|
804
|
+
delta = evt.originalEvent.deltaY || -evt.originalEvent.wheelDelta || evt.originalEvent.detail;
|
805
|
+
}
|
806
|
+
if (delta != null) {
|
807
|
+
evt.preventDefault();
|
808
|
+
if (evt.type === 'DOMMouseScroll') {
|
809
|
+
delta = delta * 40;
|
810
|
+
}
|
811
|
+
return this.search_results.scrollTop(delta + this.search_results.scrollTop());
|
812
|
+
}
|
813
|
+
};
|
814
|
+
|
815
|
+
Chosen.prototype.blur_test = function(evt) {
|
816
|
+
if (!this.active_field && this.container.hasClass("chosen-container-active")) {
|
817
|
+
return this.close_field();
|
818
|
+
}
|
819
|
+
};
|
820
|
+
|
821
|
+
Chosen.prototype.close_field = function() {
|
822
|
+
$(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
|
823
|
+
this.active_field = false;
|
824
|
+
this.results_hide();
|
825
|
+
this.container.removeClass("chosen-container-active");
|
826
|
+
this.clear_backstroke();
|
827
|
+
this.show_search_field_default();
|
828
|
+
return this.search_field_scale();
|
829
|
+
};
|
830
|
+
|
831
|
+
Chosen.prototype.activate_field = function() {
|
832
|
+
this.container.addClass("chosen-container-active");
|
833
|
+
this.active_field = true;
|
834
|
+
this.search_field.val(this.search_field.val());
|
835
|
+
return this.search_field.focus();
|
836
|
+
};
|
837
|
+
|
838
|
+
Chosen.prototype.test_active_click = function(evt) {
|
839
|
+
var active_container;
|
840
|
+
active_container = $(evt.target).closest('.chosen-container');
|
841
|
+
if (active_container.length && this.container[0] === active_container[0]) {
|
842
|
+
return this.active_field = true;
|
843
|
+
} else {
|
844
|
+
return this.close_field();
|
845
|
+
}
|
846
|
+
};
|
847
|
+
|
848
|
+
Chosen.prototype.results_build = function() {
|
849
|
+
this.parsing = true;
|
850
|
+
this.selected_option_count = null;
|
851
|
+
this.results_data = SelectParser.select_to_array(this.form_field);
|
852
|
+
if (this.is_multiple) {
|
853
|
+
this.search_choices.find("li.search-choice").remove();
|
854
|
+
} else if (!this.is_multiple) {
|
855
|
+
this.single_set_selected_text();
|
856
|
+
if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
|
857
|
+
this.search_field[0].readOnly = true;
|
858
|
+
this.container.addClass("chosen-container-single-nosearch");
|
859
|
+
} else {
|
860
|
+
this.search_field[0].readOnly = false;
|
861
|
+
this.container.removeClass("chosen-container-single-nosearch");
|
862
|
+
}
|
863
|
+
}
|
864
|
+
this.update_results_content(this.results_option_build({
|
865
|
+
first: true
|
866
|
+
}));
|
867
|
+
this.search_field_disabled();
|
868
|
+
this.show_search_field_default();
|
869
|
+
this.search_field_scale();
|
870
|
+
return this.parsing = false;
|
871
|
+
};
|
872
|
+
|
873
|
+
Chosen.prototype.result_do_highlight = function(el) {
|
874
|
+
var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
|
875
|
+
if (el.length) {
|
876
|
+
this.result_clear_highlight();
|
877
|
+
this.result_highlight = el;
|
878
|
+
this.result_highlight.addClass("highlighted");
|
879
|
+
maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
|
880
|
+
visible_top = this.search_results.scrollTop();
|
881
|
+
visible_bottom = maxHeight + visible_top;
|
882
|
+
high_top = this.result_highlight.position().top + this.search_results.scrollTop();
|
883
|
+
high_bottom = high_top + this.result_highlight.outerHeight();
|
884
|
+
if (high_bottom >= visible_bottom) {
|
885
|
+
return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
|
886
|
+
} else if (high_top < visible_top) {
|
887
|
+
return this.search_results.scrollTop(high_top);
|
888
|
+
}
|
889
|
+
}
|
890
|
+
};
|
891
|
+
|
892
|
+
Chosen.prototype.result_clear_highlight = function() {
|
893
|
+
if (this.result_highlight) {
|
894
|
+
this.result_highlight.removeClass("highlighted");
|
895
|
+
}
|
896
|
+
return this.result_highlight = null;
|
897
|
+
};
|
898
|
+
|
899
|
+
Chosen.prototype.results_show = function() {
|
900
|
+
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
901
|
+
this.form_field_jq.trigger("chosen:maxselected", {
|
902
|
+
chosen: this
|
903
|
+
});
|
904
|
+
return false;
|
905
|
+
}
|
906
|
+
this.container.addClass("chosen-with-drop");
|
907
|
+
this.results_showing = true;
|
908
|
+
this.search_field.focus();
|
909
|
+
this.search_field.val(this.search_field.val());
|
910
|
+
this.winnow_results();
|
911
|
+
return this.form_field_jq.trigger("chosen:showing_dropdown", {
|
912
|
+
chosen: this
|
913
|
+
});
|
914
|
+
};
|
915
|
+
|
916
|
+
Chosen.prototype.update_results_content = function(content) {
|
917
|
+
return this.search_results.html(content);
|
918
|
+
};
|
919
|
+
|
920
|
+
Chosen.prototype.results_hide = function() {
|
921
|
+
if (this.results_showing) {
|
922
|
+
this.result_clear_highlight();
|
923
|
+
this.container.removeClass("chosen-with-drop");
|
924
|
+
this.form_field_jq.trigger("chosen:hiding_dropdown", {
|
925
|
+
chosen: this
|
926
|
+
});
|
927
|
+
}
|
928
|
+
return this.results_showing = false;
|
929
|
+
};
|
930
|
+
|
931
|
+
Chosen.prototype.set_tab_index = function(el) {
|
932
|
+
var ti;
|
933
|
+
if (this.form_field.tabIndex) {
|
934
|
+
ti = this.form_field.tabIndex;
|
935
|
+
this.form_field.tabIndex = -1;
|
936
|
+
return this.search_field[0].tabIndex = ti;
|
937
|
+
}
|
938
|
+
};
|
939
|
+
|
940
|
+
Chosen.prototype.set_label_behavior = function() {
|
941
|
+
var _this = this;
|
942
|
+
this.form_field_label = this.form_field_jq.parents("label");
|
943
|
+
if (!this.form_field_label.length && this.form_field.id.length) {
|
944
|
+
this.form_field_label = $("label[for='" + this.form_field.id + "']");
|
945
|
+
}
|
946
|
+
if (this.form_field_label.length > 0) {
|
947
|
+
return this.form_field_label.bind('click.chosen', function(evt) {
|
948
|
+
if (_this.is_multiple) {
|
949
|
+
return _this.container_mousedown(evt);
|
950
|
+
} else {
|
951
|
+
return _this.activate_field();
|
952
|
+
}
|
953
|
+
});
|
954
|
+
}
|
955
|
+
};
|
956
|
+
|
957
|
+
Chosen.prototype.show_search_field_default = function() {
|
958
|
+
if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
|
959
|
+
this.search_field.val(this.default_text);
|
960
|
+
return this.search_field.addClass("default");
|
961
|
+
} else {
|
962
|
+
this.search_field.val("");
|
963
|
+
return this.search_field.removeClass("default");
|
964
|
+
}
|
965
|
+
};
|
966
|
+
|
967
|
+
Chosen.prototype.search_results_mouseup = function(evt) {
|
968
|
+
var target;
|
969
|
+
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
970
|
+
if (target.length) {
|
971
|
+
this.result_highlight = target;
|
972
|
+
this.result_select(evt);
|
973
|
+
return this.search_field.focus();
|
974
|
+
}
|
975
|
+
};
|
976
|
+
|
977
|
+
Chosen.prototype.search_results_mouseover = function(evt) {
|
978
|
+
var target;
|
979
|
+
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
980
|
+
if (target) {
|
981
|
+
return this.result_do_highlight(target);
|
982
|
+
}
|
983
|
+
};
|
984
|
+
|
985
|
+
Chosen.prototype.search_results_mouseout = function(evt) {
|
986
|
+
if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
|
987
|
+
return this.result_clear_highlight();
|
988
|
+
}
|
989
|
+
};
|
990
|
+
|
991
|
+
Chosen.prototype.choice_build = function(item) {
|
992
|
+
var choice, close_link,
|
993
|
+
_this = this;
|
994
|
+
choice = $('<li />', {
|
995
|
+
"class": "search-choice"
|
996
|
+
}).html("<span>" + (this.choice_label(item)) + "</span>");
|
997
|
+
if (item.disabled) {
|
998
|
+
choice.addClass('search-choice-disabled');
|
999
|
+
} else {
|
1000
|
+
close_link = $('<a />', {
|
1001
|
+
"class": 'search-choice-close',
|
1002
|
+
'data-option-array-index': item.array_index
|
1003
|
+
});
|
1004
|
+
close_link.bind('click.chosen', function(evt) {
|
1005
|
+
return _this.choice_destroy_link_click(evt);
|
1006
|
+
});
|
1007
|
+
choice.append(close_link);
|
1008
|
+
}
|
1009
|
+
return this.search_container.before(choice);
|
1010
|
+
};
|
1011
|
+
|
1012
|
+
Chosen.prototype.choice_destroy_link_click = function(evt) {
|
1013
|
+
evt.preventDefault();
|
1014
|
+
evt.stopPropagation();
|
1015
|
+
if (!this.is_disabled) {
|
1016
|
+
return this.choice_destroy($(evt.target));
|
1017
|
+
}
|
1018
|
+
};
|
1019
|
+
|
1020
|
+
Chosen.prototype.choice_destroy = function(link) {
|
1021
|
+
if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
|
1022
|
+
this.show_search_field_default();
|
1023
|
+
if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) {
|
1024
|
+
this.results_hide();
|
1025
|
+
}
|
1026
|
+
link.parents('li').first().remove();
|
1027
|
+
return this.search_field_scale();
|
1028
|
+
}
|
1029
|
+
};
|
1030
|
+
|
1031
|
+
Chosen.prototype.results_reset = function() {
|
1032
|
+
this.reset_single_select_options();
|
1033
|
+
this.form_field.options[0].selected = true;
|
1034
|
+
this.single_set_selected_text();
|
1035
|
+
this.show_search_field_default();
|
1036
|
+
this.results_reset_cleanup();
|
1037
|
+
this.form_field_jq.trigger("change");
|
1038
|
+
if (this.active_field) {
|
1039
|
+
return this.results_hide();
|
1040
|
+
}
|
1041
|
+
};
|
1042
|
+
|
1043
|
+
Chosen.prototype.results_reset_cleanup = function() {
|
1044
|
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
1045
|
+
return this.selected_item.find("abbr").remove();
|
1046
|
+
};
|
1047
|
+
|
1048
|
+
Chosen.prototype.result_select = function(evt) {
|
1049
|
+
var high, item;
|
1050
|
+
if (this.result_highlight) {
|
1051
|
+
high = this.result_highlight;
|
1052
|
+
this.result_clear_highlight();
|
1053
|
+
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
1054
|
+
this.form_field_jq.trigger("chosen:maxselected", {
|
1055
|
+
chosen: this
|
1056
|
+
});
|
1057
|
+
return false;
|
1058
|
+
}
|
1059
|
+
if (this.is_multiple) {
|
1060
|
+
high.removeClass("active-result");
|
1061
|
+
} else {
|
1062
|
+
this.reset_single_select_options();
|
1063
|
+
}
|
1064
|
+
high.addClass("result-selected");
|
1065
|
+
item = this.results_data[high[0].getAttribute("data-option-array-index")];
|
1066
|
+
item.selected = true;
|
1067
|
+
this.form_field.options[item.options_index].selected = true;
|
1068
|
+
this.selected_option_count = null;
|
1069
|
+
if (this.is_multiple) {
|
1070
|
+
this.choice_build(item);
|
1071
|
+
} else {
|
1072
|
+
this.single_set_selected_text(this.choice_label(item));
|
1073
|
+
}
|
1074
|
+
if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
|
1075
|
+
this.results_hide();
|
1076
|
+
}
|
1077
|
+
this.show_search_field_default();
|
1078
|
+
if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
|
1079
|
+
this.form_field_jq.trigger("change", {
|
1080
|
+
'selected': this.form_field.options[item.options_index].value
|
1081
|
+
});
|
1082
|
+
}
|
1083
|
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
1084
|
+
evt.preventDefault();
|
1085
|
+
return this.search_field_scale();
|
1086
|
+
}
|
1087
|
+
};
|
1088
|
+
|
1089
|
+
Chosen.prototype.single_set_selected_text = function(text) {
|
1090
|
+
if (text == null) {
|
1091
|
+
text = this.default_text;
|
1092
|
+
}
|
1093
|
+
if (text === this.default_text) {
|
1094
|
+
this.selected_item.addClass("chosen-default");
|
1095
|
+
} else {
|
1096
|
+
this.single_deselect_control_build();
|
1097
|
+
this.selected_item.removeClass("chosen-default");
|
1098
|
+
}
|
1099
|
+
return this.selected_item.find("span").html(text);
|
1100
|
+
};
|
1101
|
+
|
1102
|
+
Chosen.prototype.result_deselect = function(pos) {
|
1103
|
+
var result_data;
|
1104
|
+
result_data = this.results_data[pos];
|
1105
|
+
if (!this.form_field.options[result_data.options_index].disabled) {
|
1106
|
+
result_data.selected = false;
|
1107
|
+
this.form_field.options[result_data.options_index].selected = false;
|
1108
|
+
this.selected_option_count = null;
|
1109
|
+
this.result_clear_highlight();
|
1110
|
+
if (this.results_showing) {
|
1111
|
+
this.winnow_results();
|
1112
|
+
}
|
1113
|
+
this.form_field_jq.trigger("change", {
|
1114
|
+
deselected: this.form_field.options[result_data.options_index].value
|
1115
|
+
});
|
1116
|
+
this.search_field_scale();
|
1117
|
+
return true;
|
1118
|
+
} else {
|
1119
|
+
return false;
|
1120
|
+
}
|
1121
|
+
};
|
1122
|
+
|
1123
|
+
Chosen.prototype.single_deselect_control_build = function() {
|
1124
|
+
if (!this.allow_single_deselect) {
|
1125
|
+
return;
|
1126
|
+
}
|
1127
|
+
if (!this.selected_item.find("abbr").length) {
|
1128
|
+
this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
|
1129
|
+
}
|
1130
|
+
return this.selected_item.addClass("chosen-single-with-deselect");
|
1131
|
+
};
|
1132
|
+
|
1133
|
+
Chosen.prototype.get_search_text = function() {
|
1134
|
+
return $('<div/>').text($.trim(this.search_field.val())).html();
|
1135
|
+
};
|
1136
|
+
|
1137
|
+
Chosen.prototype.winnow_results_set_highlight = function() {
|
1138
|
+
var do_high, selected_results;
|
1139
|
+
selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
|
1140
|
+
do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
|
1141
|
+
if (do_high != null) {
|
1142
|
+
return this.result_do_highlight(do_high);
|
1143
|
+
}
|
1144
|
+
};
|
1145
|
+
|
1146
|
+
Chosen.prototype.no_results = function(terms) {
|
1147
|
+
var no_results_html;
|
1148
|
+
no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
|
1149
|
+
no_results_html.find("span").first().html(terms);
|
1150
|
+
this.search_results.append(no_results_html);
|
1151
|
+
return this.form_field_jq.trigger("chosen:no_results", {
|
1152
|
+
chosen: this
|
1153
|
+
});
|
1154
|
+
};
|
1155
|
+
|
1156
|
+
Chosen.prototype.no_results_clear = function() {
|
1157
|
+
return this.search_results.find(".no-results").remove();
|
1158
|
+
};
|
1159
|
+
|
1160
|
+
Chosen.prototype.keydown_arrow = function() {
|
1161
|
+
var next_sib;
|
1162
|
+
if (this.results_showing && this.result_highlight) {
|
1163
|
+
next_sib = this.result_highlight.nextAll("li.active-result").first();
|
1164
|
+
if (next_sib) {
|
1165
|
+
return this.result_do_highlight(next_sib);
|
1166
|
+
}
|
1167
|
+
} else {
|
1168
|
+
return this.results_show();
|
1169
|
+
}
|
1170
|
+
};
|
1171
|
+
|
1172
|
+
Chosen.prototype.keyup_arrow = function() {
|
1173
|
+
var prev_sibs;
|
1174
|
+
if (!this.results_showing && !this.is_multiple) {
|
1175
|
+
return this.results_show();
|
1176
|
+
} else if (this.result_highlight) {
|
1177
|
+
prev_sibs = this.result_highlight.prevAll("li.active-result");
|
1178
|
+
if (prev_sibs.length) {
|
1179
|
+
return this.result_do_highlight(prev_sibs.first());
|
1180
|
+
} else {
|
1181
|
+
if (this.choices_count() > 0) {
|
1182
|
+
this.results_hide();
|
1183
|
+
}
|
1184
|
+
return this.result_clear_highlight();
|
1185
|
+
}
|
1186
|
+
}
|
1187
|
+
};
|
1188
|
+
|
1189
|
+
Chosen.prototype.keydown_backstroke = function() {
|
1190
|
+
var next_available_destroy;
|
1191
|
+
if (this.pending_backstroke) {
|
1192
|
+
this.choice_destroy(this.pending_backstroke.find("a").first());
|
1193
|
+
return this.clear_backstroke();
|
1194
|
+
} else {
|
1195
|
+
next_available_destroy = this.search_container.siblings("li.search-choice").last();
|
1196
|
+
if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
|
1197
|
+
this.pending_backstroke = next_available_destroy;
|
1198
|
+
if (this.single_backstroke_delete) {
|
1199
|
+
return this.keydown_backstroke();
|
1200
|
+
} else {
|
1201
|
+
return this.pending_backstroke.addClass("search-choice-focus");
|
1202
|
+
}
|
1203
|
+
}
|
1204
|
+
}
|
1205
|
+
};
|
1206
|
+
|
1207
|
+
Chosen.prototype.clear_backstroke = function() {
|
1208
|
+
if (this.pending_backstroke) {
|
1209
|
+
this.pending_backstroke.removeClass("search-choice-focus");
|
1210
|
+
}
|
1211
|
+
return this.pending_backstroke = null;
|
1212
|
+
};
|
1213
|
+
|
1214
|
+
Chosen.prototype.keydown_checker = function(evt) {
|
1215
|
+
var stroke, _ref1;
|
1216
|
+
stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
|
1217
|
+
this.search_field_scale();
|
1218
|
+
if (stroke !== 8 && this.pending_backstroke) {
|
1219
|
+
this.clear_backstroke();
|
1220
|
+
}
|
1221
|
+
switch (stroke) {
|
1222
|
+
case 8:
|
1223
|
+
this.backstroke_length = this.search_field.val().length;
|
1224
|
+
break;
|
1225
|
+
case 9:
|
1226
|
+
if (this.results_showing && !this.is_multiple) {
|
1227
|
+
this.result_select(evt);
|
1228
|
+
}
|
1229
|
+
this.mouse_on_container = false;
|
1230
|
+
break;
|
1231
|
+
case 13:
|
1232
|
+
if (this.results_showing) {
|
1233
|
+
evt.preventDefault();
|
1234
|
+
}
|
1235
|
+
break;
|
1236
|
+
case 32:
|
1237
|
+
if (this.disable_search) {
|
1238
|
+
evt.preventDefault();
|
1239
|
+
}
|
1240
|
+
break;
|
1241
|
+
case 38:
|
1242
|
+
evt.preventDefault();
|
1243
|
+
this.keyup_arrow();
|
1244
|
+
break;
|
1245
|
+
case 40:
|
1246
|
+
evt.preventDefault();
|
1247
|
+
this.keydown_arrow();
|
1248
|
+
break;
|
1249
|
+
}
|
1250
|
+
};
|
1251
|
+
|
1252
|
+
Chosen.prototype.search_field_scale = function() {
|
1253
|
+
var div, f_width, h, style, style_block, styles, w, _i, _len;
|
1254
|
+
if (this.is_multiple) {
|
1255
|
+
h = 0;
|
1256
|
+
w = 0;
|
1257
|
+
style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
|
1258
|
+
styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
|
1259
|
+
for (_i = 0, _len = styles.length; _i < _len; _i++) {
|
1260
|
+
style = styles[_i];
|
1261
|
+
style_block += style + ":" + this.search_field.css(style) + ";";
|
1262
|
+
}
|
1263
|
+
div = $('<div />', {
|
1264
|
+
'style': style_block
|
1265
|
+
});
|
1266
|
+
div.text(this.search_field.val());
|
1267
|
+
$('body').append(div);
|
1268
|
+
w = div.width() + 25;
|
1269
|
+
div.remove();
|
1270
|
+
f_width = this.container.outerWidth();
|
1271
|
+
if (w > f_width - 10) {
|
1272
|
+
w = f_width - 10;
|
1273
|
+
}
|
1274
|
+
return this.search_field.css({
|
1275
|
+
'width': w + 'px'
|
1276
|
+
});
|
1277
|
+
}
|
1278
|
+
};
|
1279
|
+
|
1280
|
+
return Chosen;
|
1281
|
+
|
1282
|
+
})(AbstractChosen);
|
1283
|
+
|
1284
|
+
}).call(this);
|