Changeset 113714 in spip-zone


Ignore:
Timestamp:
Feb 1, 2019, 5:40:29 PM (3 months ago)
Author:
marcimat@…
Message:

Mise à jour le Chosen en version 1.8.7

Ça corrige un problème sur la recherche, qui ne trouvait jamais le premier mot des sélects…

Location:
_plugins_/chosen/trunk
Files:
7 added
1 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/chosen/trunk/lib/chosen/chosen.css

    r98557 r113714  
    33by Patrick Filler for Harvest, http://getharvest.com
    44
    5 Version 1.6.1
     5Version 1.8.7
    66Full source at https://github.com/harvesthq/chosen
    7 Copyright (c) 2011-2016 Harvest http://getharvest.com
     7Copyright (c) 2011-2018 Harvest http://getharvest.com
    88
    99MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
     
    1818  font-size: 13px;
    1919  -webkit-user-select: none;
    20   -moz-user-select: none;
    21   user-select: none;
    22 }
     20     -moz-user-select: none;
     21      -ms-user-select: none;
     22          user-select: none;
     23}
     24
    2325.chosen-container * {
    2426  -webkit-box-sizing: border-box;
    25   -moz-box-sizing: border-box;
    26   box-sizing: border-box;
    27 }
     27          box-sizing: border-box;
     28}
     29
    2830.chosen-container .chosen-drop {
    2931  position: absolute;
    3032  top: 100%;
    31   left: -9999px;
    3233  z-index: 1010;
    3334  width: 100%;
     
    3536  border-top: 0;
    3637  background: #fff;
    37   box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
    38 }
     38  -webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
     39          box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
     40  clip: rect(0, 0, 0, 0);
     41  -webkit-clip-path: inset(100% 100%);
     42          clip-path: inset(100% 100%);
     43}
     44
    3945.chosen-container.chosen-with-drop .chosen-drop {
    40   left: 0;
    41 }
     46  clip: auto;
     47  -webkit-clip-path: none;
     48          clip-path: none;
     49}
     50
    4251.chosen-container a {
    4352  cursor: pointer;
    4453}
     54
    4555.chosen-container .search-choice .group-name, .chosen-container .chosen-single .group-name {
    4656  margin-right: 4px;
     
    5161  color: #999999;
    5262}
     63
    5364.chosen-container .search-choice .group-name:after, .chosen-container .chosen-single .group-name:after {
    5465  content: ":";
     
    6879  border-radius: 5px;
    6980  background-color: #fff;
    70   background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
    71   background: -webkit-linear-gradient(#ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
    72   background: -moz-linear-gradient(#ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
    73   background: -o-linear-gradient(#ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
    74   background: linear-gradient(#ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
     81  background: -webkit-gradient(linear, left top, left bottom, color-stop(20%, #fff), color-stop(50%, #f6f6f6), color-stop(52%, #eee), to(#f4f4f4));
     82  background: linear-gradient(#fff 20%, #f6f6f6 50%, #eee 52%, #f4f4f4 100%);
    7583  background-clip: padding-box;
    76   box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1);
     84  -webkit-box-shadow: 0 0 3px #fff inset, 0 1px 1px rgba(0, 0, 0, 0.1);
     85          box-shadow: 0 0 3px #fff inset, 0 1px 1px rgba(0, 0, 0, 0.1);
    7786  color: #444;
    7887  text-decoration: none;
     
    8089  line-height: 24px;
    8190}
     91
    8292.chosen-container-single .chosen-default {
    8393  color: #999;
    8494}
     95
    8596.chosen-container-single .chosen-single span {
    8697  display: block;
     
    90101  white-space: nowrap;
    91102}
     103
    92104.chosen-container-single .chosen-single-with-deselect span {
    93105  margin-right: 38px;
    94106}
     107
    95108.chosen-container-single .chosen-single abbr {
    96109  position: absolute;
     
    100113  width: 12px;
    101114  height: 12px;
    102   background: url('chosen-sprite.png') -42px 1px no-repeat;
     115  background: url("chosen-sprite.png") -42px 1px no-repeat;
    103116  font-size: 1px;
    104117}
     118
    105119.chosen-container-single .chosen-single abbr:hover {
    106120  background-position: -42px -10px;
    107121}
     122
    108123.chosen-container-single.chosen-disabled .chosen-single abbr:hover {
    109124  background-position: -42px -10px;
    110125}
     126
    111127.chosen-container-single .chosen-single div {
    112128  position: absolute;
     
    117133  height: 100%;
    118134}
     135
    119136.chosen-container-single .chosen-single div b {
    120137  display: block;
    121138  width: 100%;
    122139  height: 100%;
    123   background: url('chosen-sprite.png') no-repeat 0px 2px;
    124 }
     140  background: url("chosen-sprite.png") no-repeat 0px 2px;
     141}
     142
    125143.chosen-container-single .chosen-search {
    126144  position: relative;
     
    130148  white-space: nowrap;
    131149}
     150
    132151.chosen-container-single .chosen-search input[type="text"] {
    133152  margin: 1px 0;
     
    137156  outline: 0;
    138157  border: 1px solid #aaa;
    139   background: white url('chosen-sprite.png') no-repeat 100% -20px;
    140   background: url('chosen-sprite.png') no-repeat 100% -20px;
     158  background: url("chosen-sprite.png") no-repeat 100% -20px;
    141159  font-size: 1em;
    142160  font-family: sans-serif;
     
    144162  border-radius: 0;
    145163}
     164
    146165.chosen-container-single .chosen-drop {
    147166  margin-top: -1px;
     
    149168  background-clip: padding-box;
    150169}
     170
    151171.chosen-container-single.chosen-container-single-nosearch .chosen-search {
    152172  position: absolute;
    153   left: -9999px;
     173  clip: rect(0, 0, 0, 0);
     174  -webkit-clip-path: inset(100% 100%);
     175          clip-path: inset(100% 100%);
    154176}
    155177
     
    166188  -webkit-overflow-scrolling: touch;
    167189}
     190
    168191.chosen-container .chosen-results li {
    169192  display: none;
     
    175198  -webkit-touch-callout: none;
    176199}
     200
    177201.chosen-container .chosen-results li.active-result {
    178202  display: list-item;
    179203  cursor: pointer;
    180204}
     205
    181206.chosen-container .chosen-results li.disabled-result {
    182207  display: list-item;
     
    184209  cursor: default;
    185210}
     211
    186212.chosen-container .chosen-results li.highlighted {
    187213  background-color: #3875d7;
    188   background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
    189   background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%);
    190   background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%);
    191   background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%);
     214  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
    192215  background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
    193216  color: #fff;
    194217}
     218
    195219.chosen-container .chosen-results li.no-results {
    196220  color: #777;
     
    198222  background: #f4f4f4;
    199223}
     224
    200225.chosen-container .chosen-results li.group-result {
    201226  display: list-item;
     
    203228  cursor: default;
    204229}
     230
    205231.chosen-container .chosen-results li.group-option {
    206232  padding-left: 15px;
    207233}
     234
    208235.chosen-container .chosen-results li em {
    209236  font-style: normal;
     
    222249  border: 1px solid #aaa;
    223250  background-color: #fff;
    224   background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
    225   background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%);
    226   background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%);
    227   background-image: -o-linear-gradient(#eeeeee 1%, #ffffff 15%);
    228   background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);
     251  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(1%, #eee), color-stop(15%, #fff));
     252  background-image: linear-gradient(#eee 1%, #fff 15%);
    229253  cursor: text;
    230254}
     255
    231256.chosen-container-multi .chosen-choices li {
    232257  float: left;
    233258  list-style: none;
    234259}
     260
    235261.chosen-container-multi .chosen-choices li.search-field {
    236262  margin: 0;
     
    238264  white-space: nowrap;
    239265}
     266
    240267.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
    241268  margin: 1px 0;
     
    245272  border: 0 !important;
    246273  background: transparent !important;
    247   box-shadow: none;
     274  -webkit-box-shadow: none;
     275          box-shadow: none;
    248276  color: #999;
    249277  font-size: 100%;
     
    251279  line-height: normal;
    252280  border-radius: 0;
    253 }
     281  width: 25px;
     282}
     283
    254284.chosen-container-multi .chosen-choices li.search-choice {
    255285  position: relative;
     
    260290  border-radius: 3px;
    261291  background-color: #eeeeee;
    262   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));
    263   background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
    264   background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
    265   background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
    266   background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
     292  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), to(#eee));
     293  background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
    267294  background-size: 100% 19px;
    268295  background-repeat: repeat-x;
    269296  background-clip: padding-box;
    270   box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05);
     297  -webkit-box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
     298          box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
    271299  color: #333;
    272300  line-height: 13px;
    273301  cursor: default;
    274302}
     303
    275304.chosen-container-multi .chosen-choices li.search-choice span {
    276305  word-wrap: break-word;
    277306}
     307
    278308.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
    279309  position: absolute;
     
    283313  width: 12px;
    284314  height: 12px;
    285   background: url('chosen-sprite.png') -42px 1px no-repeat;
     315  background: url("chosen-sprite.png") -42px 1px no-repeat;
    286316  font-size: 1px;
    287317}
     318
    288319.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
    289320  background-position: -42px -10px;
    290321}
     322
    291323.chosen-container-multi .chosen-choices li.search-choice-disabled {
    292324  padding-right: 5px;
    293325  border: 1px solid #ccc;
    294326  background-color: #e4e4e4;
    295   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));
    296   background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
    297   background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
    298   background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
    299   background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
     327  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), to(#eee));
     328  background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
    300329  color: #666;
    301330}
     331
    302332.chosen-container-multi .chosen-choices li.search-choice-focus {
    303333  background: #d4d4d4;
    304334}
     335
    305336.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
    306337  background-position: -42px -10px;
    307338}
     339
    308340.chosen-container-multi .chosen-results {
    309341  margin: 0;
    310342  padding: 0;
    311343}
     344
    312345.chosen-container-multi .chosen-drop .result-selected {
    313346  display: list-item;
     
    320353.chosen-container-active .chosen-single {
    321354  border: 1px solid #5897fb;
    322   box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
    323 }
     355  -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
     356          box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
     357}
     358
    324359.chosen-container-active.chosen-with-drop .chosen-single {
    325360  border: 1px solid #aaa;
    326   -moz-border-radius-bottomright: 0;
    327361  border-bottom-right-radius: 0;
    328   -moz-border-radius-bottomleft: 0;
    329362  border-bottom-left-radius: 0;
    330   background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
    331   background-image: -webkit-linear-gradient(#eeeeee 20%, #ffffff 80%);
    332   background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%);
    333   background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%);
    334   background-image: linear-gradient(#eeeeee 20%, #ffffff 80%);
    335   box-shadow: 0 1px 0 #fff inset;
    336 }
     363  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(20%, #eee), color-stop(80%, #fff));
     364  background-image: linear-gradient(#eee 20%, #fff 80%);
     365  -webkit-box-shadow: 0 1px 0 #fff inset;
     366          box-shadow: 0 1px 0 #fff inset;
     367}
     368
    337369.chosen-container-active.chosen-with-drop .chosen-single div {
    338370  border-left: none;
    339371  background: transparent;
    340372}
     373
    341374.chosen-container-active.chosen-with-drop .chosen-single div b {
    342375  background-position: -18px 2px;
    343376}
     377
    344378.chosen-container-active .chosen-choices {
    345379  border: 1px solid #5897fb;
    346   box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
    347 }
     380  -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
     381          box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
     382}
     383
    348384.chosen-container-active .chosen-choices li.search-field input[type="text"] {
    349385  color: #222 !important;
     
    356392  cursor: default;
    357393}
     394
    358395.chosen-disabled .chosen-single {
    359396  cursor: default;
    360397}
     398
    361399.chosen-disabled .chosen-choices .search-choice .search-choice-close {
    362400  cursor: default;
     
    368406  text-align: right;
    369407}
     408
    370409.chosen-rtl .chosen-single {
    371410  overflow: visible;
    372411  padding: 0 8px 0 0;
    373412}
     413
    374414.chosen-rtl .chosen-single span {
    375415  margin-right: 0;
     
    377417  direction: rtl;
    378418}
     419
    379420.chosen-rtl .chosen-single-with-deselect span {
    380421  margin-left: 38px;
    381422}
     423
    382424.chosen-rtl .chosen-single div {
    383425  right: auto;
    384426  left: 3px;
    385427}
     428
    386429.chosen-rtl .chosen-single abbr {
    387430  right: auto;
    388431  left: 26px;
    389432}
     433
    390434.chosen-rtl .chosen-choices li {
    391435  float: right;
    392436}
     437
    393438.chosen-rtl .chosen-choices li.search-field input[type="text"] {
    394439  direction: rtl;
    395440}
     441
    396442.chosen-rtl .chosen-choices li.search-choice {
    397443  margin: 3px 5px 3px 0;
    398444  padding: 3px 5px 3px 19px;
    399445}
     446
    400447.chosen-rtl .chosen-choices li.search-choice .search-choice-close {
    401448  right: auto;
    402449  left: 4px;
    403450}
    404 .chosen-rtl.chosen-container-single-nosearch .chosen-search,
    405 .chosen-rtl .chosen-drop {
    406   left: 9999px;
    407 }
     451
    408452.chosen-rtl.chosen-container-single .chosen-results {
    409453  margin: 0 0 4px 4px;
    410454  padding: 0 4px 0 0;
    411455}
     456
    412457.chosen-rtl .chosen-results li.group-option {
    413458  padding-right: 15px;
    414459  padding-left: 0;
    415460}
     461
    416462.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
    417463  border-right: none;
    418464}
     465
    419466.chosen-rtl .chosen-search input[type="text"] {
    420467  padding: 4px 5px 4px 20px;
    421   background: white url('chosen-sprite.png') no-repeat -30px -20px;
    422   background: url('chosen-sprite.png') no-repeat -30px -20px;
     468  background: url("chosen-sprite.png") no-repeat -30px -20px;
    423469  direction: rtl;
    424470}
     471
    425472.chosen-rtl.chosen-container-single .chosen-single div b {
    426473  background-position: 6px 2px;
    427474}
     475
    428476.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
    429477  background-position: -12px 2px;
     
    440488  .chosen-container .chosen-results-scroll-down span,
    441489  .chosen-container .chosen-results-scroll-up span {
    442     background-image: url('chosen-sprite@2x.png') !important;
     490    background-image: url("chosen-sprite@2x.png") !important;
    443491    background-size: 52px 37px !important;
    444492    background-repeat: no-repeat !important;
    445493  }
    446494}
    447 /* @end */
     495
     496/* @end */
  • _plugins_/chosen/trunk/lib/chosen/chosen.jquery.js

    r98557 r113714  
    33by Patrick Filler for Harvest, http://getharvest.com
    44
    5 Version 1.6.1
     5Version 1.8.7
    66Full source at https://github.com/harvesthq/chosen
    7 Copyright (c) 2011-2016 Harvest http://getharvest.com
     7Copyright (c) 2011-2018 Harvest http://getharvest.com
    88
    99MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
     
    1212
    1313(function() {
    14   var $, AbstractChosen, Chosen, SelectParser, _ref,
    15     __hasProp = {}.hasOwnProperty,
    16     __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; };
     14  var $, AbstractChosen, Chosen, SelectParser,
     15    bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
     16    extend = 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; },
     17    hasProp = {}.hasOwnProperty;
    1718
    1819  SelectParser = (function() {
     
    3132
    3233    SelectParser.prototype.add_group = function(group) {
    33       var group_position, option, _i, _len, _ref, _results;
     34      var group_position, i, len, option, ref, results1;
    3435      group_position = this.parsed.length;
    3536      this.parsed.push({
    3637        array_index: group_position,
    3738        group: true,
    38         label: this.escapeExpression(group.label),
     39        label: group.label,
    3940        title: group.title ? group.title : void 0,
    4041        children: 0,
     
    4243        classes: group.className
    4344      });
    44       _ref = group.childNodes;
    45       _results = [];
    46       for (_i = 0, _len = _ref.length; _i < _len; _i++) {
    47         option = _ref[_i];
    48         _results.push(this.add_option(option, group_position, group.disabled));
    49       }
    50       return _results;
     45      ref = group.childNodes;
     46      results1 = [];
     47      for (i = 0, len = ref.length; i < len; i++) {
     48        option = ref[i];
     49        results1.push(this.add_option(option, group_position, group.disabled));
     50      }
     51      return results1;
    5152    };
    5253
     
    8283    };
    8384
    84     SelectParser.prototype.escapeExpression = function(text) {
    85       var map, unsafe_chars;
    86       if ((text == null) || text === false) {
    87         return "";
    88       }
    89       if (!/[\&\<\>\"\'\`]/.test(text)) {
    90         return text;
    91       }
    92       map = {
    93         "<": "&lt;",
    94         ">": "&gt;",
    95         '"': "&quot;",
    96         "'": "&#x27;",
    97         "`": "&#x60;"
    98       };
    99       unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
    100       return text.replace(unsafe_chars, function(chr) {
    101         return map[chr] || "&amp;";
    102       });
    103     };
    104 
    10585    return SelectParser;
    10686
     
    10888
    10989  SelectParser.select_to_array = function(select) {
    110     var child, parser, _i, _len, _ref;
     90    var child, i, len, parser, ref;
    11191    parser = new SelectParser();
    112     _ref = select.childNodes;
    113     for (_i = 0, _len = _ref.length; _i < _len; _i++) {
    114       child = _ref[_i];
     92    ref = select.childNodes;
     93    for (i = 0, len = ref.length; i < len; i++) {
     94      child = ref[i];
    11595      parser.add_node(child);
    11696    }
     
    11999
    120100  AbstractChosen = (function() {
    121     function AbstractChosen(form_field, options) {
     101    function AbstractChosen(form_field, options1) {
    122102      this.form_field = form_field;
    123       this.options = options != null ? options : {};
     103      this.options = options1 != null ? options1 : {};
     104      this.label_click_handler = bind(this.label_click_handler, this);
    124105      if (!AbstractChosen.browser_is_supported()) {
    125106        return;
     
    135116
    136117    AbstractChosen.prototype.set_default_values = function() {
    137       var _this = this;
    138       this.click_test_action = function(evt) {
    139         return _this.test_active_click(evt);
    140       };
    141       this.activate_action = function(evt) {
    142         return _this.activate_field(evt);
    143       };
     118      this.click_test_action = (function(_this) {
     119        return function(evt) {
     120          return _this.test_active_click(evt);
     121        };
     122      })(this);
     123      this.activate_action = (function(_this) {
     124        return function(evt) {
     125          return _this.activate_field(evt);
     126        };
     127      })(this);
    144128      this.active_field = false;
    145129      this.mouse_on_container = false;
    146130      this.results_showing = false;
    147131      this.result_highlighted = null;
     132      this.is_rtl = this.options.rtl || /\bchosen-rtl\b/.test(this.form_field.className);
    148133      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;
    149134      this.disable_search_threshold = this.options.disable_search_threshold || 0;
     
    159144      this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
    160145      this.max_shown_results = this.options.max_shown_results || Number.POSITIVE_INFINITY;
    161       return this.case_sensitive_search = this.options.case_sensitive_search || false;
     146      this.case_sensitive_search = this.options.case_sensitive_search || false;
     147      return this.hide_results_on_select = this.options.hide_results_on_select != null ? this.options.hide_results_on_select : true;
    162148    };
    163149
     
    170156        this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
    171157      }
     158      this.default_text = this.escape_html(this.default_text);
    172159      return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
    173160    };
     
    175162    AbstractChosen.prototype.choice_label = function(item) {
    176163      if (this.include_group_label_in_selected && (item.group_label != null)) {
    177         return "<b class='group-name'>" + item.group_label + "</b>" + item.html;
     164        return "<b class='group-name'>" + (this.escape_html(item.group_label)) + "</b>" + item.html;
    178165      } else {
    179166        return item.html;
     
    190177
    191178    AbstractChosen.prototype.input_focus = function(evt) {
    192       var _this = this;
    193179      if (this.is_multiple) {
    194180        if (!this.active_field) {
    195           return setTimeout((function() {
    196             return _this.container_mousedown();
    197           }), 50);
     181          return setTimeout(((function(_this) {
     182            return function() {
     183              return _this.container_mousedown();
     184            };
     185          })(this)), 50);
    198186        }
    199187      } else {
     
    205193
    206194    AbstractChosen.prototype.input_blur = function(evt) {
    207       var _this = this;
    208195      if (!this.mouse_on_container) {
    209196        this.active_field = false;
    210         return setTimeout((function() {
    211           return _this.blur_test();
    212         }), 100);
     197        return setTimeout(((function(_this) {
     198          return function() {
     199            return _this.blur_test();
     200          };
     201        })(this)), 100);
     202      }
     203    };
     204
     205    AbstractChosen.prototype.label_click_handler = function(evt) {
     206      if (this.is_multiple) {
     207        return this.container_mousedown(evt);
     208      } else {
     209        return this.activate_field();
    213210      }
    214211    };
    215212
    216213    AbstractChosen.prototype.results_option_build = function(options) {
    217       var content, data, data_content, shown_results, _i, _len, _ref;
     214      var content, data, data_content, i, len, ref, shown_results;
    218215      content = '';
    219216      shown_results = 0;
    220       _ref = this.results_data;
    221       for (_i = 0, _len = _ref.length; _i < _len; _i++) {
    222         data = _ref[_i];
     217      ref = this.results_data;
     218      for (i = 0, len = ref.length; i < len; i++) {
     219        data = ref[i];
    223220        data_content = '';
    224221        if (data.group) {
     
    271268      option_el = document.createElement("li");
    272269      option_el.className = classes.join(" ");
    273       option_el.style.cssText = option.style;
     270      if (option.style) {
     271        option_el.style.cssText = option.style;
     272      }
    274273      option_el.setAttribute("data-option-array-index", option.array_index);
    275       option_el.innerHTML = option.search_text;
     274      option_el.innerHTML = option.highlighted_html || option.html;
    276275      if (option.title) {
    277276        option_el.title = option.title;
     
    295294      group_el = document.createElement("li");
    296295      group_el.className = classes.join(" ");
    297       group_el.innerHTML = group.search_text;
     296      group_el.innerHTML = group.highlighted_html || this.escape_html(group.label);
    298297      if (group.title) {
    299298        group_el.title = group.title;
     
    315314
    316315    AbstractChosen.prototype.reset_single_select_options = function() {
    317       var result, _i, _len, _ref, _results;
    318       _ref = this.results_data;
    319       _results = [];
    320       for (_i = 0, _len = _ref.length; _i < _len; _i++) {
    321         result = _ref[_i];
     316      var i, len, ref, result, results1;
     317      ref = this.results_data;
     318      results1 = [];
     319      for (i = 0, len = ref.length; i < len; i++) {
     320        result = ref[i];
    322321        if (result.selected) {
    323           _results.push(result.selected = false);
     322          results1.push(result.selected = false);
    324323        } else {
    325           _results.push(void 0);
    326         }
    327       }
    328       return _results;
     324          results1.push(void 0);
     325        }
     326      }
     327      return results1;
    329328    };
    330329
     
    345344    };
    346345
    347     AbstractChosen.prototype.winnow_results = function() {
    348       var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
     346    AbstractChosen.prototype.winnow_results = function(options) {
     347      var escapedQuery, fix, i, len, option, prefix, query, ref, regex, results, results_group, search_match, startpos, suffix, text;
    349348      this.no_results_clear();
    350349      results = 0;
    351       searchText = this.get_search_text();
    352       escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
    353       zregex = new RegExp(escapedSearchText, 'i');
    354       regex = this.get_search_regex(escapedSearchText);
    355       _ref = this.results_data;
    356       for (_i = 0, _len = _ref.length; _i < _len; _i++) {
    357         option = _ref[_i];
     350      query = this.get_search_text();
     351      escapedQuery = query.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
     352      regex = this.get_search_regex(escapedQuery);
     353      ref = this.results_data;
     354      for (i = 0, len = ref.length; i < len; i++) {
     355        option = ref[i];
    358356        option.search_match = false;
    359357        results_group = null;
     358        search_match = null;
     359        option.highlighted_html = '';
    360360        if (this.include_option_in_results(option)) {
    361361          if (option.group) {
     
    370370            results_group.active_options += 1;
    371371          }
    372           option.search_text = option.group ? option.label : option.html;
     372          text = option.group ? option.label : option.text;
    373373          if (!(option.group && !this.group_search)) {
    374             option.search_match = this.search_string_match(option.search_text, regex);
     374            search_match = this.search_string_match(text, regex);
     375            option.search_match = search_match != null;
    375376            if (option.search_match && !option.group) {
    376377              results += 1;
    377378            }
    378379            if (option.search_match) {
    379               if (searchText.length) {
    380                 startpos = option.search_text.search(zregex);
    381                 text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
    382                 option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
     380              if (query.length) {
     381                startpos = search_match.index;
     382                prefix = text.slice(0, startpos);
     383                fix = text.slice(startpos, startpos + query.length);
     384                suffix = text.slice(startpos + query.length);
     385                option.highlighted_html = (this.escape_html(prefix)) + "<em>" + (this.escape_html(fix)) + "</em>" + (this.escape_html(suffix));
    383386              }
    384387              if (results_group != null) {
     
    392395      }
    393396      this.result_clear_highlight();
    394       if (results < 1 && searchText.length) {
     397      if (results < 1 && query.length) {
    395398        this.update_results_content("");
    396         return this.no_results(searchText);
     399        return this.no_results(query);
    397400      } else {
    398401        this.update_results_content(this.results_option_build());
    399         return this.winnow_results_set_highlight();
     402        if (!(options != null ? options.skip_highlight : void 0)) {
     403          return this.winnow_results_set_highlight();
     404        }
    400405      }
    401406    };
    402407
    403408    AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
    404       var regex_anchor, regex_flag;
    405       regex_anchor = this.search_contains ? "" : "^";
     409      var regex_flag, regex_string;
     410      regex_string = this.search_contains ? escaped_search_string : "(^|\\s|\\b)" + escaped_search_string + "[^\\s]*";
     411      if (!(this.enable_split_word_search || this.search_contains)) {
     412        regex_string = "^" + regex_string;
     413      }
    406414      regex_flag = this.case_sensitive_search ? "" : "i";
    407       return new RegExp(regex_anchor + escaped_search_string, regex_flag);
     415      return new RegExp(regex_string, regex_flag);
    408416    };
    409417
    410418    AbstractChosen.prototype.search_string_match = function(search_string, regex) {
    411       var part, parts, _i, _len;
    412       if (regex.test(search_string)) {
    413         return true;
    414       } else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
    415         parts = search_string.replace(/\[|\]/g, "").split(" ");
    416         if (parts.length) {
    417           for (_i = 0, _len = parts.length; _i < _len; _i++) {
    418             part = parts[_i];
    419             if (regex.test(part)) {
    420               return true;
    421             }
    422           }
    423         }
    424       }
     419      var match;
     420      match = regex.exec(search_string);
     421      if (!this.search_contains && (match != null ? match[1] : void 0)) {
     422        match.index += 1;
     423      }
     424      return match;
    425425    };
    426426
    427427    AbstractChosen.prototype.choices_count = function() {
    428       var option, _i, _len, _ref;
     428      var i, len, option, ref;
    429429      if (this.selected_option_count != null) {
    430430        return this.selected_option_count;
    431431      }
    432432      this.selected_option_count = 0;
    433       _ref = this.form_field.options;
    434       for (_i = 0, _len = _ref.length; _i < _len; _i++) {
    435         option = _ref[_i];
     433      ref = this.form_field.options;
     434      for (i = 0, len = ref.length; i < len; i++) {
     435        option = ref[i];
    436436        if (option.selected) {
    437437          this.selected_option_count += 1;
     
    443443    AbstractChosen.prototype.choices_click = function(evt) {
    444444      evt.preventDefault();
     445      this.activate_field();
    445446      if (!(this.results_showing || this.is_disabled)) {
    446447        return this.results_show();
     
    448449    };
    449450
     451    AbstractChosen.prototype.keydown_checker = function(evt) {
     452      var ref, stroke;
     453      stroke = (ref = evt.which) != null ? ref : evt.keyCode;
     454      this.search_field_scale();
     455      if (stroke !== 8 && this.pending_backstroke) {
     456        this.clear_backstroke();
     457      }
     458      switch (stroke) {
     459        case 8:
     460          this.backstroke_length = this.get_search_field_value().length;
     461          break;
     462        case 9:
     463          if (this.results_showing && !this.is_multiple) {
     464            this.result_select(evt);
     465          }
     466          this.mouse_on_container = false;
     467          break;
     468        case 13:
     469          if (this.results_showing) {
     470            evt.preventDefault();
     471          }
     472          break;
     473        case 27:
     474          if (this.results_showing) {
     475            evt.preventDefault();
     476          }
     477          break;
     478        case 32:
     479          if (this.disable_search) {
     480            evt.preventDefault();
     481          }
     482          break;
     483        case 38:
     484          evt.preventDefault();
     485          this.keyup_arrow();
     486          break;
     487        case 40:
     488          evt.preventDefault();
     489          this.keydown_arrow();
     490          break;
     491      }
     492    };
     493
    450494    AbstractChosen.prototype.keyup_checker = function(evt) {
    451       var stroke, _ref;
    452       stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
     495      var ref, stroke;
     496      stroke = (ref = evt.which) != null ? ref : evt.keyCode;
    453497      this.search_field_scale();
    454498      switch (stroke) {
    455499        case 8:
    456500          if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
    457             return this.keydown_backstroke();
     501            this.keydown_backstroke();
    458502          } else if (!this.pending_backstroke) {
    459503            this.result_clear_highlight();
    460             return this.results_search();
     504            this.results_search();
    461505          }
    462506          break;
     
    464508          evt.preventDefault();
    465509          if (this.results_showing) {
    466             return this.result_select(evt);
     510            this.result_select(evt);
    467511          }
    468512          break;
     
    471515            this.results_hide();
    472516          }
    473           return true;
     517          break;
    474518        case 9:
     519        case 16:
     520        case 17:
     521        case 18:
    475522        case 38:
    476523        case 40:
    477         case 16:
    478524        case 91:
    479         case 17:
    480         case 18:
    481525          break;
    482526        default:
    483           return this.results_search();
     527          this.results_search();
     528          break;
    484529      }
    485530    };
    486531
    487532    AbstractChosen.prototype.clipboard_event_checker = function(evt) {
    488       var _this = this;
    489       return setTimeout((function() {
    490         return _this.results_search();
    491       }), 50);
     533      if (this.is_disabled) {
     534        return;
     535      }
     536      return setTimeout(((function(_this) {
     537        return function() {
     538          return _this.results_search();
     539        };
     540      })(this)), 50);
    492541    };
    493542
     
    496545        return this.options.width;
    497546      } else {
    498         return "" + this.form_field.offsetWidth + "px";
     547        return this.form_field.offsetWidth + "px";
    499548      }
    500549    };
     
    537586      tmp.appendChild(element);
    538587      return tmp.innerHTML;
     588    };
     589
     590    AbstractChosen.prototype.get_single_html = function() {
     591      return "<a class=\"chosen-single chosen-default\">\n  <span>" + this.default_text + "</span>\n  <div><b></b></div>\n</a>\n<div class=\"chosen-drop\">\n  <div class=\"chosen-search\">\n    <input class=\"chosen-search-input\" type=\"text\" autocomplete=\"off\" />\n  </div>\n  <ul class=\"chosen-results\"></ul>\n</div>";
     592    };
     593
     594    AbstractChosen.prototype.get_multi_html = function() {
     595      return "<ul class=\"chosen-choices\">\n  <li class=\"search-field\">\n    <input class=\"chosen-search-input\" type=\"text\" autocomplete=\"off\" value=\"" + this.default_text + "\" />\n  </li>\n</ul>\n<div class=\"chosen-drop\">\n  <ul class=\"chosen-results\"></ul>\n</div>";
     596    };
     597
     598    AbstractChosen.prototype.get_no_results_html = function(terms) {
     599      return "<li class=\"no-results\">\n  " + this.results_none_found + " <span>" + (this.escape_html(terms)) + "</span>\n</li>";
    539600    };
    540601
     
    583644  });
    584645
    585   Chosen = (function(_super) {
    586     __extends(Chosen, _super);
     646  Chosen = (function(superClass) {
     647    extend(Chosen, superClass);
    587648
    588649    function Chosen() {
    589       _ref = Chosen.__super__.constructor.apply(this, arguments);
    590       return _ref;
     650      return Chosen.__super__.constructor.apply(this, arguments);
    591651    }
    592652
    593653    Chosen.prototype.setup = function() {
    594654      this.form_field_jq = $(this.form_field);
    595       this.current_selectedIndex = this.form_field.selectedIndex;
    596       return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl");
     655      return this.current_selectedIndex = this.form_field.selectedIndex;
    597656    };
    598657
     
    609668      container_props = {
    610669        'class': container_classes.join(' '),
    611         'style': "width: " + (this.container_width()) + ";",
    612670        'title': this.form_field.title
    613671      };
     
    616674      }
    617675      this.container = $("<div />", container_props);
     676      this.container.width(this.container_width());
    618677      if (this.is_multiple) {
    619         this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
    620       } else {
    621         this.container.html('<a class="chosen-single chosen-default"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
     678        this.container.html(this.get_multi_html());
     679      } else {
     680        this.container.html(this.get_single_html());
    622681      }
    623682      this.form_field_jq.hide().after(this.container);
     
    646705
    647706    Chosen.prototype.register_observers = function() {
    648       var _this = this;
    649       this.container.bind('touchstart.chosen', function(evt) {
    650         _this.container_mousedown(evt);
    651         return evt.preventDefault();
    652       });
    653       this.container.bind('touchend.chosen', function(evt) {
    654         _this.container_mouseup(evt);
    655         return evt.preventDefault();
    656       });
    657       this.container.bind('mousedown.chosen', function(evt) {
    658         _this.container_mousedown(evt);
    659       });
    660       this.container.bind('mouseup.chosen', function(evt) {
    661         _this.container_mouseup(evt);
    662       });
    663       this.container.bind('mouseenter.chosen', function(evt) {
    664         _this.mouse_enter(evt);
    665       });
    666       this.container.bind('mouseleave.chosen', function(evt) {
    667         _this.mouse_leave(evt);
    668       });
    669       this.search_results.bind('mouseup.chosen', function(evt) {
    670         _this.search_results_mouseup(evt);
    671       });
    672       this.search_results.bind('mouseover.chosen', function(evt) {
    673         _this.search_results_mouseover(evt);
    674       });
    675       this.search_results.bind('mouseout.chosen', function(evt) {
    676         _this.search_results_mouseout(evt);
    677       });
    678       this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) {
    679         _this.search_results_mousewheel(evt);
    680       });
    681       this.search_results.bind('touchstart.chosen', function(evt) {
    682         _this.search_results_touchstart(evt);
    683       });
    684       this.search_results.bind('touchmove.chosen', function(evt) {
    685         _this.search_results_touchmove(evt);
    686       });
    687       this.search_results.bind('touchend.chosen', function(evt) {
    688         _this.search_results_touchend(evt);
    689       });
    690       this.form_field_jq.bind("chosen:updated.chosen", function(evt) {
    691         _this.results_update_field(evt);
    692       });
    693       this.form_field_jq.bind("chosen:activate.chosen", function(evt) {
    694         _this.activate_field(evt);
    695       });
    696       this.form_field_jq.bind("chosen:open.chosen", function(evt) {
    697         _this.container_mousedown(evt);
    698       });
    699       this.form_field_jq.bind("chosen:close.chosen", function(evt) {
    700         _this.input_blur(evt);
    701       });
    702       this.search_field.bind('blur.chosen', function(evt) {
    703         _this.input_blur(evt);
    704       });
    705       this.search_field.bind('keyup.chosen', function(evt) {
    706         _this.keyup_checker(evt);
    707       });
    708       this.search_field.bind('keydown.chosen', function(evt) {
    709         _this.keydown_checker(evt);
    710       });
    711       this.search_field.bind('focus.chosen', function(evt) {
    712         _this.input_focus(evt);
    713       });
    714       this.search_field.bind('cut.chosen', function(evt) {
    715         _this.clipboard_event_checker(evt);
    716       });
    717       this.search_field.bind('paste.chosen', function(evt) {
    718         _this.clipboard_event_checker(evt);
    719       });
     707      this.container.on('touchstart.chosen', (function(_this) {
     708        return function(evt) {
     709          _this.container_mousedown(evt);
     710        };
     711      })(this));
     712      this.container.on('touchend.chosen', (function(_this) {
     713        return function(evt) {
     714          _this.container_mouseup(evt);
     715        };
     716      })(this));
     717      this.container.on('mousedown.chosen', (function(_this) {
     718        return function(evt) {
     719          _this.container_mousedown(evt);
     720        };
     721      })(this));
     722      this.container.on('mouseup.chosen', (function(_this) {
     723        return function(evt) {
     724          _this.container_mouseup(evt);
     725        };
     726      })(this));
     727      this.container.on('mouseenter.chosen', (function(_this) {
     728        return function(evt) {
     729          _this.mouse_enter(evt);
     730        };
     731      })(this));
     732      this.container.on('mouseleave.chosen', (function(_this) {
     733        return function(evt) {
     734          _this.mouse_leave(evt);
     735        };
     736      })(this));
     737      this.search_results.on('mouseup.chosen', (function(_this) {
     738        return function(evt) {
     739          _this.search_results_mouseup(evt);
     740        };
     741      })(this));
     742      this.search_results.on('mouseover.chosen', (function(_this) {
     743        return function(evt) {
     744          _this.search_results_mouseover(evt);
     745        };
     746      })(this));
     747      this.search_results.on('mouseout.chosen', (function(_this) {
     748        return function(evt) {
     749          _this.search_results_mouseout(evt);
     750        };
     751      })(this));
     752      this.search_results.on('mousewheel.chosen DOMMouseScroll.chosen', (function(_this) {
     753        return function(evt) {
     754          _this.search_results_mousewheel(evt);
     755        };
     756      })(this));
     757      this.search_results.on('touchstart.chosen', (function(_this) {
     758        return function(evt) {
     759          _this.search_results_touchstart(evt);
     760        };
     761      })(this));
     762      this.search_results.on('touchmove.chosen', (function(_this) {
     763        return function(evt) {
     764          _this.search_results_touchmove(evt);
     765        };
     766      })(this));
     767      this.search_results.on('touchend.chosen', (function(_this) {
     768        return function(evt) {
     769          _this.search_results_touchend(evt);
     770        };
     771      })(this));
     772      this.form_field_jq.on("chosen:updated.chosen", (function(_this) {
     773        return function(evt) {
     774          _this.results_update_field(evt);
     775        };
     776      })(this));
     777      this.form_field_jq.on("chosen:activate.chosen", (function(_this) {
     778        return function(evt) {
     779          _this.activate_field(evt);
     780        };
     781      })(this));
     782      this.form_field_jq.on("chosen:open.chosen", (function(_this) {
     783        return function(evt) {
     784          _this.container_mousedown(evt);
     785        };
     786      })(this));
     787      this.form_field_jq.on("chosen:close.chosen", (function(_this) {
     788        return function(evt) {
     789          _this.close_field(evt);
     790        };
     791      })(this));
     792      this.search_field.on('blur.chosen', (function(_this) {
     793        return function(evt) {
     794          _this.input_blur(evt);
     795        };
     796      })(this));
     797      this.search_field.on('keyup.chosen', (function(_this) {
     798        return function(evt) {
     799          _this.keyup_checker(evt);
     800        };
     801      })(this));
     802      this.search_field.on('keydown.chosen', (function(_this) {
     803        return function(evt) {
     804          _this.keydown_checker(evt);
     805        };
     806      })(this));
     807      this.search_field.on('focus.chosen', (function(_this) {
     808        return function(evt) {
     809          _this.input_focus(evt);
     810        };
     811      })(this));
     812      this.search_field.on('cut.chosen', (function(_this) {
     813        return function(evt) {
     814          _this.clipboard_event_checker(evt);
     815        };
     816      })(this));
     817      this.search_field.on('paste.chosen', (function(_this) {
     818        return function(evt) {
     819          _this.clipboard_event_checker(evt);
     820        };
     821      })(this));
    720822      if (this.is_multiple) {
    721         return this.search_choices.bind('click.chosen', function(evt) {
    722           _this.choices_click(evt);
    723         });
    724       } else {
    725         return this.container.bind('click.chosen', function(evt) {
     823        return this.search_choices.on('click.chosen', (function(_this) {
     824          return function(evt) {
     825            _this.choices_click(evt);
     826          };
     827        })(this));
     828      } else {
     829        return this.container.on('click.chosen', function(evt) {
    726830          evt.preventDefault();
    727831        });
     
    730834
    731835    Chosen.prototype.destroy = function() {
    732       $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
     836      $(this.container[0].ownerDocument).off('click.chosen', this.click_test_action);
     837      if (this.form_field_label.length > 0) {
     838        this.form_field_label.off('click.chosen');
     839      }
    733840      if (this.search_field[0].tabIndex) {
    734841        this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
     
    740847
    741848    Chosen.prototype.search_field_disabled = function() {
    742       this.is_disabled = this.form_field_jq[0].disabled;
     849      this.is_disabled = this.form_field.disabled || this.form_field_jq.parents('fieldset').is(':disabled');
     850      this.container.toggleClass('chosen-disabled', this.is_disabled);
     851      this.search_field[0].disabled = this.is_disabled;
     852      if (!this.is_multiple) {
     853        this.selected_item.off('focus.chosen', this.activate_field);
     854      }
    743855      if (this.is_disabled) {
    744         this.container.addClass('chosen-disabled');
    745         this.search_field[0].disabled = true;
    746         if (!this.is_multiple) {
    747           this.selected_item.unbind("focus.chosen", this.activate_action);
    748         }
    749856        return this.close_field();
    750       } else {
    751         this.container.removeClass('chosen-disabled');
    752         this.search_field[0].disabled = false;
    753         if (!this.is_multiple) {
    754           return this.selected_item.bind("focus.chosen", this.activate_action);
    755         }
     857      } else if (!this.is_multiple) {
     858        return this.selected_item.on('focus.chosen', this.activate_field);
    756859      }
    757860    };
    758861
    759862    Chosen.prototype.container_mousedown = function(evt) {
    760       if (!this.is_disabled) {
    761         if (evt && evt.type === "mousedown" && !this.results_showing) {
     863      var ref;
     864      if (this.is_disabled) {
     865        return;
     866      }
     867      if (evt && ((ref = evt.type) === 'mousedown' || ref === 'touchstart') && !this.results_showing) {
     868        evt.preventDefault();
     869      }
     870      if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
     871        if (!this.active_field) {
     872          if (this.is_multiple) {
     873            this.search_field.val("");
     874          }
     875          $(this.container[0].ownerDocument).on('click.chosen', this.click_test_action);
     876          this.results_show();
     877        } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
    762878          evt.preventDefault();
    763         }
    764         if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
    765           if (!this.active_field) {
    766             if (this.is_multiple) {
    767               this.search_field.val("");
    768             }
    769             $(this.container[0].ownerDocument).bind('click.chosen', this.click_test_action);
    770             this.results_show();
    771           } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
    772             evt.preventDefault();
    773             this.results_toggle();
    774           }
    775           return this.activate_field();
    776         }
     879          this.results_toggle();
     880        }
     881        return this.activate_field();
    777882      }
    778883    };
     
    805910
    806911    Chosen.prototype.close_field = function() {
    807       $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
     912      $(this.container[0].ownerDocument).off("click.chosen", this.click_test_action);
    808913      this.active_field = false;
    809914      this.results_hide();
     
    811916      this.clear_backstroke();
    812917      this.show_search_field_default();
    813       return this.search_field_scale();
     918      this.search_field_scale();
     919      return this.search_field.blur();
    814920    };
    815921
    816922    Chosen.prototype.activate_field = function() {
     923      if (this.is_disabled) {
     924        return;
     925      }
    817926      this.container.addClass("chosen-container-active");
    818927      this.active_field = true;
     
    837946      if (this.is_multiple) {
    838947        this.search_choices.find("li.search-choice").remove();
    839       } else if (!this.is_multiple) {
     948      } else {
    840949        this.single_set_selected_text();
    841950        if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
     
    8921001      this.results_showing = true;
    8931002      this.search_field.focus();
    894       this.search_field.val(this.search_field.val());
     1003      this.search_field.val(this.get_search_field_value());
    8951004      this.winnow_results();
    8961005      return this.form_field_jq.trigger("chosen:showing_dropdown", {
     
    9241033
    9251034    Chosen.prototype.set_label_behavior = function() {
    926       var _this = this;
    9271035      this.form_field_label = this.form_field_jq.parents("label");
    9281036      if (!this.form_field_label.length && this.form_field.id.length) {
     
    9301038      }
    9311039      if (this.form_field_label.length > 0) {
    932         return this.form_field_label.bind('click.chosen', function(evt) {
    933           if (_this.is_multiple) {
    934             return _this.container_mousedown(evt);
    935           } else {
    936             return _this.activate_field();
    937           }
    938         });
     1040        return this.form_field_label.on('click.chosen', this.label_click_handler);
    9391041      }
    9401042    };
     
    9691071
    9701072    Chosen.prototype.search_results_mouseout = function(evt) {
    971       if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
     1073      if ($(evt.target).hasClass("active-result") || $(evt.target).parents('.active-result').first()) {
    9721074        return this.result_clear_highlight();
    9731075      }
     
    9751077
    9761078    Chosen.prototype.choice_build = function(item) {
    977       var choice, close_link,
    978         _this = this;
     1079      var choice, close_link;
    9791080      choice = $('<li />', {
    9801081        "class": "search-choice"
     
    9871088          'data-option-array-index': item.array_index
    9881089        });
    989         close_link.bind('click.chosen', function(evt) {
    990           return _this.choice_destroy_link_click(evt);
    991         });
     1090        close_link.on('click.chosen', (function(_this) {
     1091          return function(evt) {
     1092            return _this.choice_destroy_link_click(evt);
     1093          };
     1094        })(this));
    9921095        choice.append(close_link);
    9931096      }
     
    10051108    Chosen.prototype.choice_destroy = function(link) {
    10061109      if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
    1007         this.show_search_field_default();
    1008         if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) {
     1110        if (this.active_field) {
     1111          this.search_field.focus();
     1112        } else {
     1113          this.show_search_field_default();
     1114        }
     1115        if (this.is_multiple && this.choices_count() > 0 && this.get_search_field_value().length < 1) {
    10091116          this.results_hide();
    10101117        }
     
    10201127      this.show_search_field_default();
    10211128      this.results_reset_cleanup();
    1022       this.form_field_jq.trigger("change");
     1129      this.trigger_form_field_change();
    10231130      if (this.active_field) {
    10241131        return this.results_hide();
     
    10571164          this.single_set_selected_text(this.choice_label(item));
    10581165        }
    1059         if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
     1166        if (this.is_multiple && (!this.hide_results_on_select || (evt.metaKey || evt.ctrlKey))) {
     1167          if (evt.metaKey || evt.ctrlKey) {
     1168            this.winnow_results({
     1169              skip_highlight: true
     1170            });
     1171          } else {
     1172            this.search_field.val("");
     1173            this.winnow_results();
     1174          }
     1175        } else {
    10601176          this.results_hide();
    1061         }
    1062         this.show_search_field_default();
     1177          this.show_search_field_default();
     1178        }
    10631179        if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
    1064           this.form_field_jq.trigger("change", {
    1065             'selected': this.form_field.options[item.options_index].value
     1180          this.trigger_form_field_change({
     1181            selected: this.form_field.options[item.options_index].value
    10661182          });
    10671183        }
     
    10961212          this.winnow_results();
    10971213        }
    1098         this.form_field_jq.trigger("change", {
     1214        this.trigger_form_field_change({
    10991215          deselected: this.form_field.options[result_data.options_index].value
    11001216        });
     
    11161232    };
    11171233
     1234    Chosen.prototype.get_search_field_value = function() {
     1235      return this.search_field.val();
     1236    };
     1237
    11181238    Chosen.prototype.get_search_text = function() {
    1119       return $('<div/>').text($.trim(this.search_field.val())).html();
     1239      return $.trim(this.get_search_field_value());
     1240    };
     1241
     1242    Chosen.prototype.escape_html = function(text) {
     1243      return $('<div/>').text(text).html();
    11201244    };
    11211245
     
    11311255    Chosen.prototype.no_results = function(terms) {
    11321256      var no_results_html;
    1133       no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
    1134       no_results_html.find("span").first().html(terms);
     1257      no_results_html = this.get_no_results_html(terms);
    11351258      this.search_results.append(no_results_html);
    11361259      return this.form_field_jq.trigger("chosen:no_results", {
     
    11971320    };
    11981321
    1199     Chosen.prototype.keydown_checker = function(evt) {
    1200       var stroke, _ref1;
    1201       stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
    1202       this.search_field_scale();
    1203       if (stroke !== 8 && this.pending_backstroke) {
    1204         this.clear_backstroke();
    1205       }
    1206       switch (stroke) {
    1207         case 8:
    1208           this.backstroke_length = this.search_field.val().length;
    1209           break;
    1210         case 9:
    1211           if (this.results_showing && !this.is_multiple) {
    1212             this.result_select(evt);
    1213           }
    1214           this.mouse_on_container = false;
    1215           break;
    1216         case 13:
    1217           if (this.results_showing) {
    1218             evt.preventDefault();
    1219           }
    1220           break;
    1221         case 32:
    1222           if (this.disable_search) {
    1223             evt.preventDefault();
    1224           }
    1225           break;
    1226         case 38:
    1227           evt.preventDefault();
    1228           this.keyup_arrow();
    1229           break;
    1230         case 40:
    1231           evt.preventDefault();
    1232           this.keydown_arrow();
    1233           break;
    1234       }
    1235     };
    1236 
    12371322    Chosen.prototype.search_field_scale = function() {
    1238       var div, f_width, h, style, style_block, styles, w, _i, _len;
    1239       if (this.is_multiple) {
    1240         h = 0;
    1241         w = 0;
    1242         style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
    1243         styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
    1244         for (_i = 0, _len = styles.length; _i < _len; _i++) {
    1245           style = styles[_i];
    1246           style_block += style + ":" + this.search_field.css(style) + ";";
    1247         }
    1248         div = $('<div />', {
    1249           'style': style_block
    1250         });
    1251         div.text(this.search_field.val());
    1252         $('body').append(div);
    1253         w = div.width() + 25;
    1254         div.remove();
    1255         f_width = this.container.outerWidth();
    1256         if (w > f_width - 10) {
    1257           w = f_width - 10;
    1258         }
    1259         return this.search_field.css({
    1260           'width': w + 'px'
    1261         });
    1262       }
     1323      var div, i, len, style, style_block, styles, width;
     1324      if (!this.is_multiple) {
     1325        return;
     1326      }
     1327      style_block = {
     1328        position: 'absolute',
     1329        left: '-1000px',
     1330        top: '-1000px',
     1331        display: 'none',
     1332        whiteSpace: 'pre'
     1333      };
     1334      styles = ['fontSize', 'fontStyle', 'fontWeight', 'fontFamily', 'lineHeight', 'textTransform', 'letterSpacing'];
     1335      for (i = 0, len = styles.length; i < len; i++) {
     1336        style = styles[i];
     1337        style_block[style] = this.search_field.css(style);
     1338      }
     1339      div = $('<div />').css(style_block);
     1340      div.text(this.get_search_field_value());
     1341      $('body').append(div);
     1342      width = div.width() + 25;
     1343      div.remove();
     1344      if (this.container.is(':visible')) {
     1345        width = Math.min(this.container.outerWidth() - 10, width);
     1346      }
     1347      return this.search_field.width(width);
     1348    };
     1349
     1350    Chosen.prototype.trigger_form_field_change = function(extra) {
     1351      this.form_field_jq.trigger("input", extra);
     1352      return this.form_field_jq.trigger("change", extra);
    12631353    };
    12641354
  • _plugins_/chosen/trunk/lib/chosen/chosen.jquery.min.js

    r98557 r113714  
    1 /* Chosen v1.6.1 | (c) 2011-2016 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
    2 (function(){var a,AbstractChosen,Chosen,SelectParser,b,c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),title:a.title?a.title:void 0,children:0,disabled:a.disabled,classes:a.className}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,title:a.title?a.title:void 0,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,group_label:null!=b?this.parsed[b].label:null,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&amp;"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1},AbstractChosen.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.choice_label=function(a){return this.include_group_label_in_selected&&null!=a.group_label?"<b class='group-name'>"+a.group_label+"</b>"+a.html:a.html},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(a){var b=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return b.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(a){var b=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return b.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f,g,h;for(b="",e=0,h=this.results_data,f=0,g=h.length;g>f&&(c=h[f],d="",d=c.group?this.result_add_group(c):this.result_add_option(c),""!==d&&(e++,b+=d),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(c))),!(e>=this.max_shown_results));f++);return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match&&this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.style.cssText=a.style,c.setAttribute("data-option-array-index",a.array_index),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):""},AbstractChosen.prototype.result_add_group=function(a){var b,c;return(a.search_match||a.group_match)&&a.active_options>0?(b=[],b.push("group-result"),a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):""},AbstractChosen.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing?this.winnow_results():void 0},AbstractChosen.prototype.reset_single_select_options=function(){var a,b,c,d,e;for(d=this.results_data,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.selected?e.push(a.selected=!1):e.push(void 0);return e},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l;for(this.no_results_clear(),d=0,f=this.get_search_text(),a=f.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),i=new RegExp(a,"i"),c=this.get_search_regex(a),l=this.results_data,j=0,k=l.length;k>j;j++)b=l[j],b.search_match=!1,e=null,this.include_option_in_results(b)&&(b.group&&(b.group_match=!1,b.active_options=0),null!=b.group_array_index&&this.results_data[b.group_array_index]&&(e=this.results_data[b.group_array_index],0===e.active_options&&e.search_match&&(d+=1),e.active_options+=1),b.search_text=b.group?b.label:b.html,(!b.group||this.group_search)&&(b.search_match=this.search_string_match(b.search_text,c),b.search_match&&!b.group&&(d+=1),b.search_match?(f.length&&(g=b.search_text.search(i),h=b.search_text.substr(0,g+f.length)+"</em>"+b.search_text.substr(g+f.length),b.search_text=h.substr(0,g)+"<em>"+h.substr(g)),null!=e&&(e.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),1>d&&f.length?(this.update_results_content(""),this.no_results(f)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},AbstractChosen.prototype.get_search_regex=function(a){var b,c;return b=this.search_contains?"":"^",c=this.case_sensitive_search?"":"i",new RegExp(b+a,c)},AbstractChosen.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},AbstractChosen.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},AbstractChosen.prototype.choices_click=function(a){return a.preventDefault(),this.results_showing||this.is_disabled?void 0:this.results_show()},AbstractChosen.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:case 18:break;default:return this.results_search()}},AbstractChosen.prototype.clipboard_event_checker=function(a){var b=this;return setTimeout(function(){return b.results_search()},50)},AbstractChosen.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},AbstractChosen.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},AbstractChosen.prototype.search_results_touchstart=function(a){return this.touch_started=!0,this.search_results_mouseover(a)},AbstractChosen.prototype.search_results_touchmove=function(a){return this.touch_started=!1,this.search_results_mouseout(a)},AbstractChosen.prototype.search_results_touchend=function(a){return this.touch_started?this.search_results_mouseup(a):void 0},AbstractChosen.prototype.outerHTML=function(a){var b;return a.outerHTML?a.outerHTML:(b=document.createElement("div"),b.appendChild(a),b.innerHTML)},AbstractChosen.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent)?!1:!0},AbstractChosen.default_multiple_text="Select Some Options",AbstractChosen.default_single_text="Select an Option",AbstractChosen.default_no_result_text="No results match",AbstractChosen}(),a=jQuery,a.fn.extend({chosen:function(b){return AbstractChosen.browser_is_supported()?this.each(function(c){var d,e;return d=a(this),e=d.data("chosen"),"destroy"===b?void(e instanceof Chosen&&e.destroy()):void(e instanceof Chosen||d.data("chosen",new Chosen(this,b)))}):this}}),Chosen=function(c){function Chosen(){return b=Chosen.__super__.constructor.apply(this,arguments)}return d(Chosen,c),Chosen.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field_jq.hasClass("chosen-rtl")},Chosen.prototype.set_up_html=function(){var b,c;return b=["chosen-container"],b.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&b.push(this.form_field.className),this.is_rtl&&b.push("chosen-rtl"),c={"class":b.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(c.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=a("<div />",c),this.is_multiple?this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'):this.container.html('<a class="chosen-single chosen-default"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},Chosen.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var a=this;return this.container.bind("touchstart.chosen",function(b){return a.container_mousedown(b),b.preventDefault()}),this.container.bind("touchend.chosen",function(b){return a.container_mouseup(b),b.preventDefault()}),this.container.bind("mousedown.chosen",function(b){a.container_mousedown(b)}),this.container.bind("mouseup.chosen",function(b){a.container_mouseup(b)}),this.container.bind("mouseenter.chosen",function(b){a.mouse_enter(b)}),this.container.bind("mouseleave.chosen",function(b){a.mouse_leave(b)}),this.search_results.bind("mouseup.chosen",function(b){a.search_results_mouseup(b)}),this.search_results.bind("mouseover.chosen",function(b){a.search_results_mouseover(b)}),this.search_results.bind("mouseout.chosen",function(b){a.search_results_mouseout(b)}),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",function(b){a.search_results_mousewheel(b)}),this.search_results.bind("touchstart.chosen",function(b){a.search_results_touchstart(b)}),this.search_results.bind("touchmove.chosen",function(b){a.search_results_touchmove(b)}),this.search_results.bind("touchend.chosen",function(b){a.search_results_touchend(b)}),this.form_field_jq.bind("chosen:updated.chosen",function(b){a.results_update_field(b)}),this.form_field_jq.bind("chosen:activate.chosen",function(b){a.activate_field(b)}),this.form_field_jq.bind("chosen:open.chosen",function(b){a.container_mousedown(b)}),this.form_field_jq.bind("chosen:close.chosen",function(b){a.input_blur(b)}),this.search_field.bind("blur.chosen",function(b){a.input_blur(b)}),this.search_field.bind("keyup.chosen",function(b){a.keyup_checker(b)}),this.search_field.bind("keydown.chosen",function(b){a.keydown_checker(b)}),this.search_field.bind("focus.chosen",function(b){a.input_focus(b)}),this.search_field.bind("cut.chosen",function(b){a.clipboard_event_checker(b)}),this.search_field.bind("paste.chosen",function(b){a.clipboard_event_checker(b)}),this.is_multiple?this.search_choices.bind("click.chosen",function(b){a.choices_click(b)}):this.container.bind("click.chosen",function(a){a.preventDefault()})},Chosen.prototype.destroy=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},Chosen.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled?(this.container.addClass("chosen-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_action),this.close_field()):(this.container.removeClass("chosen-disabled"),this.search_field[0].disabled=!1,this.is_multiple?void 0:this.selected_item.bind("focus.chosen",this.activate_action))},Chosen.prototype.container_mousedown=function(b){return this.is_disabled||(b&&"mousedown"===b.type&&!this.results_showing&&b.preventDefault(),null!=b&&a(b.target).hasClass("search-choice-close"))?void 0:(this.active_field?this.is_multiple||!b||a(b.target)[0]!==this.selected_item[0]&&!a(b.target).parents("a.chosen-single").length||(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(this.container[0].ownerDocument).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},Chosen.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},Chosen.prototype.search_results_mousewheel=function(a){var b;return a.originalEvent&&(b=a.originalEvent.deltaY||-a.originalEvent.wheelDelta||a.originalEvent.detail),null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop(b+this.search_results.scrollTop())):void 0},Chosen.prototype.blur_test=function(a){return!this.active_field&&this.container.hasClass("chosen-container-active")?this.close_field():void 0},Chosen.prototype.close_field=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},Chosen.prototype.test_active_click=function(b){var c;return c=a(b.target).closest(".chosen-container"),c.length&&this.container[0]===c[0]?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=SelectParser.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},Chosen.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){if(this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight(),b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(f>c)return this.search_results.scrollTop(c)}},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},Chosen.prototype.update_results_content=function(a){return this.search_results.html(a)},Chosen.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},Chosen.prototype.set_tab_index=function(a){var b;return this.form_field.tabIndex?(b=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=b):void 0},Chosen.prototype.set_label_behavior=function(){var b=this;return this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=a("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0?this.form_field_label.bind("click.chosen",function(a){return b.is_multiple?b.container_mousedown(a):b.activate_field()}):void 0},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},Chosen.prototype.search_results_mouseup=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c.length?(this.result_highlight=c,this.result_select(b),this.search_field.focus()):void 0},Chosen.prototype.search_results_mouseover=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c?this.result_do_highlight(c):void 0},Chosen.prototype.search_results_mouseout=function(b){return a(b.target).hasClass("active-result")?this.result_clear_highlight():void 0},Chosen.prototype.choice_build=function(b){var c,d,e=this;return c=a("<li />",{"class":"search-choice"}).html("<span>"+this.choice_label(b)+"</span>"),b.disabled?c.addClass("search-choice-disabled"):(d=a("<a />",{"class":"search-choice-close","data-option-array-index":b.array_index}),d.bind("click.chosen",function(a){return e.choice_destroy_link_click(a)}),c.append(d)),this.search_container.before(c)},Chosen.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),b.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a(b.target))},Chosen.prototype.choice_destroy=function(a){return this.result_deselect(a[0].getAttribute("data-option-array-index"))?(this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1&&this.results_hide(),a.parents("li").first().remove(),this.search_field_scale()):void 0},Chosen.prototype.results_reset=function(){return this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change"),this.active_field?this.results_hide():void 0},Chosen.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},Chosen.prototype.result_select=function(a){var b,c;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClass("active-result"):this.reset_single_select_options(),b.addClass("result-selected"),c=this.results_data[b[0].getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(this.choice_label(c)),(a.metaKey||a.ctrlKey)&&this.is_multiple||this.results_hide(),this.show_search_field_default(),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[c.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,a.preventDefault(),this.search_field_scale())):void 0},Chosen.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(a)},Chosen.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[b.options_index].value}),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")):void 0},Chosen.prototype.get_search_text=function(){return a("<div/>").text(a.trim(this.search_field.val())).html()},Chosen.prototype.winnow_results_set_highlight=function(){var a,b;return b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first(),null!=a?this.result_do_highlight(a):void 0},Chosen.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},Chosen.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},Chosen.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(a):void 0:this.results_show()},Chosen.prototype.keyup_arrow=function(){var a;return this.results_showing||this.is_multiple?this.result_highlight?(a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},Chosen.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(a=this.search_container.siblings("li.search-choice").last(),a.length&&!a.hasClass("search-choice-disabled")?(this.pending_backstroke=a,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0)},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:this.results_showing&&a.preventDefault();break;case 32:this.disable_search&&a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){for(d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],i=0,j=g.length;j>i;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return b=a("<div />",{style:f}),b.text(this.search_field.val()),a("body").append(b),h=b.width()+25,b.remove(),c=this.container.outerWidth(),h>c-10&&(h=c-10),this.search_field.css({width:h+"px"})}},Chosen}(AbstractChosen)}).call(this);
     1/* Chosen v1.8.7 | (c) 2011-2018 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
     2
     3(function(){var t,e,s,i,n=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function s(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return s.prototype=e.prototype,t.prototype=new s,t.__super__=e.prototype,t},o={}.hasOwnProperty;(i=function(){function t(){this.options_index=0,this.parsed=[]}return t.prototype.add_node=function(t){return"OPTGROUP"===t.nodeName.toUpperCase()?this.add_group(t):this.add_option(t)},t.prototype.add_group=function(t){var e,s,i,n,r,o;for(e=this.parsed.length,this.parsed.push({array_index:e,group:!0,label:t.label,title:t.title?t.title:void 0,children:0,disabled:t.disabled,classes:t.className}),o=[],s=0,i=(r=t.childNodes).length;s<i;s++)n=r[s],o.push(this.add_option(n,e,t.disabled));return o},t.prototype.add_option=function(t,e,s){if("OPTION"===t.nodeName.toUpperCase())return""!==t.text?(null!=e&&(this.parsed[e].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:t.value,text:t.text,html:t.innerHTML,title:t.title?t.title:void 0,selected:t.selected,disabled:!0===s?s:t.disabled,group_array_index:e,group_label:null!=e?this.parsed[e].label:null,classes:t.className,style:t.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},t}()).select_to_array=function(t){var e,s,n,r,o;for(r=new i,s=0,n=(o=t.childNodes).length;s<n;s++)e=o[s],r.add_node(e);return r.parsed},e=function(){function t(e,s){this.form_field=e,this.options=null!=s?s:{},this.label_click_handler=n(this.label_click_handler,this),t.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return t.prototype.set_default_values=function(){return this.click_test_action=function(t){return function(e){return t.test_active_click(e)}}(this),this.activate_action=function(t){return function(e){return t.activate_field(e)}}(this),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.is_rtl=this.options.rtl||/\bchosen-rtl\b/.test(this.form_field.className),this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text&&this.options.allow_single_deselect,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null==this.options.enable_split_word_search||this.options.enable_split_word_search,this.group_search=null==this.options.group_search||this.options.group_search,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null==this.options.single_backstroke_delete||this.options.single_backstroke_delete,this.max_selected_options=this.options.max_selected_options||Infinity,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null==this.options.display_selected_options||this.options.display_selected_options,this.display_disabled_options=null==this.options.display_disabled_options||this.options.display_disabled_options,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1,this.hide_results_on_select=null==this.options.hide_results_on_select||this.options.hide_results_on_select},t.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||t.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||t.default_single_text,this.default_text=this.escape_html(this.default_text),this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||t.default_no_result_text},t.prototype.choice_label=function(t){return this.include_group_label_in_selected&&null!=t.group_label?"<b class='group-name'>"+this.escape_html(t.group_label)+"</b>"+t.html:t.html},t.prototype.mouse_enter=function(){return this.mouse_on_container=!0},t.prototype.mouse_leave=function(){return this.mouse_on_container=!1},t.prototype.input_focus=function(t){if(this.is_multiple){if(!this.active_field)return setTimeout(function(t){return function(){return t.container_mousedown()}}(this),50)}else if(!this.active_field)return this.activate_field()},t.prototype.input_blur=function(t){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(t){return function(){return t.blur_test()}}(this),100)},t.prototype.label_click_handler=function(t){return this.is_multiple?this.container_mousedown(t):this.activate_field()},t.prototype.results_option_build=function(t){var e,s,i,n,r,o,h;for(e="",h=0,n=0,r=(o=this.results_data).length;n<r&&(s=o[n],i="",""!==(i=s.group?this.result_add_group(s):this.result_add_option(s))&&(h++,e+=i),(null!=t?t.first:void 0)&&(s.selected&&this.is_multiple?this.choice_build(s):s.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(s))),!(h>=this.max_shown_results));n++);return e},t.prototype.result_add_option=function(t){var e,s;return t.search_match&&this.include_option_in_results(t)?(e=[],t.disabled||t.selected&&this.is_multiple||e.push("active-result"),!t.disabled||t.selected&&this.is_multiple||e.push("disabled-result"),t.selected&&e.push("result-selected"),null!=t.group_array_index&&e.push("group-option"),""!==t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),t.style&&(s.style.cssText=t.style),s.setAttribute("data-option-array-index",t.array_index),s.innerHTML=t.highlighted_html||t.html,t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.result_add_group=function(t){var e,s;return(t.search_match||t.group_match)&&t.active_options>0?((e=[]).push("group-result"),t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.innerHTML=t.highlighted_html||this.escape_html(t.label),t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},t.prototype.reset_single_select_options=function(){var t,e,s,i,n;for(n=[],t=0,e=(s=this.results_data).length;t<e;t++)(i=s[t]).selected?n.push(i.selected=!1):n.push(void 0);return n},t.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},t.prototype.results_search=function(t){return this.results_showing?this.winnow_results():this.results_show()},t.prototype.winnow_results=function(t){var e,s,i,n,r,o,h,l,c,_,a,u,d,p,f;for(this.no_results_clear(),_=0,e=(h=this.get_search_text()).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),c=this.get_search_regex(e),i=0,n=(l=this.results_data).length;i<n;i++)(r=l[i]).search_match=!1,a=null,u=null,r.highlighted_html="",this.include_option_in_results(r)&&(r.group&&(r.group_match=!1,r.active_options=0),null!=r.group_array_index&&this.results_data[r.group_array_index]&&(0===(a=this.results_data[r.group_array_index]).active_options&&a.search_match&&(_+=1),a.active_options+=1),f=r.group?r.label:r.text,r.group&&!this.group_search||(u=this.search_string_match(f,c),r.search_match=null!=u,r.search_match&&!r.group&&(_+=1),r.search_match?(h.length&&(d=u.index,o=f.slice(0,d),s=f.slice(d,d+h.length),p=f.slice(d+h.length),r.highlighted_html=this.escape_html(o)+"<em>"+this.escape_html(s)+"</em>"+this.escape_html(p)),null!=a&&(a.group_match=!0)):null!=r.group_array_index&&this.results_data[r.group_array_index].search_match&&(r.search_match=!0)));return this.result_clear_highlight(),_<1&&h.length?(this.update_results_content(""),this.no_results(h)):(this.update_results_content(this.results_option_build()),(null!=t?t.skip_highlight:void 0)?void 0:this.winnow_results_set_highlight())},t.prototype.get_search_regex=function(t){var e,s;return s=this.search_contains?t:"(^|\\s|\\b)"+t+"[^\\s]*",this.enable_split_word_search||this.search_contains||(s="^"+s),e=this.case_sensitive_search?"":"i",new RegExp(s,e)},t.prototype.search_string_match=function(t,e){var s;return s=e.exec(t),!this.search_contains&&(null!=s?s[1]:void 0)&&(s.index+=1),s},t.prototype.choices_count=function(){var t,e,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,t=0,e=(s=this.form_field.options).length;t<e;t++)s[t].selected&&(this.selected_option_count+=1);return this.selected_option_count},t.prototype.choices_click=function(t){if(t.preventDefault(),this.activate_field(),!this.results_showing&&!this.is_disabled)return this.results_show()},t.prototype.keydown_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),8!==s&&this.pending_backstroke&&this.clear_backstroke(),s){case 8:this.backstroke_length=this.get_search_field_value().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(t),this.mouse_on_container=!1;break;case 13:case 27:this.results_showing&&t.preventDefault();break;case 32:this.disable_search&&t.preventDefault();break;case 38:t.preventDefault(),this.keyup_arrow();break;case 40:t.preventDefault(),this.keydown_arrow()}},t.prototype.keyup_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),s){case 8:this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:t.preventDefault(),this.results_showing&&this.result_select(t);break;case 27:this.results_showing&&this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}},t.prototype.clipboard_event_checker=function(t){if(!this.is_disabled)return setTimeout(function(t){return function(){return t.results_search()}}(this),50)},t.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},t.prototype.include_option_in_results=function(t){return!(this.is_multiple&&!this.display_selected_options&&t.selected)&&(!(!this.display_disabled_options&&t.disabled)&&!t.empty)},t.prototype.search_results_touchstart=function(t){return this.touch_started=!0,this.search_results_mouseover(t)},t.prototype.search_results_touchmove=function(t){return this.touch_started=!1,this.search_results_mouseout(t)},t.prototype.search_results_touchend=function(t){if(this.touch_started)return this.search_results_mouseup(t)},t.prototype.outerHTML=function(t){var e;return t.outerHTML?t.outerHTML:((e=document.createElement("div")).appendChild(t),e.innerHTML)},t.prototype.get_single_html=function(){return'<a class="chosen-single chosen-default">\n  <span>'+this.default_text+'</span>\n  <div><b></b></div>\n</a>\n<div class="chosen-drop">\n  <div class="chosen-search">\n    <input class="chosen-search-input" type="text" autocomplete="off" />\n  </div>\n  <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_multi_html=function(){return'<ul class="chosen-choices">\n  <li class="search-field">\n    <input class="chosen-search-input" type="text" autocomplete="off" value="'+this.default_text+'" />\n  </li>\n</ul>\n<div class="chosen-drop">\n  <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_no_results_html=function(t){return'<li class="no-results">\n  '+this.results_none_found+" <span>"+this.escape_html(t)+"</span>\n</li>"},t.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:!(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent))},t.default_multiple_text="Select Some Options",t.default_single_text="Select an Option",t.default_no_result_text="No results match",t}(),(t=jQuery).fn.extend({chosen:function(i){return e.browser_is_supported()?this.each(function(e){var n,r;r=(n=t(this)).data("chosen"),"destroy"!==i?r instanceof s||n.data("chosen",new s(this,i)):r instanceof s&&r.destroy()}):this}}),s=function(s){function n(){return n.__super__.constructor.apply(this,arguments)}return r(n,e),n.prototype.setup=function(){return this.form_field_jq=t(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex},n.prototype.set_up_html=function(){var e,s;return(e=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&e.push(this.form_field.className),this.is_rtl&&e.push("chosen-rtl"),s={"class":e.join(" "),title:this.form_field.title},this.form_field.id.length&&(s.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=t("<div />",s),this.container.width(this.container_width()),this.is_multiple?this.container.html(this.get_multi_html()):this.container.html(this.get_single_html()),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},n.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},n.prototype.register_observers=function(){return this.container.on("touchstart.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("touchend.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mousedown.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("mouseup.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mouseenter.chosen",function(t){return function(e){t.mouse_enter(e)}}(this)),this.container.on("mouseleave.chosen",function(t){return function(e){t.mouse_leave(e)}}(this)),this.search_results.on("mouseup.chosen",function(t){return function(e){t.search_results_mouseup(e)}}(this)),this.search_results.on("mouseover.chosen",function(t){return function(e){t.search_results_mouseover(e)}}(this)),this.search_results.on("mouseout.chosen",function(t){return function(e){t.search_results_mouseout(e)}}(this)),this.search_results.on("mousewheel.chosen DOMMouseScroll.chosen",function(t){return function(e){t.search_results_mousewheel(e)}}(this)),this.search_results.on("touchstart.chosen",function(t){return function(e){t.search_results_touchstart(e)}}(this)),this.search_results.on("touchmove.chosen",function(t){return function(e){t.search_results_touchmove(e)}}(this)),this.search_results.on("touchend.chosen",function(t){return function(e){t.search_results_touchend(e)}}(this)),this.form_field_jq.on("chosen:updated.chosen",function(t){return function(e){t.results_update_field(e)}}(this)),this.form_field_jq.on("chosen:activate.chosen",function(t){return function(e){t.activate_field(e)}}(this)),this.form_field_jq.on("chosen:open.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.form_field_jq.on("chosen:close.chosen",function(t){return function(e){t.close_field(e)}}(this)),this.search_field.on("blur.chosen",function(t){return function(e){t.input_blur(e)}}(this)),this.search_field.on("keyup.chosen",function(t){return function(e){t.keyup_checker(e)}}(this)),this.search_field.on("keydown.chosen",function(t){return function(e){t.keydown_checker(e)}}(this)),this.search_field.on("focus.chosen",function(t){return function(e){t.input_focus(e)}}(this)),this.search_field.on("cut.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.search_field.on("paste.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.is_multiple?this.search_choices.on("click.chosen",function(t){return function(e){t.choices_click(e)}}(this)):this.container.on("click.chosen",function(t){t.preventDefault()})},n.prototype.destroy=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.form_field_label.length>0&&this.form_field_label.off("click.chosen"),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},n.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled||this.form_field_jq.parents("fieldset").is(":disabled"),this.container.toggleClass("chosen-disabled",this.is_disabled),this.search_field[0].disabled=this.is_disabled,this.is_multiple||this.selected_item.off("focus.chosen",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.on("focus.chosen",this.activate_field)},n.prototype.container_mousedown=function(e){var s;if(!this.is_disabled)return!e||"mousedown"!==(s=e.type)&&"touchstart"!==s||this.results_showing||e.preventDefault(),null!=e&&t(e.target).hasClass("search-choice-close")?void 0:(this.active_field?this.is_multiple||!e||t(e.target)[0]!==this.selected_item[0]&&!t(e.target).parents("a.chosen-single").length||(e.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),t(this.container[0].ownerDocument).on("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},n.prototype.container_mouseup=function(t){if("ABBR"===t.target.nodeName&&!this.is_disabled)return this.results_reset(t)},n.prototype.search_results_mousewheel=function(t){var e;if(t.originalEvent&&(e=t.originalEvent.deltaY||-t.originalEvent.wheelDelta||t.originalEvent.detail),null!=e)return t.preventDefault(),"DOMMouseScroll"===t.type&&(e*=40),this.search_results.scrollTop(e+this.search_results.scrollTop())},n.prototype.blur_test=function(t){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()},n.prototype.close_field=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()},n.prototype.activate_field=function(){if(!this.is_disabled)return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},n.prototype.test_active_click=function(e){var s;return(s=t(e.target).closest(".chosen-container")).length&&this.container[0]===s[0]?this.active_field=!0:this.close_field()},n.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=i.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},n.prototype.result_do_highlight=function(t){var e,s,i,n,r;if(t.length){if(this.result_clear_highlight(),this.result_highlight=t,this.result_highlight.addClass("highlighted"),i=parseInt(this.search_results.css("maxHeight"),10),r=this.search_results.scrollTop(),n=i+r,s=this.result_highlight.position().top+this.search_results.scrollTop(),(e=s+this.result_highlight.outerHeight())>=n)return this.search_results.scrollTop(e-i>0?e-i:0);if(s<r)return this.search_results.scrollTop(s)}},n.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},n.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.get_search_field_value()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},n.prototype.update_results_content=function(t){return this.search_results.html(t)},n.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},n.prototype.set_tab_index=function(t){var e;if(this.form_field.tabIndex)return e=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=e},n.prototype.set_label_behavior=function(){if(this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=t("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0)return this.form_field_label.on("click.chosen",this.label_click_handler)},n.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},n.prototype.search_results_mouseup=function(e){var s;if((s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first()).length)return this.result_highlight=s,this.result_select(e),this.search_field.focus()},n.prototype.search_results_mouseover=function(e){var s;if(s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first())return this.result_do_highlight(s)},n.prototype.search_results_mouseout=function(e){if(t(e.target).hasClass("active-result")||t(e.target).parents(".active-result").first())return this.result_clear_highlight()},n.prototype.choice_build=function(e){var s,i;return s=t("<li />",{"class":"search-choice"}).html("<span>"+this.choice_label(e)+"</span>"),e.disabled?s.addClass("search-choice-disabled"):((i=t("<a />",{"class":"search-choice-close","data-option-array-index":e.array_index})).on("click.chosen",function(t){return function(e){return t.choice_destroy_link_click(e)}}(this)),s.append(i)),this.search_container.before(s)},n.prototype.choice_destroy_link_click=function(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(t(e.target))},n.prototype.choice_destroy=function(t){if(this.result_deselect(t[0].getAttribute("data-option-array-index")))return this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.get_search_field_value().length<1&&this.results_hide(),t.parents("li").first().remove(),this.search_field_scale()},n.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field)return this.results_hide()},n.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},n.prototype.result_select=function(t){var e,s;if(this.result_highlight)return e=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?e.removeClass("active-result"):this.reset_single_select_options(),e.addClass("result-selected"),s=this.results_data[e[0].getAttribute("data-option-array-index")],s.selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(s):this.single_set_selected_text(this.choice_label(s)),this.is_multiple&&(!this.hide_results_on_select||t.metaKey||t.ctrlKey)?t.metaKey||t.ctrlKey?this.winnow_results({skip_highlight:!0}):(this.search_field.val(""),this.winnow_results()):(this.results_hide(),this.show_search_field_default()),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.trigger_form_field_change({selected:this.form_field.options[s.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,t.preventDefault(),this.search_field_scale())},n.prototype.single_set_selected_text=function(t){return null==t&&(t=this.default_text),t===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(t)},n.prototype.result_deselect=function(t){var e;return e=this.results_data[t],!this.form_field.options[e.options_index].disabled&&(e.selected=!1,this.form_field.options[e.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.trigger_form_field_change({deselected:this.form_field.options[e.options_index].value}),this.search_field_scale(),!0)},n.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")},n.prototype.get_search_field_value=function(){return this.search_field.val()},n.prototype.get_search_text=function(){return t.trim(this.get_search_field_value())},n.prototype.escape_html=function(e){return t("<div/>").text(e).html()},n.prototype.winnow_results_set_highlight=function(){var t,e;if(e=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),null!=(t=e.length?e.first():this.search_results.find(".active-result").first()))return this.result_do_highlight(t)},n.prototype.no_results=function(t){var e;return e=this.get_no_results_html(t),this.search_results.append(e),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},n.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},n.prototype.keydown_arrow=function(){var t;return this.results_showing&&this.result_highlight?(t=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(t):void 0:this.results_show()},n.prototype.keyup_arrow=function(){var t;return this.results_showing||this.is_multiple?this.result_highlight?(t=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(t.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()},n.prototype.keydown_backstroke=function(){var t;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(t=this.search_container.siblings("li.search-choice").last()).length&&!t.hasClass("search-choice-disabled")?(this.pending_backstroke=t,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},n.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},n.prototype.search_field_scale=function(){var e,s,i,n,r,o,h;if(this.is_multiple){for(r={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},s=0,i=(o=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"]).length;s<i;s++)r[n=o[s]]=this.search_field.css(n);return(e=t("<div />").css(r)).text(this.get_search_field_value()),t("body").append(e),h=e.width()+25,e.remove(),this.container.is(":visible")&&(h=Math.min(this.container.outerWidth()-10,h)),this.search_field.width(h)}},n.prototype.trigger_form_field_change=function(t){return this.form_field_jq.trigger("input",t),this.form_field_jq.trigger("change",t)},n}()}).call(this);
  • _plugins_/chosen/trunk/lib/chosen/chosen.min.css

    r98557 r113714  
    1 /* Chosen v1.6.1 | (c) 2011-2016 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
     1/*!
     2Chosen, a Select Box Enhancer for jQuery and Prototype
     3by Patrick Filler for Harvest, http://getharvest.com
    24
    3 .chosen-container{position:relative;display:inline-block;vertical-align:middle;font-size:13px;-webkit-user-select:none;-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;width:100%;border:1px solid #aaa;border-top:0;background:#fff;box-shadow:0 4px 5px rgba(0,0,0,.15)}.chosen-container.chosen-with-drop .chosen-drop{left:0}.chosen-container a{cursor:pointer}.chosen-container .search-choice .group-name,.chosen-container .chosen-single .group-name{margin-right:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:400;color:#999}.chosen-container .search-choice .group-name:after,.chosen-container .chosen-single .group-name:after{content:":";padding-left:2px;vertical-align:top}.chosen-container-single .chosen-single{position:relative;display:block;overflow:hidden;padding:0 0 0 8px;height:25px;border:1px solid #aaa;border-radius:5px;background-color:#fff;background:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#fff),color-stop(50%,#f6f6f6),color-stop(52%,#eee),color-stop(100%,#f4f4f4));background:-webkit-linear-gradient(#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:-moz-linear-gradient(#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:-o-linear-gradient(#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:linear-gradient(#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background-clip:padding-box;box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);color:#444;text-decoration:none;white-space:nowrap;line-height:24px}.chosen-container-single .chosen-default{color:#999}.chosen-container-single .chosen-single span{display:block;overflow:hidden;margin-right:26px;text-overflow:ellipsis;white-space:nowrap}.chosen-container-single .chosen-single-with-deselect span{margin-right:38px}.chosen-container-single .chosen-single abbr{position:absolute;top:6px;right:26px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-single .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single.chosen-disabled .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single .chosen-single div{position:absolute;top:0;right:0;display:block;width:18px;height:100%}.chosen-container-single .chosen-single div b{display:block;width:100%;height:100%;background:url(chosen-sprite.png) no-repeat 0 2px}.chosen-container-single .chosen-search{position:relative;z-index:1010;margin:0;padding:3px 4px;white-space:nowrap}.chosen-container-single .chosen-search input[type=text]{margin:1px 0;padding:4px 20px 4px 5px;width:100%;height:auto;outline:0;border:1px solid #aaa;background:#fff url(chosen-sprite.png) no-repeat 100% -20px;background:url(chosen-sprite.png) no-repeat 100% -20px;font-size:1em;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-single .chosen-drop{margin-top:-1px;border-radius:0 0 4px 4px;background-clip:padding-box}.chosen-container-single.chosen-container-single-nosearch .chosen-search{position:absolute;left:-9999px}.chosen-container .chosen-results{color:#444;position:relative;overflow-x:hidden;overflow-y:auto;margin:0 4px 4px 0;padding:0 0 0 4px;max-height:240px;-webkit-overflow-scrolling:touch}.chosen-container .chosen-results li{display:none;margin:0;padding:5px 6px;list-style:none;line-height:15px;word-wrap:break-word;-webkit-touch-callout:none}.chosen-container .chosen-results li.active-result{display:list-item;cursor:pointer}.chosen-container .chosen-results li.disabled-result{display:list-item;color:#ccc;cursor:default}.chosen-container .chosen-results li.highlighted{background-color:#3875d7;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#3875d7),color-stop(90%,#2a62bc));background-image:-webkit-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:-moz-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:-o-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:linear-gradient(#3875d7 20%,#2a62bc 90%);color:#fff}.chosen-container .chosen-results li.no-results{color:#777;display:list-item;background:#f4f4f4}.chosen-container .chosen-results li.group-result{display:list-item;font-weight:700;cursor:default}.chosen-container .chosen-results li.group-option{padding-left:15px}.chosen-container .chosen-results li em{font-style:normal;text-decoration:underline}.chosen-container-multi .chosen-choices{position:relative;overflow:hidden;margin:0;padding:0 5px;width:100%;height:auto;border:1px solid #aaa;background-color:#fff;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(1%,#eee),color-stop(15%,#fff));background-image:-webkit-linear-gradient(#eee 1%,#fff 15%);background-image:-moz-linear-gradient(#eee 1%,#fff 15%);background-image:-o-linear-gradient(#eee 1%,#fff 15%);background-image:linear-gradient(#eee 1%,#fff 15%);cursor:text}.chosen-container-multi .chosen-choices li{float:left;list-style:none}.chosen-container-multi .chosen-choices li.search-field{margin:0;padding:0;white-space:nowrap}.chosen-container-multi .chosen-choices li.search-field input[type=text]{margin:1px 0;padding:0;height:25px;outline:0;border:0!important;background:transparent!important;box-shadow:none;color:#999;font-size:100%;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-multi .chosen-choices li.search-choice{position:relative;margin:3px 5px 3px 0;padding:3px 20px 3px 5px;border:1px solid #aaa;max-width:100%;border-radius:3px;background-color:#eee;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),color-stop(100%,#eee));background-image:-webkit-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-moz-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-o-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-size:100% 19px;background-repeat:repeat-x;background-clip:padding-box;box-shadow:0 0 2px #fff inset,0 1px 0 rgba(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;right:3px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover{background-position:-42px -10px}.chosen-container-multi .chosen-choices li.search-choice-disabled{padding-right:5px;border:1px solid #ccc;background-color:#e4e4e4;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),color-stop(100%,#eee));background-image:-webkit-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-moz-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-o-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);color:#666}.chosen-container-multi .chosen-choices li.search-choice-focus{background:#d4d4d4}.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close{background-position:-42px -10px}.chosen-container-multi .chosen-results{margin:0;padding:0}.chosen-container-multi .chosen-drop .result-selected{display:list-item;color:#ccc;cursor:default}.chosen-container-active .chosen-single{border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active.chosen-with-drop .chosen-single{border:1px solid #aaa;-moz-border-radius-bottomright:0;border-bottom-right-radius:0;-moz-border-radius-bottomleft:0;border-bottom-left-radius:0;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#eee),color-stop(80%,#fff));background-image:-webkit-linear-gradient(#eee 20%,#fff 80%);background-image:-moz-linear-gradient(#eee 20%,#fff 80%);background-image:-o-linear-gradient(#eee 20%,#fff 80%);background-image:linear-gradient(#eee 20%,#fff 80%);box-shadow:0 1px 0 #fff inset}.chosen-container-active.chosen-with-drop .chosen-single div{border-left:0;background:transparent}.chosen-container-active.chosen-with-drop .chosen-single div b{background-position:-18px 2px}.chosen-container-active .chosen-choices{border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active .chosen-choices li.search-field input[type=text]{color:#222!important}.chosen-disabled{opacity:.5!important;cursor:default}.chosen-disabled .chosen-single{cursor:default}.chosen-disabled .chosen-choices .search-choice .search-choice-close{cursor:default}.chosen-rtl{text-align:right}.chosen-rtl .chosen-single{overflow:visible;padding:0 8px 0 0}.chosen-rtl .chosen-single span{margin-right:0;margin-left:26px;direction:rtl}.chosen-rtl .chosen-single-with-deselect span{margin-left:38px}.chosen-rtl .chosen-single div{right:auto;left:3px}.chosen-rtl .chosen-single abbr{right:auto;left:26px}.chosen-rtl .chosen-choices li{float:right}.chosen-rtl .chosen-choices li.search-field input[type=text]{direction:rtl}.chosen-rtl .chosen-choices li.search-choice{margin:3px 5px 3px 0;padding:3px 5px 3px 19px}.chosen-rtl .chosen-choices li.search-choice .search-choice-close{right:auto;left:4px}.chosen-rtl.chosen-container-single-nosearch .chosen-search,.chosen-rtl .chosen-drop{left:9999px}.chosen-rtl.chosen-container-single .chosen-results{margin:0 0 4px 4px;padding:0 4px 0 0}.chosen-rtl .chosen-results li.group-option{padding-right:15px;padding-left:0}.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div{border-right:0}.chosen-rtl .chosen-search input[type=text]{padding:4px 5px 4px 20px;background:#fff url(chosen-sprite.png) no-repeat -30px -20px;background:url(chosen-sprite.png) no-repeat -30px -20px;direction:rtl}.chosen-rtl.chosen-container-single .chosen-single div b{background-position:6px 2px}.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b{background-position:-12px 2px}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min-resolution:144dpi),only screen and (min-resolution:1.5dppx){.chosen-rtl .chosen-search input[type=text],.chosen-container-single .chosen-single abbr,.chosen-container-single .chosen-single div b,.chosen-container-single .chosen-search input[type=text],.chosen-container-multi .chosen-choices .search-choice .search-choice-close,.chosen-container .chosen-results-scroll-down span,.chosen-container .chosen-results-scroll-up span{background-image:url(chosen-sprite@2x.png)!important;background-size:52px 37px!important;background-repeat:no-repeat!important}}
     5Version 1.8.7
     6Full source at https://github.com/harvesthq/chosen
     7Copyright (c) 2011-2018 Harvest http://getharvest.com
     8
     9MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
     10This file is generated by `grunt build`, do not edit it by hand.
     11*/.chosen-container{position:relative;display:inline-block;vertical-align:middle;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.chosen-container *{-webkit-box-sizing:border-box;box-sizing:border-box}.chosen-container .chosen-drop{position:absolute;top:100%;z-index:1010;width:100%;border:1px solid #aaa;border-top:0;background:#fff;-webkit-box-shadow:0 4px 5px rgba(0,0,0,.15);box-shadow:0 4px 5px rgba(0,0,0,.15);clip:rect(0,0,0,0);-webkit-clip-path:inset(100% 100%);clip-path:inset(100% 100%)}.chosen-container.chosen-with-drop .chosen-drop{clip:auto;-webkit-clip-path:none;clip-path:none}.chosen-container a{cursor:pointer}.chosen-container .chosen-single .group-name,.chosen-container .search-choice .group-name{margin-right:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:400;color:#999}.chosen-container .chosen-single .group-name:after,.chosen-container .search-choice .group-name:after{content:":";padding-left:2px;vertical-align:top}.chosen-container-single .chosen-single{position:relative;display:block;overflow:hidden;padding:0 0 0 8px;height:25px;border:1px solid #aaa;border-radius:5px;background-color:#fff;background:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#fff),color-stop(50%,#f6f6f6),color-stop(52%,#eee),to(#f4f4f4));background:linear-gradient(#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background-clip:padding-box;-webkit-box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);color:#444;text-decoration:none;white-space:nowrap;line-height:24px}.chosen-container-single .chosen-default{color:#999}.chosen-container-single .chosen-single span{display:block;overflow:hidden;margin-right:26px;text-overflow:ellipsis;white-space:nowrap}.chosen-container-single .chosen-single-with-deselect span{margin-right:38px}.chosen-container-single .chosen-single abbr{position:absolute;top:6px;right:26px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-single .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single.chosen-disabled .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single .chosen-single div{position:absolute;top:0;right:0;display:block;width:18px;height:100%}.chosen-container-single .chosen-single div b{display:block;width:100%;height:100%;background:url(chosen-sprite.png) no-repeat 0 2px}.chosen-container-single .chosen-search{position:relative;z-index:1010;margin:0;padding:3px 4px;white-space:nowrap}.chosen-container-single .chosen-search input[type=text]{margin:1px 0;padding:4px 20px 4px 5px;width:100%;height:auto;outline:0;border:1px solid #aaa;background:url(chosen-sprite.png) no-repeat 100% -20px;font-size:1em;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-single .chosen-drop{margin-top:-1px;border-radius:0 0 4px 4px;background-clip:padding-box}.chosen-container-single.chosen-container-single-nosearch .chosen-search{position:absolute;clip:rect(0,0,0,0);-webkit-clip-path:inset(100% 100%);clip-path:inset(100% 100%)}.chosen-container .chosen-results{color:#444;position:relative;overflow-x:hidden;overflow-y:auto;margin:0 4px 4px 0;padding:0 0 0 4px;max-height:240px;-webkit-overflow-scrolling:touch}.chosen-container .chosen-results li{display:none;margin:0;padding:5px 6px;list-style:none;line-height:15px;word-wrap:break-word;-webkit-touch-callout:none}.chosen-container .chosen-results li.active-result{display:list-item;cursor:pointer}.chosen-container .chosen-results li.disabled-result{display:list-item;color:#ccc;cursor:default}.chosen-container .chosen-results li.highlighted{background-color:#3875d7;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#3875d7),color-stop(90%,#2a62bc));background-image:linear-gradient(#3875d7 20%,#2a62bc 90%);color:#fff}.chosen-container .chosen-results li.no-results{color:#777;display:list-item;background:#f4f4f4}.chosen-container .chosen-results li.group-result{display:list-item;font-weight:700;cursor:default}.chosen-container .chosen-results li.group-option{padding-left:15px}.chosen-container .chosen-results li em{font-style:normal;text-decoration:underline}.chosen-container-multi .chosen-choices{position:relative;overflow:hidden;margin:0;padding:0 5px;width:100%;height:auto;border:1px solid #aaa;background-color:#fff;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(1%,#eee),color-stop(15%,#fff));background-image:linear-gradient(#eee 1%,#fff 15%);cursor:text}.chosen-container-multi .chosen-choices li{float:left;list-style:none}.chosen-container-multi .chosen-choices li.search-field{margin:0;padding:0;white-space:nowrap}.chosen-container-multi .chosen-choices li.search-field input[type=text]{margin:1px 0;padding:0;height:25px;outline:0;border:0!important;background:0 0!important;-webkit-box-shadow:none;box-shadow:none;color:#999;font-size:100%;font-family:sans-serif;line-height:normal;border-radius:0;width:25px}.chosen-container-multi .chosen-choices li.search-choice{position:relative;margin:3px 5px 3px 0;padding:3px 20px 3px 5px;border:1px solid #aaa;max-width:100%;border-radius:3px;background-color:#eee;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),to(#eee));background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-size:100% 19px;background-repeat:repeat-x;background-clip:padding-box;-webkit-box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);box-shadow:0 0 2px #fff inset,0 1px 0 rgba(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;right:3px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover{background-position:-42px -10px}.chosen-container-multi .chosen-choices li.search-choice-disabled{padding-right:5px;border:1px solid #ccc;background-color:#e4e4e4;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),to(#eee));background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);color:#666}.chosen-container-multi .chosen-choices li.search-choice-focus{background:#d4d4d4}.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close{background-position:-42px -10px}.chosen-container-multi .chosen-results{margin:0;padding:0}.chosen-container-multi .chosen-drop .result-selected{display:list-item;color:#ccc;cursor:default}.chosen-container-active .chosen-single{border:1px solid #5897fb;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active.chosen-with-drop .chosen-single{border:1px solid #aaa;border-bottom-right-radius:0;border-bottom-left-radius:0;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#eee),color-stop(80%,#fff));background-image:linear-gradient(#eee 20%,#fff 80%);-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset}.chosen-container-active.chosen-with-drop .chosen-single div{border-left:none;background:0 0}.chosen-container-active.chosen-with-drop .chosen-single div b{background-position:-18px 2px}.chosen-container-active .chosen-choices{border:1px solid #5897fb;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active .chosen-choices li.search-field input[type=text]{color:#222!important}.chosen-disabled{opacity:.5!important;cursor:default}.chosen-disabled .chosen-single{cursor:default}.chosen-disabled .chosen-choices .search-choice .search-choice-close{cursor:default}.chosen-rtl{text-align:right}.chosen-rtl .chosen-single{overflow:visible;padding:0 8px 0 0}.chosen-rtl .chosen-single span{margin-right:0;margin-left:26px;direction:rtl}.chosen-rtl .chosen-single-with-deselect span{margin-left:38px}.chosen-rtl .chosen-single div{right:auto;left:3px}.chosen-rtl .chosen-single abbr{right:auto;left:26px}.chosen-rtl .chosen-choices li{float:right}.chosen-rtl .chosen-choices li.search-field input[type=text]{direction:rtl}.chosen-rtl .chosen-choices li.search-choice{margin:3px 5px 3px 0;padding:3px 5px 3px 19px}.chosen-rtl .chosen-choices li.search-choice .search-choice-close{right:auto;left:4px}.chosen-rtl.chosen-container-single .chosen-results{margin:0 0 4px 4px;padding:0 4px 0 0}.chosen-rtl .chosen-results li.group-option{padding-right:15px;padding-left:0}.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div{border-right:none}.chosen-rtl .chosen-search input[type=text]{padding:4px 5px 4px 20px;background:url(chosen-sprite.png) no-repeat -30px -20px;direction:rtl}.chosen-rtl.chosen-container-single .chosen-single div b{background-position:6px 2px}.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b{background-position:-12px 2px}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min-resolution:144dpi),only screen and (min-resolution:1.5dppx){.chosen-container .chosen-results-scroll-down span,.chosen-container .chosen-results-scroll-up span,.chosen-container-multi .chosen-choices .search-choice .search-choice-close,.chosen-container-single .chosen-search input[type=text],.chosen-container-single .chosen-single abbr,.chosen-container-single .chosen-single div b,.chosen-rtl .chosen-search input[type=text]{background-image:url(chosen-sprite@2x.png)!important;background-size:52px 37px!important;background-repeat:no-repeat!important}}
  • _plugins_/chosen/trunk/lib/chosen/chosen.proto.js

    r98557 r113714  
    33by Patrick Filler for Harvest, http://getharvest.com
    44
    5 Version 1.6.1
     5Version 1.8.7
    66Full source at https://github.com/harvesthq/chosen
    7 Copyright (c) 2011-2016 Harvest http://getharvest.com
     7Copyright (c) 2011-2018 Harvest http://getharvest.com
    88
    99MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
     
    1212
    1313(function() {
    14   var AbstractChosen, SelectParser, _ref,
    15     __hasProp = {}.hasOwnProperty,
    16     __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; };
     14  var AbstractChosen, SelectParser,
     15    bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
     16    extend = 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; },
     17    hasProp = {}.hasOwnProperty;
    1718
    1819  SelectParser = (function() {
     
    3132
    3233    SelectParser.prototype.add_group = function(group) {
    33       var group_position, option, _i, _len, _ref, _results;
     34      var group_position, i, len, option, ref, results1;
    3435      group_position = this.parsed.length;
    3536      this.parsed.push({
    3637        array_index: group_position,
    3738        group: true,
    38         label: this.escapeExpression(group.label),
     39        label: group.label,
    3940        title: group.title ? group.title : void 0,
    4041        children: 0,
     
    4243        classes: group.className
    4344      });
    44       _ref = group.childNodes;
    45       _results = [];
    46       for (_i = 0, _len = _ref.length; _i < _len; _i++) {
    47         option = _ref[_i];
    48         _results.push(this.add_option(option, group_position, group.disabled));
    49       }
    50       return _results;
     45      ref = group.childNodes;
     46      results1 = [];
     47      for (i = 0, len = ref.length; i < len; i++) {
     48        option = ref[i];
     49        results1.push(this.add_option(option, group_position, group.disabled));
     50      }
     51      return results1;
    5152    };
    5253
     
    8283    };
    8384
    84     SelectParser.prototype.escapeExpression = function(text) {
    85       var map, unsafe_chars;
    86       if ((text == null) || text === false) {
    87         return "";
    88       }
    89       if (!/[\&\<\>\"\'\`]/.test(text)) {
    90         return text;
    91       }
    92       map = {
    93         "<": "&lt;",
    94         ">": "&gt;",
    95         '"': "&quot;",
    96         "'": "&#x27;",
    97         "`": "&#x60;"
    98       };
    99       unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
    100       return text.replace(unsafe_chars, function(chr) {
    101         return map[chr] || "&amp;";
    102       });
    103     };
    104 
    10585    return SelectParser;
    10686
     
    10888
    10989  SelectParser.select_to_array = function(select) {
    110     var child, parser, _i, _len, _ref;
     90    var child, i, len, parser, ref;
    11191    parser = new SelectParser();
    112     _ref = select.childNodes;
    113     for (_i = 0, _len = _ref.length; _i < _len; _i++) {
    114       child = _ref[_i];
     92    ref = select.childNodes;
     93    for (i = 0, len = ref.length; i < len; i++) {
     94      child = ref[i];
    11595      parser.add_node(child);
    11696    }
     
    11999
    120100  AbstractChosen = (function() {
    121     function AbstractChosen(form_field, options) {
     101    function AbstractChosen(form_field, options1) {
    122102      this.form_field = form_field;
    123       this.options = options != null ? options : {};
     103      this.options = options1 != null ? options1 : {};
     104      this.label_click_handler = bind(this.label_click_handler, this);
    124105      if (!AbstractChosen.browser_is_supported()) {
    125106        return;
     
    135116
    136117    AbstractChosen.prototype.set_default_values = function() {
    137       var _this = this;
    138       this.click_test_action = function(evt) {
    139         return _this.test_active_click(evt);
    140       };
    141       this.activate_action = function(evt) {
    142         return _this.activate_field(evt);
    143       };
     118      this.click_test_action = (function(_this) {
     119        return function(evt) {
     120          return _this.test_active_click(evt);
     121        };
     122      })(this);
     123      this.activate_action = (function(_this) {
     124        return function(evt) {
     125          return _this.activate_field(evt);
     126        };
     127      })(this);
    144128      this.active_field = false;
    145129      this.mouse_on_container = false;
    146130      this.results_showing = false;
    147131      this.result_highlighted = null;
     132      this.is_rtl = this.options.rtl || /\bchosen-rtl\b/.test(this.form_field.className);
    148133      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;
    149134      this.disable_search_threshold = this.options.disable_search_threshold || 0;
     
    159144      this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
    160145      this.max_shown_results = this.options.max_shown_results || Number.POSITIVE_INFINITY;
    161       return this.case_sensitive_search = this.options.case_sensitive_search || false;
     146      this.case_sensitive_search = this.options.case_sensitive_search || false;
     147      return this.hide_results_on_select = this.options.hide_results_on_select != null ? this.options.hide_results_on_select : true;
    162148    };
    163149
     
    170156        this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
    171157      }
     158      this.default_text = this.escape_html(this.default_text);
    172159      return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
    173160    };
     
    175162    AbstractChosen.prototype.choice_label = function(item) {
    176163      if (this.include_group_label_in_selected && (item.group_label != null)) {
    177         return "<b class='group-name'>" + item.group_label + "</b>" + item.html;
     164        return "<b class='group-name'>" + (this.escape_html(item.group_label)) + "</b>" + item.html;
    178165      } else {
    179166        return item.html;
     
    190177
    191178    AbstractChosen.prototype.input_focus = function(evt) {
    192       var _this = this;
    193179      if (this.is_multiple) {
    194180        if (!this.active_field) {
    195           return setTimeout((function() {
    196             return _this.container_mousedown();
    197           }), 50);
     181          return setTimeout(((function(_this) {
     182            return function() {
     183              return _this.container_mousedown();
     184            };
     185          })(this)), 50);
    198186        }
    199187      } else {
     
    205193
    206194    AbstractChosen.prototype.input_blur = function(evt) {
    207       var _this = this;
    208195      if (!this.mouse_on_container) {
    209196        this.active_field = false;
    210         return setTimeout((function() {
    211           return _this.blur_test();
    212         }), 100);
     197        return setTimeout(((function(_this) {
     198          return function() {
     199            return _this.blur_test();
     200          };
     201        })(this)), 100);
     202      }
     203    };
     204
     205    AbstractChosen.prototype.label_click_handler = function(evt) {
     206      if (this.is_multiple) {
     207        return this.container_mousedown(evt);
     208      } else {
     209        return this.activate_field();
    213210      }
    214211    };
    215212
    216213    AbstractChosen.prototype.results_option_build = function(options) {
    217       var content, data, data_content, shown_results, _i, _len, _ref;
     214      var content, data, data_content, i, len, ref, shown_results;
    218215      content = '';
    219216      shown_results = 0;
    220       _ref = this.results_data;
    221       for (_i = 0, _len = _ref.length; _i < _len; _i++) {
    222         data = _ref[_i];
     217      ref = this.results_data;
     218      for (i = 0, len = ref.length; i < len; i++) {
     219        data = ref[i];
    223220        data_content = '';
    224221        if (data.group) {
     
    271268      option_el = document.createElement("li");
    272269      option_el.className = classes.join(" ");
    273       option_el.style.cssText = option.style;
     270      if (option.style) {
     271        option_el.style.cssText = option.style;
     272      }
    274273      option_el.setAttribute("data-option-array-index", option.array_index);
    275       option_el.innerHTML = option.search_text;
     274      option_el.innerHTML = option.highlighted_html || option.html;
    276275      if (option.title) {
    277276        option_el.title = option.title;
     
    295294      group_el = document.createElement("li");
    296295      group_el.className = classes.join(" ");
    297       group_el.innerHTML = group.search_text;
     296      group_el.innerHTML = group.highlighted_html || this.escape_html(group.label);
    298297      if (group.title) {
    299298        group_el.title = group.title;
     
    315314
    316315    AbstractChosen.prototype.reset_single_select_options = function() {
    317       var result, _i, _len, _ref, _results;
    318       _ref = this.results_data;
    319       _results = [];
    320       for (_i = 0, _len = _ref.length; _i < _len; _i++) {
    321         result = _ref[_i];
     316      var i, len, ref, result, results1;
     317      ref = this.results_data;
     318      results1 = [];
     319      for (i = 0, len = ref.length; i < len; i++) {
     320        result = ref[i];
    322321        if (result.selected) {
    323           _results.push(result.selected = false);
     322          results1.push(result.selected = false);
    324323        } else {
    325           _results.push(void 0);
    326         }
    327       }
    328       return _results;
     324          results1.push(void 0);
     325        }
     326      }
     327      return results1;
    329328    };
    330329
     
    345344    };
    346345
    347     AbstractChosen.prototype.winnow_results = function() {
    348       var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
     346    AbstractChosen.prototype.winnow_results = function(options) {
     347      var escapedQuery, fix, i, len, option, prefix, query, ref, regex, results, results_group, search_match, startpos, suffix, text;
    349348      this.no_results_clear();
    350349      results = 0;
    351       searchText = this.get_search_text();
    352       escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
    353       zregex = new RegExp(escapedSearchText, 'i');
    354       regex = this.get_search_regex(escapedSearchText);
    355       _ref = this.results_data;
    356       for (_i = 0, _len = _ref.length; _i < _len; _i++) {
    357         option = _ref[_i];
     350      query = this.get_search_text();
     351      escapedQuery = query.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
     352      regex = this.get_search_regex(escapedQuery);
     353      ref = this.results_data;
     354      for (i = 0, len = ref.length; i < len; i++) {
     355        option = ref[i];
    358356        option.search_match = false;
    359357        results_group = null;
     358        search_match = null;
     359        option.highlighted_html = '';
    360360        if (this.include_option_in_results(option)) {
    361361          if (option.group) {
     
    370370            results_group.active_options += 1;
    371371          }
    372           option.search_text = option.group ? option.label : option.html;
     372          text = option.group ? option.label : option.text;
    373373          if (!(option.group && !this.group_search)) {
    374             option.search_match = this.search_string_match(option.search_text, regex);
     374            search_match = this.search_string_match(text, regex);
     375            option.search_match = search_match != null;
    375376            if (option.search_match && !option.group) {
    376377              results += 1;
    377378            }
    378379            if (option.search_match) {
    379               if (searchText.length) {
    380                 startpos = option.search_text.search(zregex);
    381                 text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
    382                 option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
     380              if (query.length) {
     381                startpos = search_match.index;
     382                prefix = text.slice(0, startpos);
     383                fix = text.slice(startpos, startpos + query.length);
     384                suffix = text.slice(startpos + query.length);
     385                option.highlighted_html = (this.escape_html(prefix)) + "<em>" + (this.escape_html(fix)) + "</em>" + (this.escape_html(suffix));
    383386              }
    384387              if (results_group != null) {
     
    392395      }
    393396      this.result_clear_highlight();
    394       if (results < 1 && searchText.length) {
     397      if (results < 1 && query.length) {
    395398        this.update_results_content("");
    396         return this.no_results(searchText);
     399        return this.no_results(query);
    397400      } else {
    398401        this.update_results_content(this.results_option_build());
    399         return this.winnow_results_set_highlight();
     402        if (!(options != null ? options.skip_highlight : void 0)) {
     403          return this.winnow_results_set_highlight();
     404        }
    400405      }
    401406    };
    402407
    403408    AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
    404       var regex_anchor, regex_flag;
    405       regex_anchor = this.search_contains ? "" : "^";
     409      var regex_flag, regex_string;
     410      regex_string = this.search_contains ? escaped_search_string : "(^|\\s|\\b)" + escaped_search_string + "[^\\s]*";
     411      if (!(this.enable_split_word_search || this.search_contains)) {
     412        regex_string = "^" + regex_string;
     413      }
    406414      regex_flag = this.case_sensitive_search ? "" : "i";
    407       return new RegExp(regex_anchor + escaped_search_string, regex_flag);
     415      return new RegExp(regex_string, regex_flag);
    408416    };
    409417
    410418    AbstractChosen.prototype.search_string_match = function(search_string, regex) {
    411       var part, parts, _i, _len;
    412       if (regex.test(search_string)) {
    413         return true;
    414       } else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
    415         parts = search_string.replace(/\[|\]/g, "").split(" ");
    416         if (parts.length) {
    417           for (_i = 0, _len = parts.length; _i < _len; _i++) {
    418             part = parts[_i];
    419             if (regex.test(part)) {
    420               return true;
    421             }
    422           }
    423         }
    424       }
     419      var match;
     420      match = regex.exec(search_string);
     421      if (!this.search_contains && (match != null ? match[1] : void 0)) {
     422        match.index += 1;
     423      }
     424      return match;
    425425    };
    426426
    427427    AbstractChosen.prototype.choices_count = function() {
    428       var option, _i, _len, _ref;
     428      var i, len, option, ref;
    429429      if (this.selected_option_count != null) {
    430430        return this.selected_option_count;
    431431      }
    432432      this.selected_option_count = 0;
    433       _ref = this.form_field.options;
    434       for (_i = 0, _len = _ref.length; _i < _len; _i++) {
    435         option = _ref[_i];
     433      ref = this.form_field.options;
     434      for (i = 0, len = ref.length; i < len; i++) {
     435        option = ref[i];
    436436        if (option.selected) {
    437437          this.selected_option_count += 1;
     
    443443    AbstractChosen.prototype.choices_click = function(evt) {
    444444      evt.preventDefault();
     445      this.activate_field();
    445446      if (!(this.results_showing || this.is_disabled)) {
    446447        return this.results_show();
     
    448449    };
    449450
     451    AbstractChosen.prototype.keydown_checker = function(evt) {
     452      var ref, stroke;
     453      stroke = (ref = evt.which) != null ? ref : evt.keyCode;
     454      this.search_field_scale();
     455      if (stroke !== 8 && this.pending_backstroke) {
     456        this.clear_backstroke();
     457      }
     458      switch (stroke) {
     459        case 8:
     460          this.backstroke_length = this.get_search_field_value().length;
     461          break;
     462        case 9:
     463          if (this.results_showing && !this.is_multiple) {
     464            this.result_select(evt);
     465          }
     466          this.mouse_on_container = false;
     467          break;
     468        case 13:
     469          if (this.results_showing) {
     470            evt.preventDefault();
     471          }
     472          break;
     473        case 27:
     474          if (this.results_showing) {
     475            evt.preventDefault();
     476          }
     477          break;
     478        case 32:
     479          if (this.disable_search) {
     480            evt.preventDefault();
     481          }
     482          break;
     483        case 38:
     484          evt.preventDefault();
     485          this.keyup_arrow();
     486          break;
     487        case 40:
     488          evt.preventDefault();
     489          this.keydown_arrow();
     490          break;
     491      }
     492    };
     493
    450494    AbstractChosen.prototype.keyup_checker = function(evt) {
    451       var stroke, _ref;
    452       stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
     495      var ref, stroke;
     496      stroke = (ref = evt.which) != null ? ref : evt.keyCode;
    453497      this.search_field_scale();
    454498      switch (stroke) {
    455499        case 8:
    456500          if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
    457             return this.keydown_backstroke();
     501            this.keydown_backstroke();
    458502          } else if (!this.pending_backstroke) {
    459503            this.result_clear_highlight();
    460             return this.results_search();
     504            this.results_search();
    461505          }
    462506          break;
     
    464508          evt.preventDefault();
    465509          if (this.results_showing) {
    466             return this.result_select(evt);
     510            this.result_select(evt);
    467511          }
    468512          break;
     
    471515            this.results_hide();
    472516          }
    473           return true;
     517          break;
    474518        case 9:
     519        case 16:
     520        case 17:
     521        case 18:
    475522        case 38:
    476523        case 40:
    477         case 16:
    478524        case 91:
    479         case 17:
    480         case 18:
    481525          break;
    482526        default:
    483           return this.results_search();
     527          this.results_search();
     528          break;
    484529      }
    485530    };
    486531
    487532    AbstractChosen.prototype.clipboard_event_checker = function(evt) {
    488       var _this = this;
    489       return setTimeout((function() {
    490         return _this.results_search();
    491       }), 50);
     533      if (this.is_disabled) {
     534        return;
     535      }
     536      return setTimeout(((function(_this) {
     537        return function() {
     538          return _this.results_search();
     539        };
     540      })(this)), 50);
    492541    };
    493542
     
    496545        return this.options.width;
    497546      } else {
    498         return "" + this.form_field.offsetWidth + "px";
     547        return this.form_field.offsetWidth + "px";
    499548      }
    500549    };
     
    539588    };
    540589
     590    AbstractChosen.prototype.get_single_html = function() {
     591      return "<a class=\"chosen-single chosen-default\">\n  <span>" + this.default_text + "</span>\n  <div><b></b></div>\n</a>\n<div class=\"chosen-drop\">\n  <div class=\"chosen-search\">\n    <input class=\"chosen-search-input\" type=\"text\" autocomplete=\"off\" />\n  </div>\n  <ul class=\"chosen-results\"></ul>\n</div>";
     592    };
     593
     594    AbstractChosen.prototype.get_multi_html = function() {
     595      return "<ul class=\"chosen-choices\">\n  <li class=\"search-field\">\n    <input class=\"chosen-search-input\" type=\"text\" autocomplete=\"off\" value=\"" + this.default_text + "\" />\n  </li>\n</ul>\n<div class=\"chosen-drop\">\n  <ul class=\"chosen-results\"></ul>\n</div>";
     596    };
     597
     598    AbstractChosen.prototype.get_no_results_html = function(terms) {
     599      return "<li class=\"no-results\">\n  " + this.results_none_found + " <span>" + (this.escape_html(terms)) + "</span>\n</li>";
     600    };
     601
    541602    AbstractChosen.browser_is_supported = function() {
    542603      if ("Microsoft Internet Explorer" === window.navigator.appName) {
     
    559620  })();
    560621
    561   this.Chosen = (function(_super) {
    562     __extends(Chosen, _super);
     622  this.Chosen = (function(superClass) {
     623    var triggerHtmlEvent;
     624
     625    extend(Chosen, superClass);
    563626
    564627    function Chosen() {
    565       _ref = Chosen.__super__.constructor.apply(this, arguments);
    566       return _ref;
     628      return Chosen.__super__.constructor.apply(this, arguments);
    567629    }
    568630
    569631    Chosen.prototype.setup = function() {
    570       this.current_selectedIndex = this.form_field.selectedIndex;
    571       return this.is_rtl = this.form_field.hasClassName("chosen-rtl");
    572     };
    573 
    574     Chosen.prototype.set_default_values = function() {
    575       Chosen.__super__.set_default_values.call(this);
    576       this.single_temp = new Template('<a class="chosen-single chosen-default"><span>#{default}</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
    577       this.multi_temp = new Template('<ul class="chosen-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
    578       return this.no_results_temp = new Template('<li class="no-results">' + this.results_none_found + ' "<span>#{terms}</span>"</li>');
     632      return this.current_selectedIndex = this.form_field.selectedIndex;
    579633    };
    580634
     
    591645      container_props = {
    592646        'class': container_classes.join(' '),
    593         'style': "width: " + (this.container_width()) + ";",
    594647        'title': this.form_field.title
    595648      };
     
    597650        container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
    598651      }
    599       this.container = this.is_multiple ? new Element('div', container_props).update(this.multi_temp.evaluate({
    600         "default": this.default_text
    601       })) : new Element('div', container_props).update(this.single_temp.evaluate({
    602         "default": this.default_text
    603       }));
     652      this.container = new Element('div', container_props);
     653      this.container.setStyle({
     654        width: this.container_width()
     655      });
     656      if (this.is_multiple) {
     657        this.container.update(this.get_multi_html());
     658      } else {
     659        this.container.update(this.get_single_html());
     660      }
    604661      this.form_field.hide().insert({
    605662        after: this.container
     
    629686
    630687    Chosen.prototype.register_observers = function() {
    631       var _this = this;
    632       this.container.observe("touchstart", function(evt) {
    633         _this.container_mousedown(evt);
    634         return evt.preventDefault();
    635       });
    636       this.container.observe("touchend", function(evt) {
    637         _this.container_mouseup(evt);
    638         return evt.preventDefault();
    639       });
    640       this.container.observe("mousedown", function(evt) {
    641         return _this.container_mousedown(evt);
    642       });
    643       this.container.observe("mouseup", function(evt) {
    644         return _this.container_mouseup(evt);
    645       });
    646       this.container.observe("mouseenter", function(evt) {
    647         return _this.mouse_enter(evt);
    648       });
    649       this.container.observe("mouseleave", function(evt) {
    650         return _this.mouse_leave(evt);
    651       });
    652       this.search_results.observe("mouseup", function(evt) {
    653         return _this.search_results_mouseup(evt);
    654       });
    655       this.search_results.observe("mouseover", function(evt) {
    656         return _this.search_results_mouseover(evt);
    657       });
    658       this.search_results.observe("mouseout", function(evt) {
    659         return _this.search_results_mouseout(evt);
    660       });
    661       this.search_results.observe("mousewheel", function(evt) {
    662         return _this.search_results_mousewheel(evt);
    663       });
    664       this.search_results.observe("DOMMouseScroll", function(evt) {
    665         return _this.search_results_mousewheel(evt);
    666       });
    667       this.search_results.observe("touchstart", function(evt) {
    668         return _this.search_results_touchstart(evt);
    669       });
    670       this.search_results.observe("touchmove", function(evt) {
    671         return _this.search_results_touchmove(evt);
    672       });
    673       this.search_results.observe("touchend", function(evt) {
    674         return _this.search_results_touchend(evt);
    675       });
    676       this.form_field.observe("chosen:updated", function(evt) {
    677         return _this.results_update_field(evt);
    678       });
    679       this.form_field.observe("chosen:activate", function(evt) {
    680         return _this.activate_field(evt);
    681       });
    682       this.form_field.observe("chosen:open", function(evt) {
    683         return _this.container_mousedown(evt);
    684       });
    685       this.form_field.observe("chosen:close", function(evt) {
    686         return _this.input_blur(evt);
    687       });
    688       this.search_field.observe("blur", function(evt) {
    689         return _this.input_blur(evt);
    690       });
    691       this.search_field.observe("keyup", function(evt) {
    692         return _this.keyup_checker(evt);
    693       });
    694       this.search_field.observe("keydown", function(evt) {
    695         return _this.keydown_checker(evt);
    696       });
    697       this.search_field.observe("focus", function(evt) {
    698         return _this.input_focus(evt);
    699       });
    700       this.search_field.observe("cut", function(evt) {
    701         return _this.clipboard_event_checker(evt);
    702       });
    703       this.search_field.observe("paste", function(evt) {
    704         return _this.clipboard_event_checker(evt);
    705       });
     688      this.container.observe("touchstart", (function(_this) {
     689        return function(evt) {
     690          return _this.container_mousedown(evt);
     691        };
     692      })(this));
     693      this.container.observe("touchend", (function(_this) {
     694        return function(evt) {
     695          return _this.container_mouseup(evt);
     696        };
     697      })(this));
     698      this.container.observe("mousedown", (function(_this) {
     699        return function(evt) {
     700          return _this.container_mousedown(evt);
     701        };
     702      })(this));
     703      this.container.observe("mouseup", (function(_this) {
     704        return function(evt) {
     705          return _this.container_mouseup(evt);
     706        };
     707      })(this));
     708      this.container.observe("mouseenter", (function(_this) {
     709        return function(evt) {
     710          return _this.mouse_enter(evt);
     711        };
     712      })(this));
     713      this.container.observe("mouseleave", (function(_this) {
     714        return function(evt) {
     715          return _this.mouse_leave(evt);
     716        };
     717      })(this));
     718      this.search_results.observe("mouseup", (function(_this) {
     719        return function(evt) {
     720          return _this.search_results_mouseup(evt);
     721        };
     722      })(this));
     723      this.search_results.observe("mouseover", (function(_this) {
     724        return function(evt) {
     725          return _this.search_results_mouseover(evt);
     726        };
     727      })(this));
     728      this.search_results.observe("mouseout", (function(_this) {
     729        return function(evt) {
     730          return _this.search_results_mouseout(evt);
     731        };
     732      })(this));
     733      this.search_results.observe("mousewheel", (function(_this) {
     734        return function(evt) {
     735          return _this.search_results_mousewheel(evt);
     736        };
     737      })(this));
     738      this.search_results.observe("DOMMouseScroll", (function(_this) {
     739        return function(evt) {
     740          return _this.search_results_mousewheel(evt);
     741        };
     742      })(this));
     743      this.search_results.observe("touchstart", (function(_this) {
     744        return function(evt) {
     745          return _this.search_results_touchstart(evt);
     746        };
     747      })(this));
     748      this.search_results.observe("touchmove", (function(_this) {
     749        return function(evt) {
     750          return _this.search_results_touchmove(evt);
     751        };
     752      })(this));
     753      this.search_results.observe("touchend", (function(_this) {
     754        return function(evt) {
     755          return _this.search_results_touchend(evt);
     756        };
     757      })(this));
     758      this.form_field.observe("chosen:updated", (function(_this) {
     759        return function(evt) {
     760          return _this.results_update_field(evt);
     761        };
     762      })(this));
     763      this.form_field.observe("chosen:activate", (function(_this) {
     764        return function(evt) {
     765          return _this.activate_field(evt);
     766        };
     767      })(this));
     768      this.form_field.observe("chosen:open", (function(_this) {
     769        return function(evt) {
     770          return _this.container_mousedown(evt);
     771        };
     772      })(this));
     773      this.form_field.observe("chosen:close", (function(_this) {
     774        return function(evt) {
     775          return _this.close_field(evt);
     776        };
     777      })(this));
     778      this.search_field.observe("blur", (function(_this) {
     779        return function(evt) {
     780          return _this.input_blur(evt);
     781        };
     782      })(this));
     783      this.search_field.observe("keyup", (function(_this) {
     784        return function(evt) {
     785          return _this.keyup_checker(evt);
     786        };
     787      })(this));
     788      this.search_field.observe("keydown", (function(_this) {
     789        return function(evt) {
     790          return _this.keydown_checker(evt);
     791        };
     792      })(this));
     793      this.search_field.observe("focus", (function(_this) {
     794        return function(evt) {
     795          return _this.input_focus(evt);
     796        };
     797      })(this));
     798      this.search_field.observe("cut", (function(_this) {
     799        return function(evt) {
     800          return _this.clipboard_event_checker(evt);
     801        };
     802      })(this));
     803      this.search_field.observe("paste", (function(_this) {
     804        return function(evt) {
     805          return _this.clipboard_event_checker(evt);
     806        };
     807      })(this));
    706808      if (this.is_multiple) {
    707         return this.search_choices.observe("click", function(evt) {
    708           return _this.choices_click(evt);
    709         });
    710       } else {
    711         return this.container.observe("click", function(evt) {
    712           return evt.preventDefault();
    713         });
     809        return this.search_choices.observe("click", (function(_this) {
     810          return function(evt) {
     811            return _this.choices_click(evt);
     812          };
     813        })(this));
     814      } else {
     815        return this.container.observe("click", (function(_this) {
     816          return function(evt) {
     817            return evt.preventDefault();
     818          };
     819        })(this));
    714820      }
    715821    };
    716822
    717823    Chosen.prototype.destroy = function() {
     824      var event, i, len, ref;
    718825      this.container.ownerDocument.stopObserving("click", this.click_test_action);
    719       this.form_field.stopObserving();
     826      ref = ['chosen:updated', 'chosen:activate', 'chosen:open', 'chosen:close'];
     827      for (i = 0, len = ref.length; i < len; i++) {
     828        event = ref[i];
     829        this.form_field.stopObserving(event);
     830      }
    720831      this.container.stopObserving();
    721832      this.search_results.stopObserving();
     
    740851
    741852    Chosen.prototype.search_field_disabled = function() {
    742       this.is_disabled = this.form_field.disabled;
     853      var ref;
     854      this.is_disabled = this.form_field.disabled || ((ref = this.form_field.up('fieldset')) != null ? ref.disabled : void 0) || false;
    743855      if (this.is_disabled) {
    744856        this.container.addClassName('chosen-disabled');
    745         this.search_field.disabled = true;
    746         if (!this.is_multiple) {
    747           this.selected_item.stopObserving("focus", this.activate_action);
    748         }
     857      } else {
     858        this.container.removeClassName('chosen-disabled');
     859      }
     860      this.search_field.disabled = this.is_disabled;
     861      if (!this.is_multiple) {
     862        this.selected_item.stopObserving('focus', this.activate_field);
     863      }
     864      if (this.is_disabled) {
    749865        return this.close_field();
    750       } else {
    751         this.container.removeClassName('chosen-disabled');
    752         this.search_field.disabled = false;
    753         if (!this.is_multiple) {
    754           return this.selected_item.observe("focus", this.activate_action);
    755         }
     866      } else if (!this.is_multiple) {
     867        return this.selected_item.observe('focus', this.activate_field);
    756868      }
    757869    };
    758870
    759871    Chosen.prototype.container_mousedown = function(evt) {
    760       if (!this.is_disabled) {
    761         if (evt && evt.type === "mousedown" && !this.results_showing) {
    762           evt.stop();
    763         }
    764         if (!((evt != null) && evt.target.hasClassName("search-choice-close"))) {
    765           if (!this.active_field) {
    766             if (this.is_multiple) {
    767               this.search_field.clear();
    768             }
    769             this.container.ownerDocument.observe("click", this.click_test_action);
    770             this.results_show();
    771           } else if (!this.is_multiple && evt && (evt.target === this.selected_item || evt.target.up("a.chosen-single"))) {
    772             this.results_toggle();
    773           }
    774           return this.activate_field();
    775         }
     872      var ref;
     873      if (this.is_disabled) {
     874        return;
     875      }
     876      if (evt && ((ref = evt.type) === 'mousedown' || ref === 'touchstart') && !this.results_showing) {
     877        evt.preventDefault();
     878      }
     879      if (!((evt != null) && evt.target.hasClassName("search-choice-close"))) {
     880        if (!this.active_field) {
     881          if (this.is_multiple) {
     882            this.search_field.clear();
     883          }
     884          this.container.ownerDocument.observe("click", this.click_test_action);
     885          this.results_show();
     886        } else if (!this.is_multiple && evt && (evt.target === this.selected_item || evt.target.up("a.chosen-single"))) {
     887          this.results_toggle();
     888        }
     889        return this.activate_field();
    776890      }
    777891    };
     
    808922      this.clear_backstroke();
    809923      this.show_search_field_default();
    810       return this.search_field_scale();
     924      this.search_field_scale();
     925      return this.search_field.blur();
    811926    };
    812927
    813928    Chosen.prototype.activate_field = function() {
     929      if (this.is_disabled) {
     930        return;
     931      }
    814932      this.container.addClassName("chosen-container-active");
    815933      this.active_field = true;
    816       this.search_field.value = this.search_field.value;
     934      this.search_field.value = this.get_search_field_value();
    817935      return this.search_field.focus();
    818936    };
     
    832950      if (this.is_multiple) {
    833951        this.search_choices.select("li.search-choice").invoke("remove");
    834       } else if (!this.is_multiple) {
     952      } else {
    835953        this.single_set_selected_text();
    836954        if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
     
    8851003      this.results_showing = true;
    8861004      this.search_field.focus();
    887       this.search_field.value = this.search_field.value;
     1005      this.search_field.value = this.get_search_field_value();
    8881006      this.winnow_results();
    8891007      return this.form_field.fire("chosen:showing_dropdown", {
     
    9171035
    9181036    Chosen.prototype.set_label_behavior = function() {
    919       var _this = this;
    9201037      this.form_field_label = this.form_field.up("label");
    9211038      if (this.form_field_label == null) {
     
    9231040      }
    9241041      if (this.form_field_label != null) {
    925         return this.form_field_label.observe("click", function(evt) {
    926           if (_this.is_multiple) {
    927             return _this.container_mousedown(evt);
    928           } else {
    929             return _this.activate_field();
    930           }
    931         });
     1042        return this.form_field_label.observe("click", this.label_click_handler);
    9321043      }
    9331044    };
     
    9681079
    9691080    Chosen.prototype.choice_build = function(item) {
    970       var choice, close_link,
    971         _this = this;
     1081      var choice, close_link;
    9721082      choice = new Element('li', {
    9731083        "class": "search-choice"
     
    9811091          rel: item.array_index
    9821092        });
    983         close_link.observe("click", function(evt) {
    984           return _this.choice_destroy_link_click(evt);
    985         });
     1093        close_link.observe("click", (function(_this) {
     1094          return function(evt) {
     1095            return _this.choice_destroy_link_click(evt);
     1096          };
     1097        })(this));
    9861098        choice.insert(close_link);
    9871099      }
     
    10011113    Chosen.prototype.choice_destroy = function(link) {
    10021114      if (this.result_deselect(link.readAttribute("rel"))) {
    1003         this.show_search_field_default();
    1004         if (this.is_multiple && this.choices_count() > 0 && this.search_field.value.length < 1) {
     1115        if (this.active_field) {
     1116          this.search_field.focus();
     1117        } else {
     1118          this.show_search_field_default();
     1119        }
     1120        if (this.is_multiple && this.choices_count() > 0 && this.get_search_field_value().length < 1) {
    10051121          this.results_hide();
    10061122        }
     
    10161132      this.show_search_field_default();
    10171133      this.results_reset_cleanup();
    1018       if (typeof Event.simulate === 'function') {
    1019         this.form_field.simulate("change");
    1020       }
     1134      this.trigger_form_field_change();
    10211135      if (this.active_field) {
    10221136        return this.results_hide();
     
    10591173          this.single_set_selected_text(this.choice_label(item));
    10601174        }
    1061         if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
     1175        if (this.is_multiple && (!this.hide_results_on_select || (evt.metaKey || evt.ctrlKey))) {
     1176          if (evt.metaKey || evt.ctrlKey) {
     1177            this.winnow_results({
     1178              skip_highlight: true
     1179            });
     1180          } else {
     1181            this.search_field.value = "";
     1182            this.winnow_results();
     1183          }
     1184        } else {
    10621185          this.results_hide();
    1063         }
    1064         this.show_search_field_default();
    1065         if (typeof Event.simulate === 'function' && (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex)) {
    1066           this.form_field.simulate("change");
     1186          this.show_search_field_default();
     1187        }
     1188        if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
     1189          this.trigger_form_field_change();
    10671190        }
    10681191        this.current_selectedIndex = this.form_field.selectedIndex;
     
    10961219          this.winnow_results();
    10971220        }
    1098         if (typeof Event.simulate === 'function') {
    1099           this.form_field.simulate("change");
    1100         }
     1221        this.trigger_form_field_change();
    11011222        this.search_field_scale();
    11021223        return true;
     
    11181239    };
    11191240
     1241    Chosen.prototype.get_search_field_value = function() {
     1242      return this.search_field.value;
     1243    };
     1244
    11201245    Chosen.prototype.get_search_text = function() {
    1121       return this.search_field.value.strip().escapeHTML();
     1246      return this.get_search_field_value().strip();
     1247    };
     1248
     1249    Chosen.prototype.escape_html = function(text) {
     1250      return text.escapeHTML();
    11221251    };
    11231252
     
    11361265
    11371266    Chosen.prototype.no_results = function(terms) {
    1138       this.search_results.insert(this.no_results_temp.evaluate({
    1139         terms: terms
    1140       }));
     1267      this.search_results.insert(this.get_no_results_html(terms));
    11411268      return this.form_field.fire("chosen:no_results", {
    11421269        chosen: this
     
    11451272
    11461273    Chosen.prototype.no_results_clear = function() {
    1147       var nr, _results;
     1274      var nr, results1;
    11481275      nr = null;
    1149       _results = [];
     1276      results1 = [];
    11501277      while (nr = this.search_results.down(".no-results")) {
    1151         _results.push(nr.remove());
    1152       }
    1153       return _results;
     1278        results1.push(nr.remove());
     1279      }
     1280      return results1;
    11541281    };
    11551282
     
    12131340    };
    12141341
    1215     Chosen.prototype.keydown_checker = function(evt) {
    1216       var stroke, _ref1;
    1217       stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
    1218       this.search_field_scale();
    1219       if (stroke !== 8 && this.pending_backstroke) {
    1220         this.clear_backstroke();
    1221       }
    1222       switch (stroke) {
    1223         case 8:
    1224           this.backstroke_length = this.search_field.value.length;
    1225           break;
    1226         case 9:
    1227           if (this.results_showing && !this.is_multiple) {
    1228             this.result_select(evt);
    1229           }
    1230           this.mouse_on_container = false;
    1231           break;
    1232         case 13:
    1233           if (this.results_showing) {
    1234             evt.preventDefault();
    1235           }
    1236           break;
    1237         case 32:
    1238           if (this.disable_search) {
    1239             evt.preventDefault();
    1240           }
    1241           break;
    1242         case 38:
    1243           evt.preventDefault();
    1244           this.keyup_arrow();
    1245           break;
    1246         case 40:
    1247           evt.preventDefault();
    1248           this.keydown_arrow();
    1249           break;
    1250       }
    1251     };
    1252 
    12531342    Chosen.prototype.search_field_scale = function() {
    1254       var div, f_width, h, style, style_block, styles, w, _i, _len;
    1255       if (this.is_multiple) {
    1256         h = 0;
    1257         w = 0;
    1258         style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
    1259         styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
    1260         for (_i = 0, _len = styles.length; _i < _len; _i++) {
    1261           style = styles[_i];
    1262           style_block += style + ":" + this.search_field.getStyle(style) + ";";
    1263         }
    1264         div = new Element('div', {
    1265           'style': style_block
    1266         }).update(this.search_field.value.escapeHTML());
    1267         document.body.appendChild(div);
    1268         w = Element.measure(div, 'width') + 25;
    1269         div.remove();
    1270         f_width = this.container.getWidth();
    1271         if (w > f_width - 10) {
    1272           w = f_width - 10;
    1273         }
    1274         return this.search_field.setStyle({
    1275           'width': w + 'px'
    1276         });
     1343      var container_width, div, i, len, style, style_block, styles, width;
     1344      if (!this.is_multiple) {
     1345        return;
     1346      }
     1347      style_block = {
     1348        position: 'absolute',
     1349        left: '-1000px',
     1350        top: '-1000px',
     1351        display: 'none',
     1352        whiteSpace: 'pre'
     1353      };
     1354      styles = ['fontSize', 'fontStyle', 'fontWeight', 'fontFamily', 'lineHeight', 'textTransform', 'letterSpacing'];
     1355      for (i = 0, len = styles.length; i < len; i++) {
     1356        style = styles[i];
     1357        style_block[style] = this.search_field.getStyle(style);
     1358      }
     1359      div = new Element('div').update(this.escape_html(this.get_search_field_value()));
     1360      div.setStyle(style_block);
     1361      document.body.appendChild(div);
     1362      width = div.measure('width') + 25;
     1363      div.remove();
     1364      if (container_width = this.container.getWidth()) {
     1365        width = Math.min(container_width - 10, width);
     1366      }
     1367      return this.search_field.setStyle({
     1368        width: width + 'px'
     1369      });
     1370    };
     1371
     1372    Chosen.prototype.trigger_form_field_change = function() {
     1373      triggerHtmlEvent(this.form_field, 'input');
     1374      return triggerHtmlEvent(this.form_field, 'change');
     1375    };
     1376
     1377    triggerHtmlEvent = function(element, eventType) {
     1378      var error, evt;
     1379      if (element.dispatchEvent) {
     1380        try {
     1381          evt = new Event(eventType, {
     1382            bubbles: true,
     1383            cancelable: true
     1384          });
     1385        } catch (error) {
     1386          evt = document.createEvent('HTMLEvents');
     1387          evt.initEvent(eventType, true, true);
     1388        }
     1389        return element.dispatchEvent(evt);
     1390      } else {
     1391        return element.fireEvent("on" + eventType, document.createEventObject());
    12771392      }
    12781393    };
  • _plugins_/chosen/trunk/lib/chosen/chosen.proto.min.js

    r98557 r113714  
    1 /* Chosen v1.6.1 | (c) 2011-2016 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
    2 (function(){var AbstractChosen,SelectParser,a,b={}.hasOwnProperty,c=function(a,c){function d(){this.constructor=a}for(var e in c)b.call(c,e)&&(a[e]=c[e]);return d.prototype=c.prototype,a.prototype=new d,a.__super__=c.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),title:a.title?a.title:void 0,children:0,disabled:a.disabled,classes:a.className}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,title:a.title?a.title:void 0,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,group_label:null!=b?this.parsed[b].label:null,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&amp;"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1},AbstractChosen.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.choice_label=function(a){return this.include_group_label_in_selected&&null!=a.group_label?"<b class='group-name'>"+a.group_label+"</b>"+a.html:a.html},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(a){var b=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return b.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(a){var b=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return b.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f,g,h;for(b="",e=0,h=this.results_data,f=0,g=h.length;g>f&&(c=h[f],d="",d=c.group?this.result_add_group(c):this.result_add_option(c),""!==d&&(e++,b+=d),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(c))),!(e>=this.max_shown_results));f++);return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match&&this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.style.cssText=a.style,c.setAttribute("data-option-array-index",a.array_index),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):""},AbstractChosen.prototype.result_add_group=function(a){var b,c;return(a.search_match||a.group_match)&&a.active_options>0?(b=[],b.push("group-result"),a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):""},AbstractChosen.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing?this.winnow_results():void 0},AbstractChosen.prototype.reset_single_select_options=function(){var a,b,c,d,e;for(d=this.results_data,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.selected?e.push(a.selected=!1):e.push(void 0);return e},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l;for(this.no_results_clear(),d=0,f=this.get_search_text(),a=f.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),i=new RegExp(a,"i"),c=this.get_search_regex(a),l=this.results_data,j=0,k=l.length;k>j;j++)b=l[j],b.search_match=!1,e=null,this.include_option_in_results(b)&&(b.group&&(b.group_match=!1,b.active_options=0),null!=b.group_array_index&&this.results_data[b.group_array_index]&&(e=this.results_data[b.group_array_index],0===e.active_options&&e.search_match&&(d+=1),e.active_options+=1),b.search_text=b.group?b.label:b.html,(!b.group||this.group_search)&&(b.search_match=this.search_string_match(b.search_text,c),b.search_match&&!b.group&&(d+=1),b.search_match?(f.length&&(g=b.search_text.search(i),h=b.search_text.substr(0,g+f.length)+"</em>"+b.search_text.substr(g+f.length),b.search_text=h.substr(0,g)+"<em>"+h.substr(g)),null!=e&&(e.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),1>d&&f.length?(this.update_results_content(""),this.no_results(f)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},AbstractChosen.prototype.get_search_regex=function(a){var b,c;return b=this.search_contains?"":"^",c=this.case_sensitive_search?"":"i",new RegExp(b+a,c)},AbstractChosen.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},AbstractChosen.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},AbstractChosen.prototype.choices_click=function(a){return a.preventDefault(),this.results_showing||this.is_disabled?void 0:this.results_show()},AbstractChosen.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:case 18:break;default:return this.results_search()}},AbstractChosen.prototype.clipboard_event_checker=function(a){var b=this;return setTimeout(function(){return b.results_search()},50)},AbstractChosen.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},AbstractChosen.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},AbstractChosen.prototype.search_results_touchstart=function(a){return this.touch_started=!0,this.search_results_mouseover(a)},AbstractChosen.prototype.search_results_touchmove=function(a){return this.touch_started=!1,this.search_results_mouseout(a)},AbstractChosen.prototype.search_results_touchend=function(a){return this.touch_started?this.search_results_mouseup(a):void 0},AbstractChosen.prototype.outerHTML=function(a){var b;return a.outerHTML?a.outerHTML:(b=document.createElement("div"),b.appendChild(a),b.innerHTML)},AbstractChosen.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent)?!1:!0},AbstractChosen.default_multiple_text="Select Some Options",AbstractChosen.default_single_text="Select an Option",AbstractChosen.default_no_result_text="No results match",AbstractChosen}(),this.Chosen=function(b){function Chosen(){return a=Chosen.__super__.constructor.apply(this,arguments)}return c(Chosen,b),Chosen.prototype.setup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field.hasClassName("chosen-rtl")},Chosen.prototype.set_default_values=function(){return Chosen.__super__.set_default_values.call(this),this.single_temp=new Template('<a class="chosen-single chosen-default"><span>#{default}</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.multi_temp=new Template('<ul class="chosen-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'),this.no_results_temp=new Template('<li class="no-results">'+this.results_none_found+' "<span>#{terms}</span>"</li>')},Chosen.prototype.set_up_html=function(){var a,b;return a=["chosen-container"],a.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&a.push(this.form_field.className),this.is_rtl&&a.push("chosen-rtl"),b={"class":a.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(b.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=this.is_multiple?new Element("div",b).update(this.multi_temp.evaluate({"default":this.default_text})):new Element("div",b).update(this.single_temp.evaluate({"default":this.default_text})),this.form_field.hide().insert({after:this.container}),this.dropdown=this.container.down("div.chosen-drop"),this.search_field=this.container.down("input"),this.search_results=this.container.down("ul.chosen-results"),this.search_field_scale(),this.search_no_results=this.container.down("li.no-results"),this.is_multiple?(this.search_choices=this.container.down("ul.chosen-choices"),this.search_container=this.container.down("li.search-field")):(this.search_container=this.container.down("div.chosen-search"),this.selected_item=this.container.down(".chosen-single")),this.results_build(),this.set_tab_index(),this.set_label_behavior()},Chosen.prototype.on_ready=function(){return this.form_field.fire("chosen:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var a=this;return this.container.observe("touchstart",function(b){return a.container_mousedown(b),b.preventDefault()}),this.container.observe("touchend",function(b){return a.container_mouseup(b),b.preventDefault()}),this.container.observe("mousedown",function(b){return a.container_mousedown(b)}),this.container.observe("mouseup",function(b){return a.container_mouseup(b)}),this.container.observe("mouseenter",function(b){return a.mouse_enter(b)}),this.container.observe("mouseleave",function(b){return a.mouse_leave(b)}),this.search_results.observe("mouseup",function(b){return a.search_results_mouseup(b)}),this.search_results.observe("mouseover",function(b){return a.search_results_mouseover(b)}),this.search_results.observe("mouseout",function(b){return a.search_results_mouseout(b)}),this.search_results.observe("mousewheel",function(b){return a.search_results_mousewheel(b)}),this.search_results.observe("DOMMouseScroll",function(b){return a.search_results_mousewheel(b)}),this.search_results.observe("touchstart",function(b){return a.search_results_touchstart(b)}),this.search_results.observe("touchmove",function(b){return a.search_results_touchmove(b)}),this.search_results.observe("touchend",function(b){return a.search_results_touchend(b)}),this.form_field.observe("chosen:updated",function(b){return a.results_update_field(b)}),this.form_field.observe("chosen:activate",function(b){return a.activate_field(b)}),this.form_field.observe("chosen:open",function(b){return a.container_mousedown(b)}),this.form_field.observe("chosen:close",function(b){return a.input_blur(b)}),this.search_field.observe("blur",function(b){return a.input_blur(b)}),this.search_field.observe("keyup",function(b){return a.keyup_checker(b)}),this.search_field.observe("keydown",function(b){return a.keydown_checker(b)}),this.search_field.observe("focus",function(b){return a.input_focus(b)}),this.search_field.observe("cut",function(b){return a.clipboard_event_checker(b)}),this.search_field.observe("paste",function(b){return a.clipboard_event_checker(b)}),this.is_multiple?this.search_choices.observe("click",function(b){return a.choices_click(b)}):this.container.observe("click",function(a){return a.preventDefault()})},Chosen.prototype.destroy=function(){return this.container.ownerDocument.stopObserving("click",this.click_test_action),this.form_field.stopObserving(),this.container.stopObserving(),this.search_results.stopObserving(),this.search_field.stopObserving(),null!=this.form_field_label&&this.form_field_label.stopObserving(),this.is_multiple?(this.search_choices.stopObserving(),this.container.select(".search-choice-close").each(function(a){return a.stopObserving()})):this.selected_item.stopObserving(),this.search_field.tabIndex&&(this.form_field.tabIndex=this.search_field.tabIndex),this.container.remove(),this.form_field.show()},Chosen.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled,this.is_disabled?(this.container.addClassName("chosen-disabled"),this.search_field.disabled=!0,this.is_multiple||this.selected_item.stopObserving("focus",this.activate_action),this.close_field()):(this.container.removeClassName("chosen-disabled"),this.search_field.disabled=!1,this.is_multiple?void 0:this.selected_item.observe("focus",this.activate_action))},Chosen.prototype.container_mousedown=function(a){return this.is_disabled||(a&&"mousedown"===a.type&&!this.results_showing&&a.stop(),null!=a&&a.target.hasClassName("search-choice-close"))?void 0:(this.active_field?this.is_multiple||!a||a.target!==this.selected_item&&!a.target.up("a.chosen-single")||this.results_toggle():(this.is_multiple&&this.search_field.clear(),this.container.ownerDocument.observe("click",this.click_test_action),this.results_show()),this.activate_field())},Chosen.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},Chosen.prototype.search_results_mousewheel=function(a){var b;return b=a.deltaY||-a.wheelDelta||a.detail,null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop=b+this.search_results.scrollTop):void 0},Chosen.prototype.blur_test=function(a){return!this.active_field&&this.container.hasClassName("chosen-container-active")?this.close_field():void 0},Chosen.prototype.close_field=function(){return this.container.ownerDocument.stopObserving("click",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClassName("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return this.container.addClassName("chosen-container-active"),this.active_field=!0,this.search_field.value=this.search_field.value,this.search_field.focus()},Chosen.prototype.test_active_click=function(a){return a.target.up(".chosen-container")===this.container?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=SelectParser.select_to_array(this.form_field),this.is_multiple?this.search_choices.select("li.search-choice").invoke("remove"):this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field.readOnly=!0,this.container.addClassName("chosen-container-single-nosearch")):(this.search_field.readOnly=!1,this.container.removeClassName("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},Chosen.prototype.result_do_highlight=function(a){var b,c,d,e,f;return this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClassName("highlighted"),d=parseInt(this.search_results.getStyle("maxHeight"),10),f=this.search_results.scrollTop,e=d+f,c=this.result_highlight.positionedOffset().top,b=c+this.result_highlight.getHeight(),b>=e?this.search_results.scrollTop=b-d>0?b-d:0:f>c?this.search_results.scrollTop=c:void 0},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClassName("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field.fire("chosen:maxselected",{chosen:this}),!1):(this.container.addClassName("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.value=this.search_field.value,this.winnow_results(),this.form_field.fire("chosen:showing_dropdown",{chosen:this}))},Chosen.prototype.update_results_content=function(a){return this.search_results.update(a)},Chosen.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClassName("chosen-with-drop"),this.form_field.fire("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},Chosen.prototype.set_tab_index=function(a){var b;return this.form_field.tabIndex?(b=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field.tabIndex=b):void 0},Chosen.prototype.set_label_behavior=function(){var a=this;return this.form_field_label=this.form_field.up("label"),null==this.form_field_label&&(this.form_field_label=$$("label[for='"+this.form_field.id+"']").first()),null!=this.form_field_label?this.form_field_label.observe("click",function(b){return a.is_multiple?a.container_mousedown(b):a.activate_field()}):void 0},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.value=this.default_text,this.search_field.addClassName("default")):(this.search_field.value="",this.search_field.removeClassName("default"))},Chosen.prototype.search_results_mouseup=function(a){var b;return b=a.target.hasClassName("active-result")?a.target:a.target.up(".active-result"),b?(this.result_highlight=b,this.result_select(a),this.search_field.focus()):void 0},Chosen.prototype.search_results_mouseover=function(a){var b;return b=a.target.hasClassName("active-result")?a.target:a.target.up(".active-result"),b?this.result_do_highlight(b):void 0},Chosen.prototype.search_results_mouseout=function(a){return a.target.hasClassName("active-result")||a.target.up(".active-result")?this.result_clear_highlight():void 0},Chosen.prototype.choice_build=function(a){var b,c,d=this;return b=new Element("li",{"class":"search-choice"}).update("<span>"+this.choice_label(a)+"</span>"),a.disabled?b.addClassName("search-choice-disabled"):(c=new Element("a",{href:"#","class":"search-choice-close",rel:a.array_index}),c.observe("click",function(a){return d.choice_destroy_link_click(a)}),b.insert(c)),this.search_container.insert({before:b})},Chosen.prototype.choice_destroy_link_click=function(a){return a.preventDefault(),a.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a.target)},Chosen.prototype.choice_destroy=function(a){return this.result_deselect(a.readAttribute("rel"))?(this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.value.length<1&&this.results_hide(),a.up("li").remove(),this.search_field_scale()):void 0},Chosen.prototype.results_reset=function(){return this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),"function"==typeof Event.simulate&&this.form_field.simulate("change"),this.active_field?this.results_hide():void 0},Chosen.prototype.results_reset_cleanup=function(){var a;return this.current_selectedIndex=this.form_field.selectedIndex,a=this.selected_item.down("abbr"),a?a.remove():void 0},Chosen.prototype.result_select=function(a){var b,c;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field.fire("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClassName("active-result"):this.reset_single_select_options(),b.addClassName("result-selected"),c=this.results_data[b.getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(this.choice_label(c)),(a.metaKey||a.ctrlKey)&&this.is_multiple||this.results_hide(),this.show_search_field_default(),"function"!=typeof Event.simulate||!this.is_multiple&&this.form_field.selectedIndex===this.current_selectedIndex||this.form_field.simulate("change"),this.current_selectedIndex=this.form_field.selectedIndex,a.preventDefault(),this.search_field_scale())):void 0},Chosen.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClassName("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClassName("chosen-default")),this.selected_item.down("span").update(a)},Chosen.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),"function"==typeof Event.simulate&&this.form_field.simulate("change"),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.down("abbr")||this.selected_item.down("span").insert({after:'<abbr class="search-choice-close"></abbr>'}),this.selected_item.addClassName("chosen-single-with-deselect")):void 0},Chosen.prototype.get_search_text=function(){return this.search_field.value.strip().escapeHTML()},Chosen.prototype.winnow_results_set_highlight=function(){var a;return this.is_multiple||(a=this.search_results.down(".result-selected.active-result")),null==a&&(a=this.search_results.down(".active-result")),null!=a?this.result_do_highlight(a):void 0},Chosen.prototype.no_results=function(a){return this.search_results.insert(this.no_results_temp.evaluate({terms:a})),this.form_field.fire("chosen:no_results",{chosen:this})},Chosen.prototype.no_results_clear=function(){var a,b;for(a=null,b=[];a=this.search_results.down(".no-results");)b.push(a.remove());return b},Chosen.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.next(".active-result"))?this.result_do_highlight(a):void 0:this.results_show()},Chosen.prototype.keyup_arrow=function(){var a,b,c;return this.results_showing||this.is_multiple?this.result_highlight?(c=this.result_highlight.previousSiblings(),a=this.search_results.select("li.active-result"),b=c.intersect(a),b.length?this.result_do_highlight(b.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},Chosen.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.down("a")),this.clear_backstroke()):(a=this.search_container.siblings().last(),a&&a.hasClassName("search-choice")&&!a.hasClassName("search-choice-disabled")?(this.pending_backstroke=a,this.pending_backstroke&&this.pending_backstroke.addClassName("search-choice-focus"),this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClassName("search-choice-focus")):void 0)},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClassName("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.value.length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:this.results_showing&&a.preventDefault();break;case 32:this.disable_search&&a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var a,b,c,d,e,f,g,h,i;if(this.is_multiple){for(c=0,g=0,e="position:absolute; left: -1000px; top: -1000px; display:none;",f=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],h=0,i=f.length;i>h;h++)d=f[h],e+=d+":"+this.search_field.getStyle(d)+";";return a=new Element("div",{style:e}).update(this.search_field.value.escapeHTML()),document.body.appendChild(a),g=Element.measure(a,"width")+25,a.remove(),b=this.container.getWidth(),g>b-10&&(g=b-10),this.search_field.setStyle({width:g+"px"})}},Chosen}(AbstractChosen)}).call(this);
     1/* Chosen v1.8.7 | (c) 2011-2018 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
     2
     3(function(){var e,t,s=function(e,t){return function(){return e.apply(t,arguments)}},i=function(e,t){function s(){this.constructor=e}for(var i in t)r.call(t,i)&&(e[i]=t[i]);return s.prototype=t.prototype,e.prototype=new s,e.__super__=t.prototype,e},r={}.hasOwnProperty;(t=function(){function e(){this.options_index=0,this.parsed=[]}return e.prototype.add_node=function(e){return"OPTGROUP"===e.nodeName.toUpperCase()?this.add_group(e):this.add_option(e)},e.prototype.add_group=function(e){var t,s,i,r,n,o;for(t=this.parsed.length,this.parsed.push({array_index:t,group:!0,label:e.label,title:e.title?e.title:void 0,children:0,disabled:e.disabled,classes:e.className}),o=[],s=0,i=(n=e.childNodes).length;s<i;s++)r=n[s],o.push(this.add_option(r,t,e.disabled));return o},e.prototype.add_option=function(e,t,s){if("OPTION"===e.nodeName.toUpperCase())return""!==e.text?(null!=t&&(this.parsed[t].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:e.value,text:e.text,html:e.innerHTML,title:e.title?e.title:void 0,selected:e.selected,disabled:!0===s?s:e.disabled,group_array_index:t,group_label:null!=t?this.parsed[t].label:null,classes:e.className,style:e.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},e}()).select_to_array=function(e){var s,i,r,n,o;for(n=new t,i=0,r=(o=e.childNodes).length;i<r;i++)s=o[i],n.add_node(s);return n.parsed},e=function(){function e(t,i){this.form_field=t,this.options=null!=i?i:{},this.label_click_handler=s(this.label_click_handler,this),e.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return e.prototype.set_default_values=function(){return this.click_test_action=function(e){return function(t){return e.test_active_click(t)}}(this),this.activate_action=function(e){return function(t){return e.activate_field(t)}}(this),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.is_rtl=this.options.rtl||/\bchosen-rtl\b/.test(this.form_field.className),this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text&&this.options.allow_single_deselect,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null==this.options.enable_split_word_search||this.options.enable_split_word_search,this.group_search=null==this.options.group_search||this.options.group_search,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null==this.options.single_backstroke_delete||this.options.single_backstroke_delete,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null==this.options.display_selected_options||this.options.display_selected_options,this.display_disabled_options=null==this.options.display_disabled_options||this.options.display_disabled_options,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1,this.hide_results_on_select=null==this.options.hide_results_on_select||this.options.hide_results_on_select},e.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||e.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||e.default_single_text,this.default_text=this.escape_html(this.default_text),this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||e.default_no_result_text},e.prototype.choice_label=function(e){return this.include_group_label_in_selected&&null!=e.group_label?"<b class='group-name'>"+this.escape_html(e.group_label)+"</b>"+e.html:e.html},e.prototype.mouse_enter=function(){return this.mouse_on_container=!0},e.prototype.mouse_leave=function(){return this.mouse_on_container=!1},e.prototype.input_focus=function(e){if(this.is_multiple){if(!this.active_field)return setTimeout(function(e){return function(){return e.container_mousedown()}}(this),50)}else if(!this.active_field)return this.activate_field()},e.prototype.input_blur=function(e){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(e){return function(){return e.blur_test()}}(this),100)},e.prototype.label_click_handler=function(e){return this.is_multiple?this.container_mousedown(e):this.activate_field()},e.prototype.results_option_build=function(e){var t,s,i,r,n,o,l;for(t="",l=0,r=0,n=(o=this.results_data).length;r<n&&(s=o[r],i="",""!==(i=s.group?this.result_add_group(s):this.result_add_option(s))&&(l++,t+=i),(null!=e?e.first:void 0)&&(s.selected&&this.is_multiple?this.choice_build(s):s.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(s))),!(l>=this.max_shown_results));r++);return t},e.prototype.result_add_option=function(e){var t,s;return e.search_match&&this.include_option_in_results(e)?(t=[],e.disabled||e.selected&&this.is_multiple||t.push("active-result"),!e.disabled||e.selected&&this.is_multiple||t.push("disabled-result"),e.selected&&t.push("result-selected"),null!=e.group_array_index&&t.push("group-option"),""!==e.classes&&t.push(e.classes),s=document.createElement("li"),s.className=t.join(" "),e.style&&(s.style.cssText=e.style),s.setAttribute("data-option-array-index",e.array_index),s.innerHTML=e.highlighted_html||e.html,e.title&&(s.title=e.title),this.outerHTML(s)):""},e.prototype.result_add_group=function(e){var t,s;return(e.search_match||e.group_match)&&e.active_options>0?((t=[]).push("group-result"),e.classes&&t.push(e.classes),s=document.createElement("li"),s.className=t.join(" "),s.innerHTML=e.highlighted_html||this.escape_html(e.label),e.title&&(s.title=e.title),this.outerHTML(s)):""},e.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},e.prototype.reset_single_select_options=function(){var e,t,s,i,r;for(r=[],e=0,t=(s=this.results_data).length;e<t;e++)(i=s[e]).selected?r.push(i.selected=!1):r.push(void 0);return r},e.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},e.prototype.results_search=function(e){return this.results_showing?this.winnow_results():this.results_show()},e.prototype.winnow_results=function(e){var t,s,i,r,n,o,l,h,c,a,_,u,d,p,f;for(this.no_results_clear(),a=0,t=(l=this.get_search_text()).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),c=this.get_search_regex(t),i=0,r=(h=this.results_data).length;i<r;i++)(n=h[i]).search_match=!1,_=null,u=null,n.highlighted_html="",this.include_option_in_results(n)&&(n.group&&(n.group_match=!1,n.active_options=0),null!=n.group_array_index&&this.results_data[n.group_array_index]&&(0===(_=this.results_data[n.group_array_index]).active_options&&_.search_match&&(a+=1),_.active_options+=1),f=n.group?n.label:n.text,n.group&&!this.group_search||(u=this.search_string_match(f,c),n.search_match=null!=u,n.search_match&&!n.group&&(a+=1),n.search_match?(l.length&&(d=u.index,o=f.slice(0,d),s=f.slice(d,d+l.length),p=f.slice(d+l.length),n.highlighted_html=this.escape_html(o)+"<em>"+this.escape_html(s)+"</em>"+this.escape_html(p)),null!=_&&(_.group_match=!0)):null!=n.group_array_index&&this.results_data[n.group_array_index].search_match&&(n.search_match=!0)));return this.result_clear_highlight(),a<1&&l.length?(this.update_results_content(""),this.no_results(l)):(this.update_results_content(this.results_option_build()),(null!=e?e.skip_highlight:void 0)?void 0:this.winnow_results_set_highlight())},e.prototype.get_search_regex=function(e){var t,s;return s=this.search_contains?e:"(^|\\s|\\b)"+e+"[^\\s]*",this.enable_split_word_search||this.search_contains||(s="^"+s),t=this.case_sensitive_search?"":"i",new RegExp(s,t)},e.prototype.search_string_match=function(e,t){var s;return s=t.exec(e),!this.search_contains&&(null!=s?s[1]:void 0)&&(s.index+=1),s},e.prototype.choices_count=function(){var e,t,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,e=0,t=(s=this.form_field.options).length;e<t;e++)s[e].selected&&(this.selected_option_count+=1);return this.selected_option_count},e.prototype.choices_click=function(e){if(e.preventDefault(),this.activate_field(),!this.results_showing&&!this.is_disabled)return this.results_show()},e.prototype.keydown_checker=function(e){var t,s;switch(s=null!=(t=e.which)?t:e.keyCode,this.search_field_scale(),8!==s&&this.pending_backstroke&&this.clear_backstroke(),s){case 8:this.backstroke_length=this.get_search_field_value().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(e),this.mouse_on_container=!1;break;case 13:case 27:this.results_showing&&e.preventDefault();break;case 32:this.disable_search&&e.preventDefault();break;case 38:e.preventDefault(),this.keyup_arrow();break;case 40:e.preventDefault(),this.keydown_arrow()}},e.prototype.keyup_checker=function(e){var t,s;switch(s=null!=(t=e.which)?t:e.keyCode,this.search_field_scale(),s){case 8:this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:e.preventDefault(),this.results_showing&&this.result_select(e);break;case 27:this.results_showing&&this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}},e.prototype.clipboard_event_checker=function(e){if(!this.is_disabled)return setTimeout(function(e){return function(){return e.results_search()}}(this),50)},e.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},e.prototype.include_option_in_results=function(e){return!(this.is_multiple&&!this.display_selected_options&&e.selected)&&(!(!this.display_disabled_options&&e.disabled)&&!e.empty)},e.prototype.search_results_touchstart=function(e){return this.touch_started=!0,this.search_results_mouseover(e)},e.prototype.search_results_touchmove=function(e){return this.touch_started=!1,this.search_results_mouseout(e)},e.prototype.search_results_touchend=function(e){if(this.touch_started)return this.search_results_mouseup(e)},e.prototype.outerHTML=function(e){var t;return e.outerHTML?e.outerHTML:((t=document.createElement("div")).appendChild(e),t.innerHTML)},e.prototype.get_single_html=function(){return'<a class="chosen-single chosen-default">\n  <span>'+this.default_text+'</span>\n  <div><b></b></div>\n</a>\n<div class="chosen-drop">\n  <div class="chosen-search">\n    <input class="chosen-search-input" type="text" autocomplete="off" />\n  </div>\n  <ul class="chosen-results"></ul>\n</div>'},e.prototype.get_multi_html=function(){return'<ul class="chosen-choices">\n  <li class="search-field">\n    <input class="chosen-search-input" type="text" autocomplete="off" value="'+this.default_text+'" />\n  </li>\n</ul>\n<div class="chosen-drop">\n  <ul class="chosen-results"></ul>\n</div>'},e.prototype.get_no_results_html=function(e){return'<li class="no-results">\n  '+this.results_none_found+" <span>"+this.escape_html(e)+"</span>\n</li>"},e.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:!(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent))},e.default_multiple_text="Select Some Options",e.default_single_text="Select an Option",e.default_no_result_text="No results match",e}(),this.Chosen=function(s){function r(){return r.__super__.constructor.apply(this,arguments)}var n;return i(r,e),r.prototype.setup=function(){return this.current_selectedIndex=this.form_field.selectedIndex},r.prototype.set_up_html=function(){var e,t;return(e=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&e.push(this.form_field.className),this.is_rtl&&e.push("chosen-rtl"),t={class:e.join(" "),title:this.form_field.title},this.form_field.id.length&&(t.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=new Element("div",t),this.container.setStyle({width:this.container_width()}),this.is_multiple?this.container.update(this.get_multi_html()):this.container.update(this.get_single_html()),this.form_field.hide().insert({after:this.container}),this.dropdown=this.container.down("div.chosen-drop"),this.search_field=this.container.down("input"),this.search_results=this.container.down("ul.chosen-results"),this.search_field_scale(),this.search_no_results=this.container.down("li.no-results"),this.is_multiple?(this.search_choices=this.container.down("ul.chosen-choices"),this.search_container=this.container.down("li.search-field")):(this.search_container=this.container.down("div.chosen-search"),this.selected_item=this.container.down(".chosen-single")),this.results_build(),this.set_tab_index(),this.set_label_behavior()},r.prototype.on_ready=function(){return this.form_field.fire("chosen:ready",{chosen:this})},r.prototype.register_observers=function(){return this.container.observe("touchstart",function(e){return function(t){return e.container_mousedown(t)}}(this)),this.container.observe("touchend",function(e){return function(t){return e.container_mouseup(t)}}(this)),this.container.observe("mousedown",function(e){return function(t){return e.container_mousedown(t)}}(this)),this.container.observe("mouseup",function(e){return function(t){return e.container_mouseup(t)}}(this)),this.container.observe("mouseenter",function(e){return function(t){return e.mouse_enter(t)}}(this)),this.container.observe("mouseleave",function(e){return function(t){return e.mouse_leave(t)}}(this)),this.search_results.observe("mouseup",function(e){return function(t){return e.search_results_mouseup(t)}}(this)),this.search_results.observe("mouseover",function(e){return function(t){return e.search_results_mouseover(t)}}(this)),this.search_results.observe("mouseout",function(e){return function(t){return e.search_results_mouseout(t)}}(this)),this.search_results.observe("mousewheel",function(e){return function(t){return e.search_results_mousewheel(t)}}(this)),this.search_results.observe("DOMMouseScroll",function(e){return function(t){return e.search_results_mousewheel(t)}}(this)),this.search_results.observe("touchstart",function(e){return function(t){return e.search_results_touchstart(t)}}(this)),this.search_results.observe("touchmove",function(e){return function(t){return e.search_results_touchmove(t)}}(this)),this.search_results.observe("touchend",function(e){return function(t){return e.search_results_touchend(t)}}(this)),this.form_field.observe("chosen:updated",function(e){return function(t){return e.results_update_field(t)}}(this)),this.form_field.observe("chosen:activate",function(e){return function(t){return e.activate_field(t)}}(this)),this.form_field.observe("chosen:open",function(e){return function(t){return e.container_mousedown(t)}}(this)),this.form_field.observe("chosen:close",function(e){return function(t){return e.close_field(t)}}(this)),this.search_field.observe("blur",function(e){return function(t){return e.input_blur(t)}}(this)),this.search_field.observe("keyup",function(e){return function(t){return e.keyup_checker(t)}}(this)),this.search_field.observe("keydown",function(e){return function(t){return e.keydown_checker(t)}}(this)),this.search_field.observe("focus",function(e){return function(t){return e.input_focus(t)}}(this)),this.search_field.observe("cut",function(e){return function(t){return e.clipboard_event_checker(t)}}(this)),this.search_field.observe("paste",function(e){return function(t){return e.clipboard_event_checker(t)}}(this)),this.is_multiple?this.search_choices.observe("click",function(e){return function(t){return e.choices_click(t)}}(this)):this.container.observe("click",function(e){return e.preventDefault()})},r.prototype.destroy=function(){var e,t,s,i;for(this.container.ownerDocument.stopObserving("click",this.click_test_action),t=0,s=(i=["chosen:updated","chosen:activate","chosen:open","chosen:close"]).length;t<s;t++)e=i[t],this.form_field.stopObserving(e);return this.container.stopObserving(),this.search_results.stopObserving(),this.search_field.stopObserving(),null!=this.form_field_label&&this.form_field_label.stopObserving(),this.is_multiple?(this.search_choices.stopObserving(),this.container.select(".search-choice-close").each(function(e){return e.stopObserving()})):this.selected_item.stopObserving(),this.search_field.tabIndex&&(this.form_field.tabIndex=this.search_field.tabIndex),this.container.remove(),this.form_field.show()},r.prototype.search_field_disabled=function(){var e;return this.is_disabled=this.form_field.disabled||(null!=(e=this.form_field.up("fieldset"))?e.disabled:void 0)||!1,this.is_disabled?this.container.addClassName("chosen-disabled"):this.container.removeClassName("chosen-disabled"),this.search_field.disabled=this.is_disabled,this.is_multiple||this.selected_item.stopObserving("focus",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.observe("focus",this.activate_field)},r.prototype.container_mousedown=function(e){var t;if(!this.is_disabled)return!e||"mousedown"!==(t=e.type)&&"touchstart"!==t||this.results_showing||e.preventDefault(),null!=e&&e.target.hasClassName("search-choice-close")?void 0:(this.active_field?this.is_multiple||!e||e.target!==this.selected_item&&!e.target.up("a.chosen-single")||this.results_toggle():(this.is_multiple&&this.search_field.clear(),this.container.ownerDocument.observe("click",this.click_test_action),this.results_show()),this.activate_field())},r.prototype.container_mouseup=function(e){if("ABBR"===e.target.nodeName&&!this.is_disabled)return this.results_reset(e)},r.prototype.search_results_mousewheel=function(e){var t;if(null!=(t=e.deltaY||-e.wheelDelta||e.detail))return e.preventDefault(),"DOMMouseScroll"===e.type&&(t*=40),this.search_results.scrollTop=t+this.search_results.scrollTop},r.prototype.blur_test=function(e){if(!this.active_field&&this.container.hasClassName("chosen-container-active"))return this.close_field()},r.prototype.close_field=function(){return this.container.ownerDocument.stopObserving("click",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClassName("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()},r.prototype.activate_field=function(){if(!this.is_disabled)return this.container.addClassName("chosen-container-active"),this.active_field=!0,this.search_field.value=this.get_search_field_value(),this.search_field.focus()},r.prototype.test_active_click=function(e){return e.target.up(".chosen-container")===this.container?this.active_field=!0:this.close_field()},r.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=t.select_to_array(this.form_field),this.is_multiple?this.search_choices.select("li.search-choice").invoke("remove"):(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field.readOnly=!0,this.container.addClassName("chosen-container-single-nosearch")):(this.search_field.readOnly=!1,this.container.removeClassName("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},r.prototype.result_do_highlight=function(e){var t,s,i,r,n;return this.result_clear_highlight(),this.result_highlight=e,this.result_highlight.addClassName("highlighted"),i=parseInt(this.search_results.getStyle("maxHeight"),10),n=this.search_results.scrollTop,r=i+n,s=this.result_highlight.positionedOffset().top,(t=s+this.result_highlight.getHeight())>=r?this.search_results.scrollTop=t-i>0?t-i:0:s<n?this.search_results.scrollTop=s:void 0},r.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClassName("highlighted"),this.result_highlight=null},r.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field.fire("chosen:maxselected",{chosen:this}),!1):(this.container.addClassName("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.value=this.get_search_field_value(),this.winnow_results(),this.form_field.fire("chosen:showing_dropdown",{chosen:this}))},r.prototype.update_results_content=function(e){return this.search_results.update(e)},r.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClassName("chosen-with-drop"),this.form_field.fire("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},r.prototype.set_tab_index=function(e){var t;if(this.form_field.tabIndex)return t=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field.tabIndex=t},r.prototype.set_label_behavior=function(){if(this.form_field_label=this.form_field.up("label"),null==this.form_field_label&&(this.form_field_label=$$("label[for='"+this.form_field.id+"']").first()),null!=this.form_field_label)return this.form_field_label.observe("click",this.label_click_handler)},r.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.value=this.default_text,this.search_field.addClassName("default")):(this.search_field.value="",this.search_field.removeClassName("default"))},r.prototype.search_results_mouseup=function(e){var t;if(t=e.target.hasClassName("active-result")?e.target:e.target.up(".active-result"))return this.result_highlight=t,this.result_select(e),this.search_field.focus()},r.prototype.search_results_mouseover=function(e){var t;if(t=e.target.hasClassName("active-result")?e.target:e.target.up(".active-result"))return this.result_do_highlight(t)},r.prototype.search_results_mouseout=function(e){if(e.target.hasClassName("active-result")||e.target.up(".active-result"))return this.result_clear_highlight()},r.prototype.choice_build=function(e){var t,s;return t=new Element("li",{class:"search-choice"}).update("<span>"+this.choice_label(e)+"</span>"),e.disabled?t.addClassName("search-choice-disabled"):((s=new Element("a",{href:"#",class:"search-choice-close",rel:e.array_index})).observe("click",function(e){return function(t){return e.choice_destroy_link_click(t)}}(this)),t.insert(s)),this.search_container.insert({before:t})},r.prototype.choice_destroy_link_click=function(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(e.target)},r.prototype.choice_destroy=function(e){if(this.result_deselect(e.readAttribute("rel")))return this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.get_search_field_value().length<1&&this.results_hide(),e.up("li").remove(),this.search_field_scale()},r.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field)return this.results_hide()},r.prototype.results_reset_cleanup=function(){var e;if(this.current_selectedIndex=this.form_field.selectedIndex,e=this.selected_item.down("abbr"))return e.remove()},r.prototype.result_select=function(e){var t,s;if(this.result_highlight)return t=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field.fire("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?t.removeClassName("active-result"):this.reset_single_select_options(),t.addClassName("result-selected"),s=this.results_data[t.getAttribute("data-option-array-index")],s.selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(s):this.single_set_selected_text(this.choice_label(s)),this.is_multiple&&(!this.hide_results_on_select||e.metaKey||e.ctrlKey)?e.metaKey||e.ctrlKey?this.winnow_results({skip_highlight:!0}):(this.search_field.value="",this.winnow_results()):(this.results_hide(),this.show_search_field_default()),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.trigger_form_field_change(),this.current_selectedIndex=this.form_field.selectedIndex,e.preventDefault(),this.search_field_scale())},r.prototype.single_set_selected_text=function(e){return null==e&&(e=this.default_text),e===this.default_text?this.selected_item.addClassName("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClassName("chosen-default")),this.selected_item.down("span").update(e)},r.prototype.result_deselect=function(e){var t;return t=this.results_data[e],!this.form_field.options[t.options_index].disabled&&(t.selected=!1,this.form_field.options[t.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.trigger_form_field_change(),this.search_field_scale(),!0)},r.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.down("abbr")||this.selected_item.down("span").insert({after:'<abbr class="search-choice-close"></abbr>'}),this.selected_item.addClassName("chosen-single-with-deselect")},r.prototype.get_search_field_value=function(){return this.search_field.value},r.prototype.get_search_text=function(){return this.get_search_field_value().strip()},r.prototype.escape_html=function(e){return e.escapeHTML()},r.prototype.winnow_results_set_highlight=function(){var e;if(this.is_multiple||(e=this.search_results.down(".result-selected.active-result")),null==e&&(e=this.search_results.down(".active-result")),null!=e)return this.result_do_highlight(e)},r.prototype.no_results=function(e){return this.search_results.insert(this.get_no_results_html(e)),this.form_field.fire("chosen:no_results",{chosen:this})},r.prototype.no_results_clear=function(){var e,t;for(e=null,t=[];e=this.search_results.down(".no-results");)t.push(e.remove());return t},r.prototype.keydown_arrow=function(){var e;return this.results_showing&&this.result_highlight?(e=this.result_highlight.next(".active-result"))?this.result_do_highlight(e):void 0:this.results_show()},r.prototype.keyup_arrow=function(){var e,t,s;return this.results_showing||this.is_multiple?this.result_highlight?(s=this.result_highlight.previousSiblings(),e=this.search_results.select("li.active-result"),(t=s.intersect(e)).length?this.result_do_highlight(t.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},r.prototype.keydown_backstroke=function(){var e;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.down("a")),this.clear_backstroke()):(e=this.search_container.siblings().last())&&e.hasClassName("search-choice")&&!e.hasClassName("search-choice-disabled")?(this.pending_backstroke=e,this.pending_backstroke&&this.pending_backstroke.addClassName("search-choice-focus"),this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClassName("search-choice-focus")):void 0},r.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClassName("search-choice-focus"),this.pending_backstroke=null},r.prototype.search_field_scale=function(){var e,t,s,i,r,n,o,l;if(this.is_multiple){for(n={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},s=0,i=(o=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"]).length;s<i;s++)n[r=o[s]]=this.search_field.getStyle(r);return(t=new Element("div").update(this.escape_html(this.get_search_field_value()))).setStyle(n),document.body.appendChild(t),l=t.measure("width")+25,t.remove(),(e=this.container.getWidth())&&(l=Math.min(e-10,l)),this.search_field.setStyle({width:l+"px"})}},r.prototype.trigger_form_field_change=function(){return n(this.form_field,"input"),n(this.form_field,"change")},n=function(e,t){var s;if(e.dispatchEvent){try{s=new Event(t,{bubbles:!0,cancelable:!0})}catch(e){(s=document.createEvent("HTMLEvents")).initEvent(t,!0,!0)}return e.dispatchEvent(s)}return e.fireEvent("on"+t,document.createEventObject())},r}()}).call(this);
  • _plugins_/chosen/trunk/lib/chosen/docsupport/style.css

    r98557 r113714  
    203203  text-decoration: none;
    204204}
     205
     206.select,
     207.chosen-select,
     208.chosen-select-no-single,
     209.chosen-select-no-results,
     210.chosen-select-deselect,
     211.chosen-select-rtl,
     212.chosen-select-width {
     213  width: 350px;
     214}
     215
     216.jquery-version-refer {
     217  margin-top: 40px;
     218  font-style: italic;
     219}
  • _plugins_/chosen/trunk/lib/chosen/index.html

    r98557 r113714  
    77  <link rel="stylesheet" href="docsupport/prism.css">
    88  <link rel="stylesheet" href="chosen.css">
    9   <style type="text/css" media="all">
    10     /* fix rtl for demo */
    11     .chosen-rtl .chosen-drop { left: -9000px; }
    12   </style>
     9
     10  <meta http-equiv="Content-Security-Policy" content="default-src &apos;self&apos;; script-src &apos;self&apos; https://ajax.googleapis.com; style-src &apos;self&apos;; img-src &apos;self&apos; data:">
     11
    1312</head>
    1413<body>
     
    1716      <div id="content">
    1817        <header>
    19           <h1>Chosen <small>(<span id="latest-version">v1.6.1</span>)</small></h1>
     18          <h1>Chosen <small>(<span id="latest-version">v1.8.7</span>)</small></h1>
    2019        </header>
    2120        <p>Chosen is a jQuery plugin that makes long, unwieldy select boxes much more user-friendly.</p>
     
    3130        <div>
    3231          <em>Turns This</em>
    33           <select data-placeholder="Choose a Country..." style="width:350px;" tabindex="1">
     32          <select data-placeholder="Choose a Country..." class="select" tabindex="1">
    3433            <option value=""></option>
    3534            <option value="United States">United States</option>
     
    288287        <div>
    289288          <em>Into This</em>
    290           <select data-placeholder="Choose a Country..." class="chosen-select" style="width:350px;" tabindex="2">
     289          <select data-placeholder="Choose a Country..." class="chosen-select" tabindex="2">
    291290            <option value=""></option>
    292291            <option value="United States">United States</option>
     
    549548        <div>
    550549          <em>Turns This</em>
    551           <select data-placeholder="Choose a Country..." style="width:350px;" multiple tabindex="3">
     550          <select data-placeholder="Choose a Country..." class="select" multiple tabindex="3">
    552551            <option value=""></option>
    553552            <option value="United States">United States</option>
     
    806805        <div>
    807806          <em>Into This</em>
    808           <select data-placeholder="Choose a Country..." class="chosen-select" multiple style="width:350px;" tabindex="4">
     807          <select data-placeholder="Choose a Country..." class="chosen-select" multiple tabindex="4">
    809808            <option value=""></option>
    810809            <option value="United States">United States</option>
     
    10671066        <div>
    10681067          <em>Single Select with Groups</em>
    1069           <select data-placeholder="Your Favorite Football Team" style="width:350px;" class="chosen-select" tabindex="5">
     1068          <select data-placeholder="Your Favorite Football Team" class="chosen-select" tabindex="5">
    10701069            <option value=""></option>
    10711070            <optgroup label="NFC EAST">
     
    11211120        <div>
    11221121          <em>Multiple Select with Groups</em>
    1123           <select data-placeholder="Your Favorite Football Team" style="width:350px;" class="chosen-select" multiple tabindex="6">
     1122          <select data-placeholder="Your Favorite Football Team" class="chosen-select" multiple tabindex="6">
    11241123            <option value=""></option>
    11251124            <optgroup label="NFC EAST">
     
    11801179        <div>
    11811180          <em>Single Select</em>
    1182           <select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select" tabindex="7">
     1181          <select data-placeholder="Your Favorite Type of Bear" class="chosen-select" tabindex="7">
    11831182            <option value=""></option>
    11841183            <option>American Black Bear</option>
     
    11941193        <div>
    11951194          <em>Multiple Select</em>
    1196           <select data-placeholder="Your Favorite Types of Bear" style="width:350px;" multiple class="chosen-select" tabindex="8">
     1195          <select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select" tabindex="8">
    11971196            <option value=""></option>
    11981197            <option>American Black Bear</option>
     
    12141213        <p></p>
    12151214        <div>
    1216           <select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select-no-single" tabindex="9">
     1215          <select data-placeholder="Your Favorite Type of Bear" class="chosen-select-no-single" tabindex="9">
    12171216            <option value=""></option>
    12181217            <option>American Black Bear</option>
     
    12321231      <div class="side-by-side clearfix">
    12331232        <p>Chosen automatically sets the default field text ("Choose a country...") by reading the select element's data-placeholder value. If no data-placeholder value is present, it will default to "Select an Option" or "Select Some Options" depending on whether the select is single or multiple. You can change these elements in the plugin js file as you see fit.</p>
    1234         <pre><code class="language-markup">&lt;select <strong>data-placeholder="Choose a country..."</strong> style="width:350px;" multiple class="chosen-select"&gt;</code></pre>
     1233        <pre><code class="language-markup">&lt;select <strong>data-placeholder="Choose a country..."</strong> multiple class="chosen-select"&gt;</code></pre>
    12351234        <p><strong>Note:</strong> on single selects, the first element is assumed to be selected by the browser. To take advantage of the default text support, you will need to include a blank option as the first element of your select list.</p>
    12361235      </div>
     
    12431242        <div>
    12441243          <em>Single Select</em>
    1245           <select data-placeholder="Type &apos;C&apos; to view" style="width:350px;" class="chosen-select-no-results" tabindex="10">
     1244          <select data-placeholder="Type &apos;C&apos; to view" class="chosen-select-no-results" tabindex="10">
    12461245            <option value=""></option>
    12471246            <option>American Black Bear</option>
     
    12571256        <div>
    12581257          <em>Multiple Select</em>
    1259           <select data-placeholder="Type &apos;C&apos; to view" style="width:350px;" multiple class="chosen-select-no-results" tabindex="11">
     1258          <select data-placeholder="Type &apos;C&apos; to view" multiple class="chosen-select-no-results" tabindex="11">
    12601259            <option value=""></option>
    12611260            <option>American Black Bear</option>
     
    12831282        <p>When a single select box isn't a required field, you can set <code class="language-javascript">allow_single_deselect: true</code> and Chosen will add a UI element for option deselection. This will only work if the first option has blank text.</p>
    12841283        <div class="side-by-side clearfix">
    1285           <select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select-deselect" tabindex="12">
     1284          <select data-placeholder="Your Favorite Type of Bear" class="chosen-select-deselect" tabindex="12">
    12861285            <option value=""></option>
    12871286            <option>American Black Bear</option>
     
    12971296      </div>
    12981297
    1299       <h2><a name="right-to-left-support" class="anchor" href="#right-to-left-support">Right to Left Support</a></h2>
     1298      <h2><a name="right-to-left-support" class="anchor" href="#right-to-left-support">Right-to-Left Support</a></h2>
    13001299      <div class="side-by-side clearfix">
    1301         <p>Chosen supports right to left select boxes too. just add <code class="language-javascript">"chosen-rtl"</code> in addition to <code class="language-javascript">"chosen-select"</code> to your select tags and you are good to go.</p>
    1302         <pre><code class="language-markup">&lt;select class="chosen-select <strong>chosen-rtl</strong>"&gt;</code></pre>
    1303         <div>
    1304           <em>Single right to left select</em>
    1305           <select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select chosen-rtl" tabindex="13">
     1300        <p>You can set right-to-left text by setting <code class="language-javascript">rtl: true</code></p>
     1301        <pre><code class="language-javascript"> $(".chosen-select").chosen({rtl: true}); </code></pre>
     1302
     1303        <div>
     1304          <em>Single Right-to-Left Select</em>
     1305          <select data-placeholder="Your Favorite Type of Bear" class="chosen-select-rtl" tabindex="13">
    13061306            <option value=""></option>
    13071307            <option>American Black Bear</option>
     
    13141314        </div>
    13151315        <div>
    1316           <em>Multiple right to left select</em>
    1317           <select data-placeholder="Your Favorite Types of Bear" style="width:350px;" multiple class="chosen-select  chosen-rtl" tabindex="14">
     1316          <em>Multiple Right-to-Left Select</em>
     1317          <select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select-rtl" tabindex="14">
    13181318            <option value=""></option>
    13191319            <option>American Black Bear</option>
     
    13881388        <div>
    13891389          <em><label for="single-label-example">Click to Highlight Single Select</label></em>
    1390           <select data-placeholder="Your Favorite Types of Bear" class="chosen-select" style="width:350px;" tabindex="17" id="single-label-example">
     1390          <select data-placeholder="Your Favorite Types of Bear" class="chosen-select" tabindex="17" id="single-label-example">
    13911391            <option value=""></option>
    13921392            <option selected>American Black Bear</option>
     
    14021402        <div>
    14031403          <em><label for="multiple-label-example">Click to Highlight Multiple Select</label></em>
    1404           <select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select" style="width:350px;" tabindex="18" id="multiple-label-example">
     1404          <select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select" tabindex="18" id="multiple-label-example">
    14051405            <option value=""></option>
    14061406            <option>American Black Bear</option>
     
    14591459    </div>
    14601460  </div>
    1461   <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
     1461  <script src="docsupport/jquery-3.2.1.min.js" type="text/javascript"></script>
    14621462  <script src="chosen.jquery.js" type="text/javascript"></script>
    14631463  <script src="docsupport/prism.js" type="text/javascript" charset="utf-8"></script>
    1464   <script type="text/javascript">
    1465     var config = {
    1466       '.chosen-select'           : {},
    1467       '.chosen-select-deselect'  : {allow_single_deselect:true},
    1468       '.chosen-select-no-single' : {disable_search_threshold:10},
    1469       '.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
    1470       '.chosen-select-width'     : {width:"95%"}
    1471     }
    1472     for (var selector in config) {
    1473       $(selector).chosen(config[selector]);
    1474     }
    1475   </script>
     1464  <script src="docsupport/init.js" type="text/javascript" charset="utf-8"></script>
    14761465  </form>
    14771466  <div class="oss-bar">
  • _plugins_/chosen/trunk/lib/chosen/index.proto.html

    r98557 r113714  
    77  <link rel="stylesheet" href="docsupport/prism.css">
    88  <link rel="stylesheet" href="chosen.css">
    9   <style type="text/css" media="all">
    10     /* fix rtl for demo */
    11     .chosen-rtl .chosen-drop { left: -9000px; }
    12   </style>
     9
     10  <meta http-equiv="Content-Security-Policy" content="default-src &apos;self&apos;; script-src &apos;self&apos; https://ajax.googleapis.com; style-src &apos;self&apos;; img-src &apos;self&apos; data:">
     11
    1312</head>
    1413<body>
     
    1615    <div id="content">
    1716      <header>
    18         <h1>Chosen - Prototype Version <small>(<span id="latest-version">v1.6.1</span>)</small></h1>
     17        <h1>Chosen - Prototype Version <small>(<span id="latest-version">v1.8.7</span>)</small></h1>
    1918      </header>
    2019      <p>Chosen is a Prototype plugin that makes long, unwieldy select boxes much more user-friendly.</p>
     
    2625      </p>
    2726
    28       <p style="margin-top: 40px; font-style: italic;">Looking for the <a href="index.html">jQuery version?</a></p>
     27      <p class="jquery-version-refer">Looking for the <a href="index.html">jQuery version?</a></p>
    2928
    3029      <h2><a name="standard-select" class="anchor" href="#standard-select">Standard Select</a></h2>
     
    3231        <div>
    3332          <em>Turns This</em>
    34           <select data-placeholder="Choose a Country..." style="width:350px;" tabindex="1">
     33          <select data-placeholder="Choose a Country..." class="select" tabindex="1">
    3534            <option value=""></option>
    3635            <option value="United States">United States</option>
     
    289288        <div>
    290289          <em>Into This</em>
    291           <select data-placeholder="Choose a Country..." class="chosen-select" style="width:350px;" tabindex="2">
     290          <select data-placeholder="Choose a Country..." class="chosen-select" tabindex="2">
    292291            <option value=""></option>
    293292            <option value="United States">United States</option>
     
    550549        <div>
    551550          <em>Turns This</em>
    552           <select data-placeholder="Choose a Country..." style="width:350px;" multiple tabindex="3">
     551          <select data-placeholder="Choose a Country..." class="select" multiple tabindex="3">
    553552            <option value=""></option>
    554553            <option value="United States">United States</option>
     
    807806        <div>
    808807          <em>Into This</em>
    809           <select data-placeholder="Choose a Country..." class="chosen-select" multiple style="width:350px;" tabindex="4">
     808          <select data-placeholder="Choose a Country..." class="chosen-select" multiple tabindex="4">
    810809            <option value=""></option>
    811810            <option value="United States">United States</option>
     
    10681067        <div>
    10691068          <em>Single Select with Groups</em>
    1070           <select data-placeholder="Your Favorite Football Team" style="width:350px;" class="chosen-select" tabindex="5">
     1069          <select data-placeholder="Your Favorite Football Team" class="chosen-select" tabindex="5">
    10711070            <option value=""></option>
    10721071            <optgroup label="NFC EAST">
     
    11221121        <div>
    11231122          <em>Multiple Select with Groups</em>
    1124           <select data-placeholder="Your Favorite Football Team" style="width:350px;" class="chosen-select" multiple tabindex="6">
     1123          <select data-placeholder="Your Favorite Football Team" class="chosen-select" multiple tabindex="6">
    11251124            <option value=""></option>
    11261125            <optgroup label="NFC EAST">
     
    11811180        <div>
    11821181          <em>Single Select</em>
    1183           <select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select" tabindex="7">
     1182          <select data-placeholder="Your Favorite Type of Bear" class="chosen-select" tabindex="7">
    11841183            <option value=""></option>
    11851184            <option>American Black Bear</option>
     
    11951194        <div>
    11961195          <em>Multiple Select</em>
    1197           <select data-placeholder="Your Favorite Types of Bear" style="width:350px;" multiple class="chosen-select" tabindex="8">
     1196          <select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select" tabindex="8">
    11981197            <option value=""></option>
    11991198            <option>American Black Bear</option>
     
    12151214        <p></p>
    12161215        <div>
    1217           <select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select-no-single" tabindex="9">
     1216          <select data-placeholder="Your Favorite Type of Bear" class="chosen-select-no-single" tabindex="9">
    12181217            <option value=""></option>
    12191218            <option>American Black Bear</option>
     
    12331232      <div class="side-by-side clearfix">
    12341233        <p>Chosen automatically sets the default field text ("Choose a country...") by reading the select element's data-placeholder value. If no data-placeholder value is present, it will default to "Select an Option" or "Select Some Options" depending on whether the select is single or multiple. You can change these elements in the plugin js file as you see fit.</p>
    1235         <pre><code class="language-markup">&lt;select <strong>data-placeholder="Choose a country..."</strong> style="width:350px;" multiple class="chosen-select"&gt;</code></pre>
     1234        <pre><code class="language-markup">&lt;select <strong>data-placeholder="Choose a country..."</strong> multiple class="chosen-select"&gt;</code></pre>
    12361235        <p><strong>Note:</strong> on single selects, the first element is assumed to be selected by the browser. To take advantage of the default text support, you will need to include a blank option as the first element of your select list.</p>
    12371236      </div>
     
    12441243        <div>
    12451244          <em>Single Select</em>
    1246           <select data-placeholder="Type &apos;C&apos; to view" style="width:350px;" class="chosen-select-no-results" tabindex="10">
     1245          <select data-placeholder="Type &apos;C&apos; to view" class="chosen-select-no-results" tabindex="10">
    12471246            <option value=""></option>
    12481247            <option>American Black Bear</option>
     
    12581257        <div>
    12591258          <em>Multiple Select</em>
    1260           <select data-placeholder="Type &apos;C&apos; to view" style="width:350px;" multiple class="chosen-select-no-results" tabindex="11">
     1259          <select data-placeholder="Type &apos;C&apos; to view" multiple class="chosen-select-no-results" tabindex="11">
    12611260            <option value=""></option>
    12621261            <option>American Black Bear</option>
     
    12841283        <p>When a single select box isn't a required field, you can set <code class="language-javascript">allow_single_deselect: true</code> and Chosen will add a UI element for option deselection. This will only work if the first option has blank text.</p>
    12851284        <div class="side-by-side clearfix">
    1286           <select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select-deselect" tabindex="12">
     1285          <select data-placeholder="Your Favorite Type of Bear" class="chosen-select-deselect" tabindex="12">
    12871286            <option value=""></option>
    12881287            <option>American Black Bear</option>
     
    12981297      </div>
    12991298
    1300       <h2><a name="right-to-left-support" class="anchor" href="#right-to-left-support">Right to Left Support</a></h2>
     1299      <h2><a name="right-to-left-support" class="anchor" href="#right-to-left-support">Right-to-Left Support</a></h2>
    13011300      <div class="side-by-side clearfix">
    1302         <p>Chosen supports right to left select boxes too. just add <code class="language-markup">"chosen-rtl"</code> in addition to <code class="language-markup">"chosen-select"</code> to your select tags and you are good to go.</p>
    1303         <pre><code class="language-markup">&lt;select class="chosen-select <strong>chosen-rtl</strong>"&gt;</code></pre>
    1304         <div>
    1305           <em>Single right to left select</em>
    1306           <select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select chosen-rtl" tabindex="13">
     1301        <p>You can set right-to-left text by setting <code class="language-javascript">rtl: true</code></p>
     1302        <pre><code class="language-javascript"> $(".chosen-select").chosen({rtl: true}); </code></pre>
     1303        <div>
     1304          <em>Single Right-to-Left Select</em>
     1305          <select data-placeholder="Your Favorite Type of Bear" class="chosen-select-rtl" tabindex="13">
    13071306            <option value=""></option>
    13081307            <option>American Black Bear</option>
     
    13151314        </div>
    13161315        <div>
    1317           <em>Multiple right to left select</em>
    1318           <select data-placeholder="Your Favorite Types of Bear" style="width:350px;" multiple class="chosen-select  chosen-rtl" tabindex="14">
     1316          <em>Multiple Right-to-Left Select</em>
     1317          <select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select-rtl" tabindex="14">
    13191318            <option value=""></option>
    13201319            <option>American Black Bear</option>
     
    13931392        <div>
    13941393          <em><label for="single-label-example">Click to Highlight Single Select</label></em>
    1395           <select data-placeholder="Your Favorite Types of Bear" class="chosen-select" style="width:350px;" tabindex="17" id="single-label-example">
     1394          <select data-placeholder="Your Favorite Types of Bear" class="chosen-select" tabindex="17" id="single-label-example">
    13961395            <option value=""></option>
    13971396            <option selected>American Black Bear</option>
     
    14071406        <div>
    14081407          <em><label for="multiple-label-example">Click to Highlight Multiple Select</label></em>
    1409           <select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select" style="width:350px;" tabindex="18" id="multiple-label-example">
     1408          <select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select" tabindex="18" id="multiple-label-example">
    14101409            <option value=""></option>
    14111410            <option>American Black Bear</option>
     
    14601459    </div>
    14611460  </div>
    1462   <script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js" type="text/javascript"></script>
     1461  <script src="docsupport/prototype-1.7.0.0.js" type="text/javascript"></script>
    14631462  <script src="chosen.proto.js" type="text/javascript"></script>
    14641463  <script src="docsupport/prism.js" type="text/javascript" charset="utf-8"></script>
    1465   <script type="text/javascript">
    1466   document.observe('dom:loaded', function(evt) {
    1467     var config = {
    1468       '.chosen-select'           : {},
    1469       '.chosen-select-deselect'  : {allow_single_deselect:true},
    1470       '.chosen-select-no-single' : {disable_search_threshold:10},
    1471       '.chosen-select-no-results': {no_results_text: "Oops, nothing found!"},
    1472       '.chosen-select-width'     : {width: "95%"}
    1473     }
    1474     var results = [];
    1475     for (var selector in config) {
    1476       var elements = $$(selector);
    1477       for (var i = 0; i < elements.length; i++) {
    1478         results.push(new Chosen(elements[i],config[selector]));
    1479       }
    1480     }
    1481     return results;
    1482   });
    1483   </script>
     1464  <script src="docsupport/init.proto.js" type="text/javascript" charset="utf-8"></script>
    14841465  <div class="oss-bar">
    14851466    <ul>
  • _plugins_/chosen/trunk/lib/chosen/options.html

    r98557 r113714  
    1616    <div id="content">
    1717      <header>
    18         <h1>Chosen <small>(<span id="latest-version">v1.6.1</span>)</small></h1>
     18        <h1>Chosen <small>(<span id="latest-version">v1.8.7</span>)</small></h1>
    1919      </header>
    2020      <p>Chosen has a number of options and attributes that allow you to have full control of your select boxes.</p>
     
    8888        </tr>
    8989        <tr>
     90          <td>group_search</td>
     91          <td>true</td>
     92          <td>By default, Chosen will search group labels as well as options, and filter to show all options below matching groups. Set this to <code class="language-javascript">false</code> to search only in the options.</td>
     93        </tr>
     94        <tr>
    9095          <td>single_backstroke_delete</td>
    9196          <td>true</td>
     
    128133          <td>false</td>
    129134          <td>
    130             <p>By default Chosen's search is case-insensitive. Setting this option to <code class="language-javascript">true</code> makes the search case-sensitive.</p>
     135            <p>By default, Chosen's search is case-insensitive. Setting this option to <code class="language-javascript">true</code> makes the search case-sensitive.</p>
     136          </td>
     137        </tr>
     138        <tr>
     139          <td>hide_results_on_select</td>
     140          <td>true</td>
     141          <td>
     142            <p>By default, Chosen's results are hidden after a option is selected. Setting this option to <code class="language-javascript">false</code> will keep the results open after selection. This only applies to multiple selects.</p>
     143          </td>
     144        </tr>
     145        <tr>
     146          <td>rtl</td>
     147          <td>false</td>
     148          <td>
     149            <p>Chosen supports right-to-left text in select boxes. Set this option to <code class="language-javascript">true</code> to support right-to-left text options.</p>
     150            <p><strong>Note:</strong> <a href="#classes">the <code class="language-javascript">chosen-rtl</code> class</a> on the select has precedence over this option. However, the classname approach is deprecated and will be removed in future versions of Chosen.</p>
    131151          </td>
    132152        </tr>
     
    190210            <p>Chosen supports right-to-left text in select boxes. Add the class <code class="language-html">chosen-rtl</code> to your select tag to support right-to-left text options.</p>
    191211            <p><strong>Note:</strong> The <code class="language-html">chosen-rtl</code> class will pass through to the Chosen select even when the <code class="language-javascript">inherit_select_classes</code> option is set to <code class="language-javascript">false</code>.</p>
     212            <p><strong>Note:</strong> This is deprecated in favor of using the <code class="language-javascript">rtl: true</code> option (see the <a href="#options">Options section</a>).</p>
    192213          </td>
    193214        </tr>
     
    213234          <td>
    214235            <p>Chosen triggers the standard DOM event whenever a selection is made (it also sends a <code class="language-javascript">selected</code> or <code class="language-javascript">deselected</code> parameter that tells you which option was changed).</p>
    215             <p><strong>Note:</strong> in order to use change in the Prototype version, you have to include the <a href="https://github.com/kangax/protolicious/blob/5b56fdafcd7d7662c9d648534225039b2e78e371/event.simulate.js">Event.simulate</a> class. The selected and deselected parameters are not available for Prototype.</p>
     236            <p><strong>Note:</strong> The selected and deselected parameters are not available for Prototype.</p>
    216237          </td>
    217238        </tr>
     
    262283        <tr>
    263284          <td>chosen:activate</td>
    264           <td>This is the equivalant of focusing a standard HTML select field. When activated, Chosen will capure keypress events as if you had clicked the field directly.</td>
     285          <td>This is the equivalant of focusing a standard HTML select field. When activated, Chosen will capture keypress events as if you had clicked the field directly.</td>
    265286        </tr>
    266287        <tr>
  • _plugins_/chosen/trunk/paquet.xml

    r106566 r113714  
    22        prefix="chosen"
    33        categorie="navigation"
    4         version="1.7.3"
     4        version="1.8.0"
    55        etat="stable"
    66        compatibilite="[3.0.0;3.2.*]"
Note: See TracChangeset for help on using the changeset viewer.