From ead88bcb009649c2665300c1cea7ee0787b30482 Mon Sep 17 00:00:00 2001 From: Patrick Filler Date: Mon, 8 Aug 2011 14:59:47 -0400 Subject: [PATCH] Update docs to latest css, sprite and js --- chosen/chosen-sprite.png | Bin 1866 -> 742 bytes chosen/chosen.css | 367 ++++++++++++++++++++------------------- chosen/chosen.proto.js | 60 ++++--- 3 files changed, 225 insertions(+), 202 deletions(-) diff --git a/chosen/chosen-sprite.png b/chosen/chosen-sprite.png index 6ec9bbf1e6d77cd0e5f3d5ab2ae690b59cda01ea..f20db4439ea5c1038126bf326c8fd048b03a8226 100644 GIT binary patch literal 742 zcmeAS@N?(olHy`uVBq!ia0vp^HbAV#!3-qV=X2}@QlA5SLR>pKI{yFvKXc~Hw6wJT z{{AOVo_zoQeZqtZ&!0cvw{PF?-@ki%d;k6WS6EoMdiClhOP1WeeS7cTz4PYH`}FD4 zt5>h?-n~0()~rX59=&++V%xTD`T6-@zI<7}eEIzO^LOst`S@T)vFse zZ0PFhnmc#y*RNl9?AVc)msea|{PX9}Ns}gR+O%o+?%jtD9eVii;l+y=r%jvo;K760 zvu76+6kNZ4ed^SyPoF-WIC0|Z*ROy4_>r5N`~Lm=&!0c{_4O@WxbWAnUpYBBmoHy_ z_Uzfgg9n!`T{?O4j}$9Asc%4D@ty45_&F_R{g9Lk0qD52mW_e8hCD#Hn3?L-tbj`>OxT zJ7v;md~}?7W?s>W`VVqX@=db;D+pYCKd;4N)z`osoP6iyoB9teW8`B#?2;Ii#BfGM zL+6u_bqvF)z6Qwy7F^e#>{}{m61e02bdHnN$L$~3eq~pF@_OO1hcV%@q4${;^UfV+ znXY)w;%ghbu4vj9l}FCEd^hZyc+KPP6}AS4MsdBpQGw+X69gF?tV83O8O(MiJx^-A zboXW1bFqq*pAC;_YOi~??#RV$D!*(*_VfK;FjaJ|%YuJ~uPm<26>Fce&`YSSyXC`g zaTdR+Ec5IClowvmjG1!3;Krqz>yXh1n|0L9Grd3bca?9u*WsE@c9af{GO=gU6u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multi_temp = new Template('
      '); + this.single_temp = new Template('#{default}
        '); + this.multi_temp = new Template('
          '); this.choice_temp = new Template('
        • #{choice}
        • '); return this.no_results_temp = new Template('
        • No results match "#{terms}"
        • '); }; Chosen.prototype.set_up_html = function() { var base_template, container_props, dd_top, dd_width, sf_width; - this.container_id = this.form_field.identify().replace('.', '_') + "_chzn"; + this.container_id = this.form_field.identify().replace(/(:|\.)/g, '_') + "_chzn"; this.f_width = this.form_field.getStyle("width") ? parseInt(this.form_field.getStyle("width"), 10) : this.form_field.getWidth(); container_props = { 'id': this.container_id, - 'class': 'chzn-container', + 'class': "chzn-container " + (this.is_rtl ? 'chzn-rtl' : ''), 'style': 'width: ' + this.f_width + 'px' }; - this.default_text = this.form_field.readAttribute('title') ? this.form_field.readAttribute('title') : this.default_text_default; + this.default_text = this.form_field.readAttribute('data-placeholder') ? this.form_field.readAttribute('data-placeholder') : this.default_text_default; base_template = this.is_multiple ? new Element('div', container_props).update(this.multi_temp.evaluate({ "default": this.default_text })) : new Element('div', container_props).update(this.single_temp.evaluate({ @@ -198,7 +205,7 @@ var content, data, startTime, _i, _len, _ref; startTime = new Date(); this.parsing = true; - this.results_data = SelectParser.select_to_array(this.form_field); + this.results_data = root.SelectParser.select_to_array(this.form_field); if (this.is_multiple && this.choices > 0) { this.search_choices.select("li.search-choice").invoke("remove"); this.choices = 0; @@ -338,7 +345,7 @@ target = evt.target.hasClassName("active-result") ? evt.target : evt.target.up(".active-result"); if (target) { this.result_highlight = target; - return this.result_select(); + return this.result_select(evt); } }; Chosen.prototype.search_results_mouseover = function(evt) { @@ -389,7 +396,7 @@ this.result_deselect(link.readAttribute("rel")); return link.up('li').remove(); }; - Chosen.prototype.result_select = function() { + Chosen.prototype.result_select = function(evt) { var high, item, position; if (this.result_highlight) { high = this.result_highlight; @@ -409,7 +416,9 @@ } else { this.selected_item.down("span").update(item.html); } - this.results_hide(); + if (!(evt.metaKey && this.is_multiple)) { + this.results_hide(); + } this.search_field.value = ""; if (typeof Event.simulate === 'function') { this.form_field.simulate("change"); @@ -520,8 +529,13 @@ Chosen.prototype.winnow_results_set_highlight = function() { var do_high; if (!this.result_highlight) { - do_high = this.search_results.down(".active-result"); - if (do_high) { + if (!this.is_multiple) { + do_high = this.search_results.down(".result-selected"); + } + if (!(do_high != null)) { + do_high = this.search_results.down(".active-result"); + } + if (do_high != null) { return this.result_do_highlight(do_high); } } @@ -607,7 +621,7 @@ case 13: evt.preventDefault(); if (this.results_showing) { - return this.result_select(); + return this.result_select(evt); } break; case 27: @@ -619,6 +633,8 @@ case 38: case 40: case 16: + case 91: + case 17: break; default: return this.results_search(); @@ -693,7 +709,9 @@ return side_border_padding = layout.get("border-left") + layout.get("border-right") + layout.get("padding-left") + layout.get("padding-right"); }; root.get_side_border_padding = get_side_border_padding; - root = typeof exports !== "undefined" && exports !== null ? exports : this; +}).call(this); +(function() { + var SelectParser; SelectParser = (function() { function SelectParser() { this.options_index = 0; @@ -762,5 +780,5 @@ } return parser.parsed; }; - root.SelectParser = SelectParser; + this.SelectParser = SelectParser; }).call(this);