Skip to content

Commit

Permalink
chosen v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mrohnstock committed Oct 6, 2014
1 parent f4bcec1 commit 919d4fc
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 49 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "drmonty-chosen",
"description": "Chosen is a library for making long, unwieldy select boxes more friendly.",
"homepage": "http://harvesthq.github.io/chosen/",
"version": "1.1.0",
"version": "1.2.0",
"keywords": [
"select",
"multiselect",
Expand Down
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "drmonty-chosen",
"repo": "drmonty/chosen",
"description": "Chosen is a library for making long, unwieldy select boxes more friendly.",
"version": "1.1.0",
"version": "1.2.0",
"homepage": "http://harvesthq.github.io/chosen/",
"license": "MIT",
"keywords": [
Expand Down
Binary file modified css/chosen-sprite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified css/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 24 additions & 22 deletions css/chosen.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Chosen, a Select Box Enhancer for jQuery and Prototype
by Patrick Filler for Harvest, http://getharvest.com
Version 1.1.0
Version 1.2.0
Full source at https://github.com/harvesthq/chosen
Copyright (c) 2011 Harvest http://getharvest.com
Copyright (c) 2011-2014 Harvest http://getharvest.com
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
This file is generated by `grunt build`, do not edit it by hand.
Expand All @@ -22,14 +22,16 @@ This file is generated by `grunt build`, do not edit it by hand.
-moz-user-select: none;
user-select: none;
}
.chosen-container * {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.chosen-container .chosen-drop {
position: absolute;
top: 100%;
left: -9999px;
z-index: 1010;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
width: 100%;
border: 1px solid #aaa;
border-top: 0;
Expand All @@ -50,7 +52,7 @@ This file is generated by `grunt build`, do not edit it by hand.
display: block;
overflow: hidden;
padding: 0 0 0 8px;
height: 23px;
height: 25px;
border: 1px solid #aaa;
border-radius: 5px;
background-color: #fff;
Expand Down Expand Up @@ -117,9 +119,6 @@ This file is generated by `grunt build`, do not edit it by hand.
white-space: nowrap;
}
.chosen-container-single .chosen-search input[type="text"] {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
margin: 1px 0;
padding: 4px 20px 4px 5px;
width: 100%;
Expand All @@ -146,6 +145,7 @@ This file is generated by `grunt build`, do not edit it by hand.
/* @end */
/* @group Results */
.chosen-container .chosen-results {
color: #444;
position: relative;
overflow-x: hidden;
overflow-y: auto;
Expand All @@ -160,6 +160,7 @@ This file is generated by `grunt build`, do not edit it by hand.
padding: 5px 6px;
list-style: none;
line-height: 15px;
word-wrap: break-word;
-webkit-touch-callout: none;
}
.chosen-container .chosen-results li.active-result {
Expand All @@ -181,6 +182,7 @@ This file is generated by `grunt build`, do not edit it by hand.
color: #fff;
}
.chosen-container .chosen-results li.no-results {
color: #777;
display: list-item;
background: #f4f4f4;
}
Expand All @@ -202,11 +204,8 @@ This file is generated by `grunt build`, do not edit it by hand.
.chosen-container-multi .chosen-choices {
position: relative;
overflow: hidden;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
margin: 0;
padding: 0;
padding: 0 5px;
width: 100%;
height: auto !important;
height: 1%;
Expand All @@ -230,39 +229,42 @@ This file is generated by `grunt build`, do not edit it by hand.
}
.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
margin: 1px 0;
padding: 5px;
height: 15px;
padding: 0;
height: 25px;
outline: 0;
border: 0 !important;
background: transparent !important;
box-shadow: none;
color: #666;
color: #999;
font-size: 100%;
font-family: sans-serif;
line-height: normal;
border-radius: 0;
}
.chosen-container-multi .chosen-choices li.search-field .default {
color: #999;
}
.chosen-container-multi .chosen-choices li.search-choice {
position: relative;
margin: 3px 0 3px 5px;
margin: 3px 5px 3px 0;
padding: 3px 20px 3px 5px;
border: 1px solid #aaa;
max-width: 100%;
border-radius: 3px;
background-color: #e4e4e4;
background-color: #eeeeee;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
background-size: 100% 19px;
background-repeat: repeat-x;
background-clip: padding-box;
box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05);
color: #333;
line-height: 13px;
cursor: default;
}
.chosen-container-multi .chosen-choices li.search-choice span {
word-wrap: break-word;
}
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
position: absolute;
top: 4px;
Expand Down Expand Up @@ -334,7 +336,7 @@ This file is generated by `grunt build`, do not edit it by hand.
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
.chosen-container-active .chosen-choices li.search-field input[type="text"] {
color: #111 !important;
color: #222 !important;
}

/* @end */
Expand Down
4 changes: 2 additions & 2 deletions css/chosen.min.css

Large diffs are not rendered by default.

38 changes: 28 additions & 10 deletions js/chosen.jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Chosen, a Select Box Enhancer for jQuery and Prototype
by Patrick Filler for Harvest, http://getharvest.com
Version 1.1.0
Version 1.2.0
Full source at https://github.com/harvesthq/chosen
Copyright (c) 2011 Harvest http://getharvest.com
Copyright (c) 2011-2014 Harvest http://getharvest.com
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
This file is generated by `grunt build`, do not edit it by hand.
Expand Down Expand Up @@ -309,14 +309,13 @@ This file is generated by `grunt build`, do not edit it by hand.
};

