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