update to latest version of chosen

This commit is contained in:
Patrick Filler 2011-08-16 15:26:37 -04:00
parent ead88bcb00
commit 8ede1f6486

View file

@ -86,8 +86,8 @@
return this.set_tab_index(); return this.set_tab_index();
}; };
Chosen.prototype.register_observers = function() { Chosen.prototype.register_observers = function() {
this.container.observe("click", __bind(function(evt) { this.container.observe("mousedown", __bind(function(evt) {
return this.container_click(evt); return this.container_mousedown(evt);
}, this)); }, this));
this.container.observe("mouseenter", __bind(function(evt) { this.container.observe("mouseenter", __bind(function(evt) {
return this.mouse_enter(evt); return this.mouse_enter(evt);
@ -95,8 +95,8 @@
this.container.observe("mouseleave", __bind(function(evt) { this.container.observe("mouseleave", __bind(function(evt) {
return this.mouse_leave(evt); return this.mouse_leave(evt);
}, this)); }, this));
this.search_results.observe("click", __bind(function(evt) { this.search_results.observe("mouseup", __bind(function(evt) {
return this.search_results_click(evt); return this.search_results_mouseup(evt);
}, this)); }, this));
this.search_results.observe("mouseover", __bind(function(evt) { this.search_results.observe("mouseover", __bind(function(evt) {
return this.search_results_mouseover(evt); return this.search_results_mouseover(evt);
@ -129,8 +129,8 @@
}, this)); }, this));
} }
}; };
Chosen.prototype.container_click = function(evt) { Chosen.prototype.container_mousedown = function(evt) {
if (evt && evt.type === "click") { if (evt && evt.type === "mousedown") {
evt.stop(); evt.stop();
} }
if (!this.pending_destroy_click) { if (!this.pending_destroy_click) {
@ -156,7 +156,7 @@
}; };
Chosen.prototype.input_focus = function(evt) { Chosen.prototype.input_focus = function(evt) {
if (!this.active_field) { if (!this.active_field) {
return setTimeout(this.container_click.bind(this), 50); return setTimeout(this.container_mousedown.bind(this), 50);
} }
}; };
Chosen.prototype.input_blur = function(evt) { Chosen.prototype.input_blur = function(evt) {
@ -340,7 +340,7 @@
return this.search_field.removeClassName("default"); return this.search_field.removeClassName("default");
} }
}; };
Chosen.prototype.search_results_click = function(evt) { Chosen.prototype.search_results_mouseup = function(evt) {
var target; var target;
target = evt.target.hasClassName("active-result") ? evt.target : evt.target.up(".active-result"); target = evt.target.hasClassName("active-result") ? evt.target : evt.target.up(".active-result");
if (target) { if (target) {
@ -693,8 +693,16 @@
return Chosen; return Chosen;
})(); })();
root.Chosen = Chosen; root.Chosen = Chosen;
if (Prototype.Browser.IE) {
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
Prototype.BrowserFeatures['Version'] = new Number(RegExp.$1);
}
}
document.observe('dom:loaded', function(evt) { document.observe('dom:loaded', function(evt) {
var select, selects, _i, _len, _results; var select, selects, _i, _len, _results;
if (Prototype.Browser.IE && (Prototype.BrowserFeatures['Version'] === 6 || Prototype.BrowserFeatures['Version'] === 7)) {
return;
}
selects = $$(".chzn-select"); selects = $$(".chzn-select");
_results = []; _results = [];
for (_i = 0, _len = selects.length; _i < _len; _i++) { for (_i = 0, _len = selects.length; _i < _len; _i++) {