AbstractChosen.prototype.winnow_results = function() {
var escapedSearchText, option, regex, regexAnchor, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
this.no_results_clear();
results = 0;
searchText = this.get_search_text();
escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
regexAnchor = this.search_contains ? "" : "^";
regex = new RegExp(regexAnchor + escapedSearchText, 'i');
zregex = new RegExp(escapedSearchText, 'i');
regex = this.get_search_regex(escapedSearchText);
_ref = this.results_data;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
option = _ref[_i];
Expand All @@ -335,7 +334,7 @@ This file is generated by `grunt build`, do not edit it by hand.
results_group.active_options += 1;
}
if (!(option.group && !this.group_search)) {
option.search_text = option.group ? option.label : option.html;
option.search_text = option.group ? option.label : option.text;
option.search_match = this.search_string_match(option.search_text, regex);
if (option.search_match && !option.group) {
results += 1;
Expand Down Expand Up @@ -365,6 +364,12 @@ This file is generated by `grunt build`, do not edit it by hand.
}
};

AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
var regex_anchor;
regex_anchor = this.search_contains ? "" : "^";
return new RegExp(regex_anchor + escaped_search_string, 'i');
};

AbstractChosen.prototype.search_string_match = function(search_string, regex) {
var part, parts, _i, _len;
if (regex.test(search_string)) {
Expand Down Expand Up @@ -531,9 +536,9 @@ This file is generated by `grunt build`, do not edit it by hand.
var $this, chosen;
$this = $(this);
chosen = $this.data('chosen');
if (options === 'destroy' && chosen) {
if (options === 'destroy' && chosen instanceof Chosen) {
chosen.destroy();
} else if (!chosen) {
} else if (!(chosen instanceof Chosen)) {
$this.data('chosen', new Chosen(this, options));
}
});
Expand Down Expand Up @@ -601,6 +606,12 @@ This file is generated by `grunt build`, do not edit it by hand.

Chosen.prototype.register_observers = function() {
var _this = this;
this.container.bind('touchstart.chosen', function(evt) {
_this.container_mousedown(evt);
});
this.container.bind('touchend.chosen', function(evt) {
_this.container_mouseup(evt);
});
this.container.bind('mousedown.chosen', function(evt) {
_this.container_mousedown(evt);
});
Expand Down Expand Up @@ -733,7 +744,7 @@ This file is generated by `grunt build`, do not edit it by hand.
Chosen.prototype.search_results_mousewheel = function(evt) {
var delta;
if (evt.originalEvent) {
delta = -evt.originalEvent.wheelDelta || evt.originalEvent.detail;
delta = evt.originalEvent.deltaY || -evt.originalEvent.wheelDelta || evt.originalEvent.detail;
}
if (delta != null) {
evt.preventDefault();
Expand Down Expand Up @@ -1163,7 +1174,14 @@ This file is generated by `grunt build`, do not edit it by hand.
this.mouse_on_container = false;
break;
case 13:
evt.preventDefault();
if (this.results_showing) {
evt.preventDefault();
}
break;
case 32:
if (this.disable_search) {
evt.preventDefault();
}
break;
case 38:
evt.preventDefault();
Expand Down
4 changes: 2 additions & 2 deletions js/chosen.jquery.min.js

Large diffs are not rendered by default.

34 changes: 26 additions & 8 deletions js/chosen.proto.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Chosen, a Select Box Enhancer for jQuery and Prototype
by Patrick Filler for Harvest, http://getharvest.com
Version 1.1.0
Version 1.2.0
Full source at https://github.com/harvesthq/chosen
Copyright (c) 2011 Harvest http://getharvest.com
Copyright (c) 2011-2014 Harvest http://getharvest.com
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
This file is generated by `grunt build`, do not edit it by hand.
Expand Down Expand Up @@ -309,14 +309,13 @@ This file is generated by `grunt build`, do not edit it by hand.
};

AbstractChosen.prototype.winnow_results = function() {
var escapedSearchText, option, regex, regexAnchor, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
this.no_results_clear();
results = 0;
searchText = this.get_search_text();
escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
regexAnchor = this.search_contains ? "" : "^";
regex = new RegExp(regexAnchor + escapedSearchText, 'i');
zregex = new RegExp(escapedSearchText, 'i');
regex = this.get_search_regex(escapedSearchText);
_ref = this.results_data;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
option = _ref[_i];
Expand All @@ -335,7 +334,7 @@ This file is generated by `grunt build`, do not edit it by hand.
results_group.active_options += 1;
}
if (!(option.group && !this.group_search)) {
option.search_text = option.group ? option.label : option.html;
option.search_text = option.group ? option.label : option.text;
option.search_match = this.search_string_match(option.search_text, regex);
if (option.search_match && !option.group) {
results += 1;
Expand Down Expand Up @@ -365,6 +364,12 @@ This file is generated by `grunt build`, do not edit it by hand.
}
};

AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
var regex_anchor;
regex_anchor = this.search_contains ? "" : "^";
return new RegExp(regex_anchor + escaped_search_string, 'i');
};

AbstractChosen.prototype.search_string_match = function(search_string, regex) {
var part, parts, _i, _len;
if (regex.test(search_string)) {
Expand Down Expand Up @@ -588,6 +593,12 @@ This file is generated by `grunt build`, do not edit it by hand.

Chosen.prototype.register_observers = function() {
var _this = this;
this.container.observe("touchstart", function(evt) {
return _this.container_mousedown(evt);
});
this.container.observe("touchend", function(evt) {
return _this.container_mouseup(evt);
});
this.container.observe("mousedown", function(evt) {
return _this.container_mousedown(evt);
});
Expand Down Expand Up @@ -735,7 +746,7 @@ This file is generated by `grunt build`, do not edit it by hand.

Chosen.prototype.search_results_mousewheel = function(evt) {
var delta;
delta = -evt.wheelDelta || evt.detail;
delta = evt.deltaY || -evt.wheelDelta || evt.detail;
if (delta != null) {
evt.preventDefault();
if (evt.type === 'DOMMouseScroll') {
Expand Down Expand Up @@ -1184,7 +1195,14 @@ This file is generated by `grunt build`, do not edit it by hand.
this.mouse_on_container = false;
break;
case 13:
evt.preventDefault();
if (this.results_showing) {
evt.preventDefault();
}
break;
case 32:
if (this.disable_search) {
evt.preventDefault();
}
break;
case 38:
evt.preventDefault();
Expand Down
4 changes: 2 additions & 2 deletions js/chosen.proto.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "drmonty-chosen",
"description": "Chosen is a library for making long, unwieldy select boxes more friendly.",
"homepage": "http://harvesthq.github.io/chosen/",
"version": "1.1.0",
"version": "1.2.0",
"keywords": [
"select",
"multiselect",
Expand Down

0 comments on commit 919d4fc

Please sign in to comment.