speedo 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. data/app/assets/javascripts/speedo.js +12 -12
  2. data/app/views/layouts/speedo/application.html.haml +2 -2
  3. data/lib/speedo/sass.rb +1 -1
  4. data/lib/speedo/version.rb +1 -1
  5. data/test/dummy/log/development.log +889 -0
  6. data/test/dummy/tmp/cache/assets/BC8/350/sprockets%2F3357f02a74351649de62769431854154 +0 -0
  7. data/test/dummy/tmp/cache/assets/BFD/090/sprockets%2F50267839603d9c7384477250f0169f0e +0 -0
  8. data/test/dummy/tmp/cache/assets/C4F/220/sprockets%2F19a6a3539a4ed0526c356691798032a3 +0 -0
  9. data/test/dummy/tmp/cache/assets/C55/E10/sprockets%2F9da121566709335e3081059e7774a9bb +957 -0
  10. data/test/dummy/tmp/cache/assets/C5F/4E0/sprockets%2F4c17092a9c628e66645a4586e9b50717 +57 -0
  11. data/test/dummy/tmp/cache/assets/C82/BB0/sprockets%2F904cd2f9283528b32d94a1d2a6711489 +41 -0
  12. data/test/dummy/tmp/cache/assets/CDE/600/sprockets%2F205a8cce7806d7c77117f1dc263146a8 +0 -0
  13. data/test/dummy/tmp/cache/assets/CE0/930/sprockets%2Fb6670296cd6b3ce81034c8d5d31e5725 +8 -0
  14. data/test/dummy/tmp/cache/assets/CE1/3B0/sprockets%2Fe8865654d2d075e6bba1074193e443dc +350 -0
  15. data/test/dummy/tmp/cache/assets/CF5/F40/sprockets%2F72637ea0f394f68dcc931527509e79ec +0 -0
  16. data/test/dummy/tmp/cache/assets/CF9/7C0/sprockets%2F488b6dcdeb1301268a65202e7101ed2a +974 -0
  17. data/test/dummy/tmp/cache/assets/D0C/C60/sprockets%2F39d93fba83bb3b50a75826703c5a28c5 +311 -0
  18. data/test/dummy/tmp/cache/assets/D1D/D50/sprockets%2F5b87bedce3ae871f14e41e2479290866 +0 -0
  19. data/test/dummy/tmp/cache/assets/D2A/5C0/sprockets%2Fe12edc211b1935a76d3aab4e8716006d +394 -0
  20. data/test/dummy/tmp/cache/assets/D3A/090/sprockets%2F0d24039ad1b8ef3525e367fe51905fbb +11635 -0
  21. data/test/dummy/tmp/cache/assets/D3B/1E0/sprockets%2Fe5f2362b8b1eb8273f1a7764cbb15e35 +11618 -0
  22. data/test/dummy/tmp/cache/assets/D3D/F80/sprockets%2Fadfc8f7271b3a873f3462e149a6a34e0 +374 -0
  23. data/test/dummy/tmp/cache/assets/D3F/0A0/sprockets%2Fc4574a4ea12e8efe636123e1a17f7d66 +11773 -0
  24. data/test/dummy/tmp/cache/assets/D42/CB0/sprockets%2F6c01eb50fe79d82720a649960dee5dd0 +20 -0
  25. data/test/dummy/tmp/cache/assets/D49/2B0/sprockets%2F34363288c95affbe232a199c6938ceab +391 -0
  26. data/test/dummy/tmp/cache/assets/D5B/120/sprockets%2F525577d56abcec9969e805ddc2997fd0 +332 -0
  27. data/test/dummy/tmp/cache/assets/D65/820/sprockets%2F4e91290eae5edd2f4d287ca2952be000 +327 -0
  28. data/test/dummy/tmp/cache/assets/D6C/3D0/sprockets%2Fa62ebc5f479b52c204f4c71ea65594ca +55 -0
  29. data/test/dummy/tmp/cache/assets/D71/D90/sprockets%2F7bb9508df3d877f853823addd4b0a22b +19 -0
  30. data/test/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +0 -0
  31. data/test/dummy/tmp/cache/assets/D97/830/sprockets%2Fd55ede995a2705ab74db22acf510dd90 +0 -0
  32. data/test/dummy/tmp/cache/assets/D9B/400/sprockets%2Fec83dc0dc78764b460a3ffc063df25e0 +11789 -0
  33. data/test/dummy/tmp/cache/assets/DA1/670/sprockets%2Fb71f32bbfb530e59ad7a177cf54a888b +0 -0
  34. data/test/dummy/tmp/cache/assets/DA8/760/sprockets%2F1359bb83c703a91d57cfebdaf879a4d7 +9288 -0
  35. data/test/dummy/tmp/cache/assets/DB3/C60/sprockets%2F1ff86e3b1c5bf1c179ac719fced99829 +53 -0
  36. data/test/dummy/tmp/cache/assets/DBE/F80/sprockets%2F8647fc3439abdaa0eb161dadf2fc4304 +694 -0
  37. data/test/dummy/tmp/cache/assets/DC3/CC0/sprockets%2Fa04ece65c59a7a325cab61861da2be7e +0 -0
  38. data/test/dummy/tmp/cache/assets/DC5/290/sprockets%2F1c5dee9b02ab66fbf6e62627a13e27ba +37 -0
  39. data/test/dummy/tmp/cache/assets/DE9/520/sprockets%2Fe9f8259c99da2f355198dc4bcdebb69d +0 -0
  40. data/test/dummy/tmp/cache/assets/DEA/500/sprockets%2F485fc5ba3f81b49ccdd788885ea8de5e +0 -0
  41. data/test/dummy/tmp/cache/assets/DF2/CB0/sprockets%2F4500acae993e0fa07bd48dceee07e2b3 +0 -0
  42. data/test/dummy/tmp/cache/assets/DF9/EB0/sprockets%2Ffcaa51a13d86ac9cf245f2a5d70c9d8c +256 -0
  43. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  44. data/test/dummy/tmp/cache/assets/E7F/BB0/sprockets%2Ffdeefdc424a13a04addae542356dffae +678 -0
  45. data/test/dummy/tmp/cache/assets/E82/D20/sprockets%2Fcdce4acb88dcbeaba64a06a254a9e09f +0 -0
  46. metadata +192 -88
  47. /data/vendor/assets/javascripts/{chosen.jquery.js → speedo/chosen.jquery.js} +0 -0
  48. /data/vendor/assets/javascripts/{jquery.autoSuggest.js → speedo/jquery.autoSuggest.js} +0 -0
  49. /data/vendor/assets/javascripts/{jquery.autogrow.js → speedo/jquery.autogrow.js} +0 -0
  50. /data/vendor/assets/javascripts/{jquery.dataTables.js → speedo/jquery.dataTables.js} +0 -0
  51. /data/vendor/assets/javascripts/{jquery.livequery.js → speedo/jquery.livequery.js} +0 -0
  52. /data/vendor/assets/javascripts/{jquery.mousewheel-3.0.4.pack.js → speedo/jquery.mousewheel-3.0.4.pack.js} +0 -0
  53. /data/vendor/assets/javascripts/{jquery.placeholder.min.js → speedo/jquery.placeholder.min.js} +0 -0
  54. /data/vendor/assets/javascripts/{jquery.spin.js → speedo/jquery.spin.js} +0 -0
  55. /data/vendor/assets/javascripts/{jquery.timeago.js → speedo/jquery.timeago.js} +0 -0
  56. /data/vendor/assets/javascripts/{jquery.tools.min.js → speedo/jquery.tools.min.js} +0 -0
  57. /data/vendor/assets/javascripts/{jquery.uniform.js → speedo/jquery.uniform.js} +0 -0
  58. /data/vendor/assets/javascripts/{modernizr.min.js → speedo/modernizr.min.js} +0 -0
  59. /data/vendor/assets/javascripts/{respond.js → speedo/respond.js} +0 -0
  60. /data/vendor/assets/javascripts/{spin.js → speedo/spin.js} +0 -0
  61. /data/vendor/assets/stylesheets/{autoSuggest.css → speedo/autoSuggest.css} +0 -0
  62. /data/vendor/assets/stylesheets/{chosen-sprite.png → speedo/chosen-sprite.png} +0 -0
  63. /data/vendor/assets/stylesheets/{chosen.css → speedo/chosen.css} +0 -0
  64. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/Sorting icons.psd +0 -0
  65. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/back_disabled.png +0 -0
  66. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/back_enabled.png +0 -0
  67. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/back_enabled_hover.png +0 -0
  68. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/favicon.ico +0 -0
  69. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/forward_disabled.png +0 -0
  70. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/forward_enabled.png +0 -0
  71. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/forward_enabled_hover.png +0 -0
  72. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/sort_asc.png +0 -0
  73. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/sort_asc_disabled.png +0 -0
  74. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/sort_both.png +0 -0
  75. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/sort_desc.png +0 -0
  76. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/sort_desc_disabled.png +0 -0
  77. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  78. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  79. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/ui-bg_glass_65_ffffff_1x400.png +0 -0
  80. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/ui-bg_glass_75_dadada_1x400.png +0 -0
  81. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  82. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/ui-bg_glass_75_ffffff_1x400.png +0 -0
  83. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  84. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/ui-bg_inset-soft_95_fef1ec_1x100.png +0 -0
  85. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/ui-icons_222222_256x240.png +0 -0
  86. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/ui-icons_2e83ff_256x240.png +0 -0
  87. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/ui-icons_454545_256x240.png +0 -0
  88. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/ui-icons_888888_256x240.png +0 -0
  89. /data/vendor/assets/stylesheets/{dataTables → speedo/dataTables}/ui-icons_cd0a0a_256x240.png +0 -0
  90. /data/vendor/assets/stylesheets/{formtastic-buttonless.css → speedo/formtastic-buttonless.css} +0 -0
  91. /data/vendor/assets/stylesheets/{gh-buttons.css → speedo/gh-buttons.css} +0 -0
  92. /data/vendor/assets/stylesheets/{gh-icons.png → speedo/gh-icons.png} +0 -0
  93. /data/vendor/assets/stylesheets/{jquery-ui-1.8.18.custom.css → speedo/jquery-ui-1.8.18.custom.css} +0 -0
  94. /data/vendor/assets/stylesheets/{jquery.dataTables.css → speedo/jquery.dataTables.css} +0 -0
  95. /data/vendor/assets/stylesheets/{jqueryui → speedo/jqueryui}/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  96. /data/vendor/assets/stylesheets/{jqueryui → speedo/jqueryui}/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  97. /data/vendor/assets/stylesheets/{jqueryui → speedo/jqueryui}/ui-bg_glass_65_ffffff_1x400.png +0 -0
  98. /data/vendor/assets/stylesheets/{jqueryui → speedo/jqueryui}/ui-bg_glass_75_dadada_1x400.png +0 -0
  99. /data/vendor/assets/stylesheets/{jqueryui → speedo/jqueryui}/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  100. /data/vendor/assets/stylesheets/{jqueryui → speedo/jqueryui}/ui-bg_glass_75_ffffff_1x400.png +0 -0
  101. /data/vendor/assets/stylesheets/{jqueryui → speedo/jqueryui}/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  102. /data/vendor/assets/stylesheets/{jqueryui → speedo/jqueryui}/ui-bg_inset-soft_95_fef1ec_1x100.png +0 -0
  103. /data/vendor/assets/stylesheets/{jqueryui → speedo/jqueryui}/ui-icons_222222_256x240.png +0 -0
  104. /data/vendor/assets/stylesheets/{jqueryui → speedo/jqueryui}/ui-icons_2e83ff_256x240.png +0 -0
  105. /data/vendor/assets/stylesheets/{jqueryui → speedo/jqueryui}/ui-icons_454545_256x240.png +0 -0
  106. /data/vendor/assets/stylesheets/{jqueryui → speedo/jqueryui}/ui-icons_888888_256x240.png +0 -0
  107. /data/vendor/assets/stylesheets/{jqueryui → speedo/jqueryui}/ui-icons_cd0a0a_256x240.png +0 -0
  108. /data/vendor/assets/stylesheets/{normalize.css → speedo/normalize.css} +0 -0
  109. /data/vendor/assets/stylesheets/{uniform → speedo/uniform}/bg-input-focus.png +0 -0
  110. /data/vendor/assets/stylesheets/{uniform → speedo/uniform}/bg-input.png +0 -0
  111. /data/vendor/assets/stylesheets/{uniform → speedo/uniform}/sprite-aristo.png +0 -0
  112. /data/vendor/assets/stylesheets/{uniform → speedo/uniform}/sprite.png +0 -0
  113. /data/vendor/assets/stylesheets/{uniform.default.css → speedo/uniform.default.css} +0 -0
