Changeset 113714 in spip-zone


Ignore:
Timestamp:
Feb 1, 2019, 5:40:29 PM (2 years 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);