@@ -0,0 +1,957 @@
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1339771359.969455: @value{ I" length:EFi��I" digest;
2
+ F"%6fa4f8bb006212f8b9d0046b6d1470edI" source;
3
+ FI"��// Chosen, a Select Box Enhancer for jQuery and Protoype
4
+ // by Patrick Filler for Harvest, http://getharvest.com
5
+ //
6
+ // Version 0.9.8
7
+ // Full source at https://github.com/harvesthq/chosen
8
+ // Copyright (c) 2011 Harvest http://getharvest.com
9
+
10
+ // MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
11
+ // This file is generated by `cake build`, do not edit it by hand.
12
+ (function() {
13
+ var SelectParser;
14
+
15
+ SelectParser = (function() {
16
+
17
+ function SelectParser() {
18
+ this.options_index = 0;
19
+ this.parsed = [];
20
+ }
21
+
22
+ SelectParser.prototype.add_node = function(child) {
23
+ if (child.nodeName === "OPTGROUP") {
24
+ return this.add_group(child);
25
+ } else {
26
+ return this.add_option(child);
27
+ }
28
+ };
29
+
30
+ SelectParser.prototype.add_group = function(group) {
31
+ var group_position, option, _i, _len, _ref, _results;
32
+ group_position = this.parsed.length;
33
+ this.parsed.push({
34
+ array_index: group_position,
35
+ group: true,
36
+ label: group.label,
37
+ children: 0,
38
+ disabled: group.disabled
39
+ });
40
+ _ref = group.childNodes;
41
+ _results = [];
42
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
43
+ option = _ref[_i];
44
+ _results.push(this.add_option(option, group_position, group.disabled));
45
+ }
46
+ return _results;
47
+ };
48
+
49
+ SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
50
+ if (option.nodeName === "OPTION") {
51
+ if (option.text !== "") {
52
+ if (group_position != null) this.parsed[group_position].children += 1;
53
+ this.parsed.push({
54
+ array_index: this.parsed.length,
55
+ options_index: this.options_index,
56
+ value: option.value,
57
+ text: option.text,
58
+ html: option.innerHTML,
59
+ selected: option.selected,
60
+ disabled: group_disabled === true ? group_disabled : option.disabled,
61
+ group_array_index: group_position,
62
+ classes: option.className,
63
+ style: option.style.cssText
64
+ });
65
+ } else {
66
+ this.parsed.push({
67
+ array_index: this.parsed.length,
68
+ options_index: this.options_index,
69
+ empty: true
70
+ });
71
+ }
72
+ return this.options_index += 1;
73
+ }
74
+ };
75
+
76
+ return SelectParser;
77
+
78
+ })();
79
+
80
+ SelectParser.select_to_array = function(select) {
81
+ var child, parser, _i, _len, _ref;
82
+ parser = new SelectParser();
83
+ _ref = select.childNodes;
84
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
85
+ child = _ref[_i];
86
+ parser.add_node(child);
87
+ }
88
+ return parser.parsed;
89
+ };
90
+
91
+ this.SelectParser = SelectParser;
92
+
93
+ }).call(this);
94
+
95
+ /*
96
+ Chosen source: generate output using 'cake build'
97
+ Copyright (c) 2011 by Harvest
98
+ */
99
+
100
+ (function() {
101
+ var AbstractChosen, root;
102
+
103
+ root = this;
104
+
105
+ AbstractChosen = (function() {
106
+
107
+ function AbstractChosen(form_field, options) {
108
+ this.form_field = form_field;
109
+ this.options = options != null ? options : {};
110
+ this.set_default_values();
111
+ this.is_multiple = this.form_field.multiple;
112
+ this.default_text_default = this.is_multiple ? "Select Some Options" : "Select an Option";
113
+ this.setup();
114
+ this.set_up_html();
115
+ this.register_observers();
116
+ this.finish_setup();
117
+ }
118
+
119
+ AbstractChosen.prototype.set_default_values = function() {
120
+ var _this = this;
121
+ this.click_test_action = function(evt) {
122
+ return _this.test_active_click(evt);
123
+ };
124
+ this.activate_action = function(evt) {
125
+ return _this.activate_field(evt);
126
+ };
127
+ this.active_field = false;
128
+ this.mouse_on_container = false;
129
+ this.results_showing = false;
130
+ this.result_highlighted = null;
131
+ this.result_single_selected = null;
132
+ 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;
133
+ this.disable_search_threshold = this.options.disable_search_threshold || 0;
134
+ this.search_contains = this.options.search_contains || false;
135
+ this.choices = 0;
136
+ return this.results_none_found = this.options.no_results_text || "No results match";
137
+ };
138
+
139
+ AbstractChosen.prototype.mouse_enter = function() {
140
+ return this.mouse_on_container = true;
141
+ };
142
+
143
+ AbstractChosen.prototype.mouse_leave = function() {
144
+ return this.mouse_on_container = false;
145
+ };
146
+
147
+ AbstractChosen.prototype.input_focus = function(evt) {
148
+ var _this = this;
149
+ if (!this.active_field) {
150
+ return setTimeout((function() {
151
+ return _this.container_mousedown();
152
+ }), 50);
153
+ }
154
+ };
155
+
156
+ AbstractChosen.prototype.input_blur = function(evt) {
157
+ var _this = this;
158
+ if (!this.mouse_on_container) {
159
+ this.active_field = false;
160
+ return setTimeout((function() {
161
+ return _this.blur_test();
162
+ }), 100);
163
+ }
164
+ };
165
+
166
+ AbstractChosen.prototype.result_add_option = function(option) {
167
+ var classes, style;
168
+ if (!option.disabled) {
169
+ option.dom_id = this.container_id + "_o_" + option.array_index;
170
+ classes = option.selected && this.is_multiple ? [] : ["active-result"];
171
+ if (option.selected) classes.push("result-selected");
172
+ if (option.group_array_index != null) classes.push("group-option");
173
+ if (option.classes !== "") classes.push(option.classes);
174
+ style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : "";
175
+ return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '"' + style + '>' + option.html + '</li>';
176
+ } else {
177
+ return "";
178
+ }
179
+ };
180
+
181
+ AbstractChosen.prototype.results_update_field = function() {
182
+ this.result_clear_highlight();
183
+ this.result_single_selected = null;
184
+ return this.results_build();
185
+ };
186
+
187
+ AbstractChosen.prototype.results_toggle = function() {
188
+ if (this.results_showing) {
189
+ return this.results_hide();
190
+ } else {
191
+ return this.results_show();
192
+ }
193
+ };
194
+
195
+ AbstractChosen.prototype.results_search = function(evt) {
196
+ if (this.results_showing) {
197
+ return this.winnow_results();
198
+ } else {
199
+ return this.results_show();
200
+ }
201
+ };
202
+
203
+ AbstractChosen.prototype.keyup_checker = function(evt) {
204
+ var stroke, _ref;
205
+ stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
206
+ this.search_field_scale();
207
+ switch (stroke) {
208
+ case 8:
209
+ if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) {
210
+ return this.keydown_backstroke();
211
+ } else if (!this.pending_backstroke) {
212
+ this.result_clear_highlight();
213
+ return this.results_search();
214
+ }
215
+ break;
216
+ case 13:
217
+ evt.preventDefault();
218
+ if (this.results_showing) return this.result_select(evt);
219
+ break;
220
+ case 27:
221
+ if (this.results_showing) this.results_hide();
222
+ return true;
223
+ case 9:
224
+ case 38:
225
+ case 40:
226
+ case 16:
227
+ case 91:
228
+ case 17:
229
+ break;
230
+ default:
231
+ return this.results_search();
232
+ }
233
+ };
234
+
235
+ AbstractChosen.prototype.generate_field_id = function() {
236
+ var new_id;
237
+ new_id = this.generate_random_id();
238
+ this.form_field.id = new_id;
239
+ return new_id;
240
+ };
241
+
242
+ AbstractChosen.prototype.generate_random_char = function() {
243
+ var chars, newchar, rand;
244
+ chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ";
245
+ rand = Math.floor(Math.random() * chars.length);
246
+ return newchar = chars.substring(rand, rand + 1);
247
+ };
248
+
249
+ return AbstractChosen;
250
+
251
+ })();
252
+
253
+ root.AbstractChosen = AbstractChosen;
254
+
255
+ }).call(this);
256
+
257
+ /*
258
+ Chosen source: generate output using 'cake build'
259
+ Copyright (c) 2011 by Harvest
260
+ */
261
+
262
+ (function() {
263
+ var $, Chosen, get_side_border_padding, root,
264
+ __hasProp = Object.prototype.hasOwnProperty,
265
+ __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; };
266
+
267
+ root = this;
268
+
269
+ $ = jQuery;
270
+
271
+ $.fn.extend({
272
+ chosen: function(options) {
273
+ if ($.browser.msie && ($.browser.version === "6.0" || $.browser.version === "7.0")) {
274
+ return this;
275
+ }
276
+ return $(this).each(function(input_field) {
277
+ if (!($(this)).hasClass("chzn-done")) return new Chosen(this, options);
278
+ });
279
+ }
280
+ });
281
+
282
+ Chosen = (function(_super) {
283
+
284
+ __extends(Chosen, _super);
285
+
286
+ function Chosen() {
287
+ Chosen.__super__.constructor.apply(this, arguments);
288
+ }
289
+
290
+ Chosen.prototype.setup = function() {
291
+ this.form_field_jq = $(this.form_field);
292
+ return this.is_rtl = this.form_field_jq.hasClass("chzn-rtl");
293
+ };
294
+
295
+ Chosen.prototype.finish_setup = function() {
296
+ return this.form_field_jq.addClass("chzn-done");
297
+ };
298
+
299
+ Chosen.prototype.set_up_html = function() {
300
+ var container_div, dd_top, dd_width, sf_width;
301
+ this.container_id = this.form_field.id.length ? this.form_field.id.replace(/(:|\.)/g, '_') : this.generate_field_id();
302
+ this.container_id += "_chzn";
303
+ this.f_width = this.form_field_jq.outerWidth();
304
+ this.default_text = this.form_field_jq.data('placeholder') ? this.form_field_jq.data('placeholder') : this.default_text_default;
305
+ container_div = $("<div />", {
306
+ id: this.container_id,
307
+ "class": "chzn-container" + (this.is_rtl ? ' chzn-rtl' : ''),
308
+ style: 'width: ' + this.f_width + 'px;'
309
+ });
310
+ if (this.is_multiple) {
311
+ container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
312
+ } else {
313
+ container_div.html('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
314
+ }
315
+ this.form_field_jq.hide().after(container_div);
316
+ this.container = $('#' + this.container_id);
317
+ this.container.addClass("chzn-container-" + (this.is_multiple ? "multi" : "single"));
318
+ this.dropdown = this.container.find('div.chzn-drop').first();
319
+ dd_top = this.container.height();
320
+ dd_width = this.f_width - get_side_border_padding(this.dropdown);
321
+ this.dropdown.css({
322
+ "width": dd_width + "px",
323
+ "top": dd_top + "px"
324
+ });
325
+ this.search_field = this.container.find('input').first();
326
+ this.search_results = this.container.find('ul.chzn-results').first();
327
+ this.search_field_scale();
328
+ this.search_no_results = this.container.find('li.no-results').first();
329
+ if (this.is_multiple) {
330
+ this.search_choices = this.container.find('ul.chzn-choices').first();
331
+ this.search_container = this.container.find('li.search-field').first();
332
+ } else {
333
+ this.search_container = this.container.find('div.chzn-search').first();
334
+ this.selected_item = this.container.find('.chzn-single').first();
335
+ sf_width = dd_width - get_side_border_padding(this.search_container) - get_side_border_padding(this.search_field);
336
+ this.search_field.css({
337
+ "width": sf_width + "px"
338
+ });
339
+ }
340
+ this.results_build();
341
+ this.set_tab_index();
342
+ return this.form_field_jq.trigger("liszt:ready", {
343
+ chosen: this
344
+ });
345
+ };
346
+
347
+ Chosen.prototype.register_observers = function() {
348
+ var _this = this;
349
+ this.container.mousedown(function(evt) {
350
+ return _this.container_mousedown(evt);
351
+ });
352
+ this.container.mouseup(function(evt) {
353
+ return _this.container_mouseup(evt);
354
+ });
355
+ this.container.mouseenter(function(evt) {
356
+ return _this.mouse_enter(evt);
357
+ });
358
+ this.container.mouseleave(function(evt) {
359
+ return _this.mouse_leave(evt);
360
+ });
361
+ this.search_results.mouseup(function(evt) {
362
+ return _this.search_results_mouseup(evt);
363
+ });
364
+ this.search_results.mouseover(function(evt) {
365
+ return _this.search_results_mouseover(evt);
366
+ });
367
+ this.search_results.mouseout(function(evt) {
368
+ return _this.search_results_mouseout(evt);
369
+ });
370
+ this.form_field_jq.bind("liszt:updated", function(evt) {
371
+ return _this.results_update_field(evt);
372
+ });
373
+ this.search_field.blur(function(evt) {
374
+ return _this.input_blur(evt);
375
+ });
376
+ this.search_field.keyup(function(evt) {
377
+ return _this.keyup_checker(evt);
378
+ });
379
+ this.search_field.keydown(function(evt) {
380
+ return _this.keydown_checker(evt);
381
+ });
382
+ if (this.is_multiple) {
383
+ this.search_choices.click(function(evt) {
384
+ return _this.choices_click(evt);
385
+ });
386
+ return this.search_field.focus(function(evt) {
387
+ return _this.input_focus(evt);
388
+ });
389
+ } else {
390
+ return this.container.click(function(evt) {
391
+ return evt.preventDefault();
392
+ });
393
+ }
394
+ };
395
+
396
+ Chosen.prototype.search_field_disabled = function() {
397
+ this.is_disabled = this.form_field_jq[0].disabled;
398
+ if (this.is_disabled) {
399
+ this.container.addClass('chzn-disabled');
400
+ this.search_field[0].disabled = true;
401
+ if (!this.is_multiple) {
402
+ this.selected_item.unbind("focus", this.activate_action);
403
+ }
404
+ return this.close_field();
405
+ } else {
406
+ this.container.removeClass('chzn-disabled');
407
+ this.search_field[0].disabled = false;
408
+ if (!this.is_multiple) {
409
+ return this.selected_item.bind("focus", this.activate_action);
410
+ }
411
+ }
412
+ };
413
+
414
+ Chosen.prototype.container_mousedown = function(evt) {
415
+ var target_closelink;
416
+ if (!this.is_disabled) {
417
+ target_closelink = evt != null ? ($(evt.target)).hasClass("search-choice-close") : false;
418
+ if (evt && evt.type === "mousedown" && !this.results_showing) {
419
+ evt.stopPropagation();
420
+ }
421
+ if (!this.pending_destroy_click && !target_closelink) {
422
+ if (!this.active_field) {
423
+ if (this.is_multiple) this.search_field.val("");
424
+ $(document).click(this.click_test_action);
425
+ this.results_show();
426
+ } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chzn-single").length)) {
427
+ evt.preventDefault();
428
+ this.results_toggle();
429
+ }
430
+ return this.activate_field();
431
+ } else {
432
+ return this.pending_destroy_click = false;
433
+ }
434
+ }
435
+ };
436
+
437
+ Chosen.prototype.container_mouseup = function(evt) {
438
+ if (evt.target.nodeName === "ABBR") return this.results_reset(evt);
439
+ };
440
+
441
+ Chosen.prototype.blur_test = function(evt) {
442
+ if (!this.active_field && this.container.hasClass("chzn-container-active")) {
443
+ return this.close_field();
444
+ }
445
+ };
446
+
447
+ Chosen.prototype.close_field = function() {
448
+ $(document).unbind("click", this.click_test_action);
449
+ if (!this.is_multiple) {
450
+ this.selected_item.attr("tabindex", this.search_field.attr("tabindex"));
451
+ this.search_field.attr("tabindex", -1);
452
+ }
453
+ this.active_field = false;
454
+ this.results_hide();
455
+ this.container.removeClass("chzn-container-active");
456
+ this.winnow_results_clear();
457
+ this.clear_backstroke();
458
+ this.show_search_field_default();
459
+ return this.search_field_scale();
460
+ };
461
+
462
+ Chosen.prototype.activate_field = function() {
463
+ if (!this.is_multiple && !this.active_field) {
464
+ this.search_field.attr("tabindex", this.selected_item.attr("tabindex"));
465
+ this.selected_item.attr("tabindex", -1);
466
+ }
467
+ this.container.addClass("chzn-container-active");
468
+ this.active_field = true;
469
+ this.search_field.val(this.search_field.val());
470
+ return this.search_field.focus();
471
+ };
472
+
473
+ Chosen.prototype.test_active_click = function(evt) {
474
+ if ($(evt.target).parents('#' + this.container_id).length) {
475
+ return this.active_field = true;
476
+ } else {
477
+ return this.close_field();
478
+ }
479
+ };
480
+
481
+ Chosen.prototype.results_build = function() {
482
+ var content, data, _i, _len, _ref;
483
+ this.parsing = true;
484
+ this.results_data = root.SelectParser.select_to_array(this.form_field);
485
+ if (this.is_multiple && this.choices > 0) {
486
+ this.search_choices.find("li.search-choice").remove();
487
+ this.choices = 0;
488
+ } else if (!this.is_multiple) {
489
+ this.selected_item.find("span").text(this.default_text);
490
+ if (this.form_field.options.length <= this.disable_search_threshold) {
491
+ this.container.addClass("chzn-container-single-nosearch");
492
+ } else {
493
+ this.container.removeClass("chzn-container-single-nosearch");
494
+ }
495
+ }
496
+ content = '';
497
+ _ref = this.results_data;
498
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
499
+ data = _ref[_i];
500
+ if (data.group) {
501
+ content += this.result_add_group(data);
502
+ } else if (!data.empty) {
503
+ content += this.result_add_option(data);
504
+ if (data.selected && this.is_multiple) {
505
+ this.choice_build(data);
506
+ } else if (data.selected && !this.is_multiple) {
507
+ this.selected_item.removeClass("chzn-default").find("span").text(data.text);
508
+ if (this.allow_single_deselect) this.single_deselect_control_build();
509
+ }
510
+ }
511
+ }
512
+ this.search_field_disabled();
513
+ this.show_search_field_default();
514
+ this.search_field_scale();
515
+ this.search_results.html(content);
516
+ return this.parsing = false;
517
+ };
518
+
519
+ Chosen.prototype.result_add_group = function(group) {
520
+ if (!group.disabled) {
521
+ group.dom_id = this.container_id + "_g_" + group.array_index;
522
+ return '<li id="' + group.dom_id + '" class="group-result">' + $("<div />").text(group.label).html() + '</li>';
523
+ } else {
524
+ return "";
525
+ }
526
+ };
527
+
528
+ Chosen.prototype.result_do_highlight = function(el) {
529
+ var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
530
+ if (el.length) {
531
+ this.result_clear_highlight();
532
+ this.result_highlight = el;
533
+ this.result_highlight.addClass("highlighted");
534
+ maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
535
+ visible_top = this.search_results.scrollTop();
536
+ visible_bottom = maxHeight + visible_top;
537
+ high_top = this.result_highlight.position().top + this.search_results.scrollTop();
538
+ high_bottom = high_top + this.result_highlight.outerHeight();
539
+ if (high_bottom >= visible_bottom) {
540
+ return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
541
+ } else if (high_top < visible_top) {
542
+ return this.search_results.scrollTop(high_top);
543
+ }
544
+ }
545
+ };
546
+
547
+ Chosen.prototype.result_clear_highlight = function() {
548
+ if (this.result_highlight) this.result_highlight.removeClass("highlighted");
549
+ return this.result_highlight = null;
550
+ };
551
+
552
+ Chosen.prototype.results_show = function() {
553
+ var dd_top;
554
+ if (!this.is_multiple) {
555
+ this.selected_item.addClass("chzn-single-with-drop");
556
+ if (this.result_single_selected) {
557
+ this.result_do_highlight(this.result_single_selected);
558
+ }
559
+ }
560
+ dd_top = this.is_multiple ? this.container.height() : this.container.height() - 1;
561
+ this.dropdown.css({
562
+ "top": dd_top + "px",
563
+ "left": 0
564
+ });
565
+ this.results_showing = true;
566
+ this.search_field.focus();
567
+ this.search_field.val(this.search_field.val());
568
+ return this.winnow_results();
569
+ };
570
+
571
+ Chosen.prototype.results_hide = function() {
572
+ if (!this.is_multiple) {
573
+ this.selected_item.removeClass("chzn-single-with-drop");
574
+ }
575
+ this.result_clear_highlight();
576
+ this.dropdown.css({
577
+ "left": "-9000px"
578
+ });
579
+ return this.results_showing = false;
580
+ };
581
+
582
+ Chosen.prototype.set_tab_index = function(el) {
583
+ var ti;
584
+ if (this.form_field_jq.attr("tabindex")) {
585
+ ti = this.form_field_jq.attr("tabindex");
586
+ this.form_field_jq.attr("tabindex", -1);
587
+ if (this.is_multiple) {
588
+ return this.search_field.attr("tabindex", ti);
589
+ } else {
590
+ this.selected_item.attr("tabindex", ti);
591
+ return this.search_field.attr("tabindex", -1);
592
+ }
593
+ }
594
+ };
595
+
596
+ Chosen.prototype.show_search_field_default = function() {
597
+ if (this.is_multiple && this.choices < 1 && !this.active_field) {
598
+ this.search_field.val(this.default_text);
599
+ return this.search_field.addClass("default");
600
+ } else {
601
+ this.search_field.val("");
602
+ return this.search_field.removeClass("default");
603
+ }
604
+ };
605
+
606
+ Chosen.prototype.search_results_mouseup = function(evt) {
607
+ var target;
608
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
609
+ if (target.length) {
610
+ this.result_highlight = target;
611
+ return this.result_select(evt);
612
+ }
613
+ };
614
+
615
+ Chosen.prototype.search_results_mouseover = function(evt) {
616
+ var target;
617
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
618
+ if (target) return this.result_do_highlight(target);
619
+ };
620
+
621
+ Chosen.prototype.search_results_mouseout = function(evt) {
622
+ if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
623
+ return this.result_clear_highlight();
624
+ }
625
+ };
626
+
627
+ Chosen.prototype.choices_click = function(evt) {
628
+ evt.preventDefault();
629
+ if (this.active_field && !($(evt.target).hasClass("search-choice" || $(evt.target).parents('.search-choice').first)) && !this.results_showing) {
630
+ return this.results_show();
631
+ }
632
+ };
633
+
634
+ Chosen.prototype.choice_build = function(item) {
635
+ var choice_id, link,
636
+ _this = this;
637
+ choice_id = this.container_id + "_c_" + item.array_index;
638
+ this.choices += 1;
639
+ this.search_container.before('<li class="search-choice" id="' + choice_id + '"><span>' + item.html + '</span><a href="javascript:void(0)" class="search-choice-close" rel="' + item.array_index + '"></a></li>');
640
+ link = $('#' + choice_id).find("a").first();
641
+ return link.click(function(evt) {
642
+ return _this.choice_destroy_link_click(evt);
643
+ });
644
+ };
645
+
646
+ Chosen.prototype.choice_destroy_link_click = function(evt) {
647
+ evt.preventDefault();
648
+ if (!this.is_disabled) {
649
+ this.pending_destroy_click = true;
650
+ return this.choice_destroy($(evt.target));
651
+ } else {
652
+ return evt.stopPropagation;
653
+ }
654
+ };
655
+
656
+ Chosen.prototype.choice_destroy = function(link) {
657
+ this.choices -= 1;
658
+ this.show_search_field_default();
659
+ if (this.is_multiple && this.choices > 0 && this.search_field.val().length < 1) {
660
+ this.results_hide();
661
+ }
662
+ this.result_deselect(link.attr("rel"));
663
+ return link.parents('li').first().remove();
664
+ };
665
+
666
+ Chosen.prototype.results_reset = function(evt) {
667
+ this.form_field.options[0].selected = true;
668
+ this.selected_item.find("span").text(this.default_text);
669
+ if (!this.is_multiple) this.selected_item.addClass("chzn-default");
670
+ this.show_search_field_default();
671
+ $(evt.target).remove();
672
+ this.form_field_jq.trigger("change");
673
+ if (this.active_field) return this.results_hide();
674
+ };
675
+
676
+ Chosen.prototype.result_select = function(evt) {
677
+ var high, high_id, item, position;
678
+ if (this.result_highlight) {
679
+ high = this.result_highlight;
680
+ high_id = high.attr("id");
681
+ this.result_clear_highlight();
682
+ if (this.is_multiple) {
683
+ this.result_deactivate(high);
684
+ } else {
685
+ this.search_results.find(".result-selected").removeClass("result-selected");
686
+ this.result_single_selected = high;
687
+ this.selected_item.removeClass("chzn-default");
688
+ }
689
+ high.addClass("result-selected");
690
+ position = high_id.substr(high_id.lastIndexOf("_") + 1);
691
+ item = this.results_data[position];
692
+ item.selected = true;
693
+ this.form_field.options[item.options_index].selected = true;
694
+ if (this.is_multiple) {
695
+ this.choice_build(item);
696
+ } else {
697
+ this.selected_item.find("span").first().text(item.text);
698
+ if (this.allow_single_deselect) this.single_deselect_control_build();
699
+ }
700
+ if (!(evt.metaKey && this.is_multiple)) this.results_hide();
701
+ this.search_field.val("");
702
+ this.form_field_jq.trigger("change");
703
+ return this.search_field_scale();
704
+ }
705
+ };
706
+
707
+ Chosen.prototype.result_activate = function(el) {
708
+ return el.addClass("active-result");
709
+ };
710
+
711
+ Chosen.prototype.result_deactivate = function(el) {
712
+ return el.removeClass("active-result");
713
+ };
714
+
715
+ Chosen.prototype.result_deselect = function(pos) {
716
+ var result, result_data;
717
+ result_data = this.results_data[pos];
718
+ result_data.selected = false;
719
+ this.form_field.options[result_data.options_index].selected = false;
720
+ result = $("#" + this.container_id + "_o_" + pos);
721
+ result.removeClass("result-selected").addClass("active-result").show();
722
+ this.result_clear_highlight();
723
+ this.winnow_results();
724
+ this.form_field_jq.trigger("change");
725
+ return this.search_field_scale();
726
+ };
727
+
728
+ Chosen.prototype.single_deselect_control_build = function() {
729
+ if (this.allow_single_deselect && this.selected_item.find("abbr").length < 1) {
730
+ return this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
731
+ }
732
+ };
733
+
734
+ Chosen.prototype.winnow_results = function() {
735
+ var found, option, part, parts, regex, regexAnchor, result, result_id, results, searchText, startpos, text, zregex, _i, _j, _len, _len2, _ref;
736
+ this.no_results_clear();
737
+ results = 0;
738
+ searchText = this.search_field.val() === this.default_text ? "" : $('<div/>').text($.trim(this.search_field.val())).html();
739
+ regexAnchor = this.search_contains ? "" : "^";
740
+ regex = new RegExp(regexAnchor + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
741
+ zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
742
+ _ref = this.results_data;
743
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
744
+ option = _ref[_i];
745
+ if (!option.disabled && !option.empty) {
746
+ if (option.group) {
747
+ $('#' + option.dom_id).css('display', 'none');
748
+ } else if (!(this.is_multiple && option.selected)) {
749
+ found = false;
750
+ result_id = option.dom_id;
751
+ result = $("#" + result_id);
752
+ if (regex.test(option.html)) {
753
+ found = true;
754
+ results += 1;
755
+ } else if (option.html.indexOf(" ") >= 0 || option.html.indexOf("[") === 0) {
756
+ parts = option.html.replace(/\[|\]/g, "").split(" ");
757
+ if (parts.length) {
758
+ for (_j = 0, _len2 = parts.length; _j < _len2; _j++) {
759
+ part = parts[_j];
760
+ if (regex.test(part)) {
761
+ found = true;
762
+ results += 1;
763
+ }
764
+ }
765
+ }
766
+ }
767
+ if (found) {
768
+ if (searchText.length) {
769
+ startpos = option.html.search(zregex);
770
+ text = option.html.substr(0, startpos + searchText.length) + '</em>' + option.html.substr(startpos + searchText.length);
771
+ text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
772
+ } else {
773
+ text = option.html;
774
+ }
775
+ result.html(text);
776
+ this.result_activate(result);
777
+ if (option.group_array_index != null) {
778
+ $("#" + this.results_data[option.group_array_index].dom_id).css('display', 'list-item');
779
+ }
780
+ } else {
781
+ if (this.result_highlight && result_id === this.result_highlight.attr('id')) {
782
+ this.result_clear_highlight();
783
+ }
784
+ this.result_deactivate(result);
785
+ }
786
+ }
787
+ }
788
+ }
789
+ if (results < 1 && searchText.length) {
790
+ return this.no_results(searchText);
791
+ } else {
792
+ return this.winnow_results_set_highlight();
793
+ }
794
+ };
795
+
796
+ Chosen.prototype.winnow_results_clear = function() {
797
+ var li, lis, _i, _len, _results;
798
+ this.search_field.val("");
799
+ lis = this.search_results.find("li");
800
+ _results = [];
801
+ for (_i = 0, _len = lis.length; _i < _len; _i++) {
802
+ li = lis[_i];
803
+ li = $(li);
804
+ if (li.hasClass("group-result")) {
805
+ _results.push(li.css('display', 'auto'));
806
+ } else if (!this.is_multiple || !li.hasClass("result-selected")) {
807
+ _results.push(this.result_activate(li));
808
+ } else {
809
+ _results.push(void 0);
810
+ }
811
+ }
812
+ return _results;
813
+ };
814
+
815
+ Chosen.prototype.winnow_results_set_highlight = function() {
816
+ var do_high, selected_results;
817
+ if (!this.result_highlight) {
818
+ selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
819
+ do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
820
+ if (do_high != null) return this.result_do_highlight(do_high);
821
+ }
822
+ };
823
+
824
+ Chosen.prototype.no_results = function(terms) {
825
+ var no_results_html;
826
+ no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
827
+ no_results_html.find("span").first().html(terms);
828
+ return this.search_results.append(no_results_html);
829
+ };
830
+
831
+ Chosen.prototype.no_results_clear = function() {
832
+ return this.search_results.find(".no-results").remove();
833
+ };
834
+
835
+ Chosen.prototype.keydown_arrow = function() {
836
+ var first_active, next_sib;
837
+ if (!this.result_highlight) {
838
+ first_active = this.search_results.find("li.active-result").first();
839
+ if (first_active) this.result_do_highlight($(first_active));
840
+ } else if (this.results_showing) {
841
+ next_sib = this.result_highlight.nextAll("li.active-result").first();
842
+ if (next_sib) this.result_do_highlight(next_sib);
843
+ }
844
+ if (!this.results_showing) return this.results_show();
845
+ };
846
+
847
+ Chosen.prototype.keyup_arrow = function() {
848
+ var prev_sibs;
849
+ if (!this.results_showing && !this.is_multiple) {
850
+ return this.results_show();
851
+ } else if (this.result_highlight) {
852
+ prev_sibs = this.result_highlight.prevAll("li.active-result");
853
+ if (prev_sibs.length) {
854
+ return this.result_do_highlight(prev_sibs.first());
855
+ } else {
856
+ if (this.choices > 0) this.results_hide();
857
+ return this.result_clear_highlight();
858
+ }
859
+ }
860
+ };
861
+
862
+ Chosen.prototype.keydown_backstroke = function() {
863
+ if (this.pending_backstroke) {
864
+ this.choice_destroy(this.pending_backstroke.find("a").first());
865
+ return this.clear_backstroke();
866
+ } else {
867
+ this.pending_backstroke = this.search_container.siblings("li.search-choice").last();
868
+ return this.pending_backstroke.addClass("search-choice-focus");
869
+ }
870
+ };
871
+
872
+ Chosen.prototype.clear_backstroke = function() {
873
+ if (this.pending_backstroke) {
874
+ this.pending_backstroke.removeClass("search-choice-focus");
875
+ }
876
+ return this.pending_backstroke = null;
877
+ };
878
+
879
+ Chosen.prototype.keydown_checker = function(evt) {
880
+ var stroke, _ref;
881
+ stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
882
+ this.search_field_scale();
883
+ if (stroke !== 8 && this.pending_backstroke) this.clear_backstroke();
884
+ switch (stroke) {
885
+ case 8:
886
+ this.backstroke_length = this.search_field.val().length;
887
+ break;
888
+ case 9:
889
+ if (this.results_showing && !this.is_multiple) this.result_select(evt);
890
+ this.mouse_on_container = false;
891
+ break;
892
+ case 13:
893
+ evt.preventDefault();
894
+ break;
895
+ case 38:
896
+ evt.preventDefault();
897
+ this.keyup_arrow();
898
+ break;
899
+ case 40:
900
+ this.keydown_arrow();
901
+ break;
902
+ }
903
+ };
904
+
905
+ Chosen.prototype.search_field_scale = function() {
906
+ var dd_top, div, h, style, style_block, styles, w, _i, _len;
907
+ if (this.is_multiple) {
908
+ h = 0;
909
+ w = 0;
910
+ style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
911
+ styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
912
+ for (_i = 0, _len = styles.length; _i < _len; _i++) {
913
+ style = styles[_i];
914
+ style_block += style + ":" + this.search_field.css(style) + ";";
915
+ }
916
+ div = $('<div />', {
917
+ 'style': style_block
918
+ });
919
+ div.text(this.search_field.val());
920
+ $('body').append(div);
921
+ w = div.width() + 25;
922
+ div.remove();
923
+ if (w > this.f_width - 10) w = this.f_width - 10;
924
+ this.search_field.css({
925
+ 'width': w + 'px'
926
+ });
927
+ dd_top = this.container.height();
928
+ return this.dropdown.css({
929
+ "top": dd_top + "px"
930
+ });
931
+ }
932
+ };
933
+
934
+ Chosen.prototype.generate_random_id = function() {
935
+ var string;
936
+ string = "sel" + this.generate_random_char() + this.generate_random_char() + this.generate_random_char();
937
+ while ($("#" + string).length > 0) {
938
+ string += this.generate_random_char();
939
+ }
940
+ return string;
941
+ };
942
+
943
+ return Chosen;
944
+
945
+ })(AbstractChosen);
946
+
947
+ get_side_border_padding = function(elmt) {
948
+ var side_border_padding;
949
+ return side_border_padding = elmt.outerWidth() - elmt.width();
950
+ };
951
+
952
+ root.get_side_border_padding = get_side_border_padding;
953
+
954
+ }).call(this);
955
+ ;
956
+ FI"
957
+ F"%d7310c3285d5dca5ccb06ec2ffd3036a