Changeset 1085102
- Timestamp:
- 02/08/2015 07:30:48 PM (11 years ago)
- Location:
- woocommerce-poor-guys-swiss-knife/trunk
- Files:
-
- 2 added
- 7 edited
-
assets/js/chosen/ajax-chosen.jquery.js (modified) (2 diffs)
-
assets/js/chosen/ajax-chosen.jquery.min.js (modified) (1 diff)
-
assets/js/chosen/chosen-rtl.js (added)
-
assets/js/chosen/chosen-rtl.min.js (added)
-
assets/js/chosen/chosen.jquery.js (modified) (44 diffs)
-
assets/js/chosen/chosen.jquery.min.js (modified) (1 diff)
-
classes/woocommerce-poor-guys-swiss-knife.php (modified) (5 diffs)
-
readme.txt (modified) (4 diffs)
-
woocommerce-poor-guys-swiss-knife.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woocommerce-poor-guys-swiss-knife/trunk/assets/js/chosen/ajax-chosen.jquery.js
r820403 r1085102 20 20 this.chosen(); 21 21 return this.each(function() { 22 return $(this).next('.ch zn-container').find(".search-field > input, .chzn-search > input").bind('keyup', function() {22 return $(this).next('.chosen-container').find(".search-field > input, .chosen-search > input").bind('keyup', function() { 23 23 var field, msg, success, val; 24 24 val = $.trim($(this).attr('value')); 25 25 msg = val.length < options.minTermLength ? "Keep typing..." : "Looking for '" + val + "'"; 26 select.next('.ch zn-container').find('.no-results').text(msg);26 select.next('.chosen-container').find('.no-results').text(msg); 27 27 if (val === $(this).data('prevVal')) { 28 28 return false; … … 63 63 } 64 64 }); 65 select.trigger(" liszt:updated");65 select.trigger("chosen:updated"); 66 66 if (success != null) { 67 67 success(data); -
woocommerce-poor-guys-swiss-knife/trunk/assets/js/chosen/ajax-chosen.jquery.min.js
r820403 r1085102 1 1 // Generated by CoffeeScript 1.3.1 2 (function(e){return e.fn.ajaxChosen=function(t,n){var r,i,s,o;t==null&&(t={});n==null&&(n=function(){});i={minTermLength:3,afterTypeDelay:500,jsonTermKey:"term"};o=this;r=null;s=e.extend({},i,t);this.chosen();return this.each(function(){return e(this).next(".ch zn-container").find(".search-field > input, .chzn-search > input").bind("keyup",function(){var t,i,u,a;a=e.trim(e(this).attr("value"));i=a.length<s.minTermLength?"Keep typing...":"Looking for '"+a+"'";o.next(".chzn-container").find(".no-results").text(i);if(a===e(this).data("prevVal"))return!1;e(this).data("prevVal",a);this.timer&&clearTimeout(this.timer);if(a.length<s.minTermLength)return!1;t=e(this);s.data==null&&(s.data={});s.data[s.jsonTermKey]=a;s.dataCallback!=null&&(s.data=s.dataCallback(s.data));u=s.success;s.success=function(r){var i,s;if(r==null)return;s=[];o.find("option").each(function(){return e(this).is(":selected")?s.push(e(this).val()+"-"+e(this).text()):e(this).remove()});i=n(r);e.each(i,function(t,n){if(e.inArray(t+"-"+n,s)===-1)return e("<option />").attr("value",t).html(n).appendTo(o)});o.trigger("liszt:updated");u!=null&&u(r);t.attr("value",a);return t.css("width","auto")};return this.timer=setTimeout(function(){r&&r.abort();return r=e.ajax(s)},s.afterTypeDelay)})})}})(jQuery);2 (function(e){return e.fn.ajaxChosen=function(t,n){var r,i,s,o;t==null&&(t={});n==null&&(n=function(){});i={minTermLength:3,afterTypeDelay:500,jsonTermKey:"term"};o=this;r=null;s=e.extend({},i,t);this.chosen();return this.each(function(){return e(this).next(".chosen-container").find(".search-field > input, .chosen-search > input").bind("keyup",function(){var t,i,u,a;a=e.trim(e(this).attr("value"));i=a.length<s.minTermLength?"Keep typing...":"Looking for '"+a+"'";o.next(".chosen-container").find(".no-results").text(i);if(a===e(this).data("prevVal"))return!1;e(this).data("prevVal",a);this.timer&&clearTimeout(this.timer);if(a.length<s.minTermLength)return!1;t=e(this);s.data==null&&(s.data={});s.data[s.jsonTermKey]=a;s.dataCallback!=null&&(s.data=s.dataCallback(s.data));u=s.success;s.success=function(r){var i,s;if(r==null)return;s=[];o.find("option").each(function(){return e(this).is(":selected")?s.push(e(this).val()+"-"+e(this).text()):e(this).remove()});i=n(r);e.each(i,function(t,n){if(e.inArray(t+"-"+n,s)===-1)return e("<option />").attr("value",t).html(n).appendTo(o)});o.trigger("chosen:updated");u!=null&&u(r);t.attr("value",a);return t.css("width","auto")};return this.timer=setTimeout(function(){r&&r.abort();return r=e.ajax(s)},s.afterTypeDelay)})})}})(jQuery); -
woocommerce-poor-guys-swiss-knife/trunk/assets/js/chosen/chosen.jquery.js
r820403 r1085102 1 // Chosen, a Select Box Enhancer for jQuery and Proto ype1 // Chosen, a Select Box Enhancer for jQuery and Prototype 2 2 // by Patrick Filler for Harvest, http://getharvest.com 3 3 // 4 // Version 0.9.114 // Version 1.0.0 5 5 // Full source at https://github.com/harvesthq/chosen 6 6 // Copyright (c) 2011 Harvest http://getharvest.com 7 7 8 8 // MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md 9 // This file is generated by ` cakebuild`, do not edit it by hand.9 // This file is generated by `grunt build`, do not edit it by hand. 10 10 (function() { 11 var SelectParser; 11 var $, AbstractChosen, Chosen, SelectParser, _ref, 12 __hasProp = {}.hasOwnProperty, 13 __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; }; 12 14 13 15 SelectParser = (function() { 14 15 16 function SelectParser() { 16 17 this.options_index = 0; … … 28 29 SelectParser.prototype.add_group = function(group) { 29 30 var group_position, option, _i, _len, _ref, _results; 31 30 32 group_position = this.parsed.length; 31 33 this.parsed.push({ 32 34 array_index: group_position, 33 35 group: true, 34 label: group.label,36 label: this.escapeExpression(group.label), 35 37 children: 0, 36 38 disabled: group.disabled … … 74 76 }; 75 77 78 SelectParser.prototype.escapeExpression = function(text) { 79 var map, unsafe_chars; 80 81 if ((text == null) || text === false) { 82 return ""; 83 } 84 if (!/[\&\<\>\"\'\`]/.test(text)) { 85 return text; 86 } 87 map = { 88 "<": "<", 89 ">": ">", 90 '"': """, 91 "'": "'", 92 "`": "`" 93 }; 94 unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g; 95 return text.replace(unsafe_chars, function(chr) { 96 return map[chr] || "&"; 97 }); 98 }; 99 76 100 return SelectParser; 77 101 … … 80 104 SelectParser.select_to_array = function(select) { 81 105 var child, parser, _i, _len, _ref; 106 82 107 parser = new SelectParser(); 83 108 _ref = select.childNodes; … … 89 114 }; 90 115 91 this.SelectParser = SelectParser;92 93 }).call(this);94 95 /*96 Chosen source: generate output using 'cake build'97 Copyright (c) 2011 by Harvest98 */99 100 101 (function() {102 var AbstractChosen, root;103 104 root = this;105 106 116 AbstractChosen = (function() { 107 108 117 function AbstractChosen(form_field, options) { 109 118 this.form_field = form_field; 110 119 this.options = options != null ? options : {}; 120 if (!AbstractChosen.browser_is_supported()) { 121 return; 122 } 111 123 this.is_multiple = this.form_field.multiple; 112 124 this.set_default_text(); … … 115 127 this.set_up_html(); 116 128 this.register_observers(); 117 this.finish_setup();118 129 } 119 130 120 131 AbstractChosen.prototype.set_default_values = function() { 121 132 var _this = this; 133 122 134 this.click_test_action = function(evt) { 123 135 return _this.test_active_click(evt); … … 135 147 this.disable_search = this.options.disable_search || false; 136 148 this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true; 149 this.group_search = this.options.group_search != null ? this.options.group_search : true; 137 150 this.search_contains = this.options.search_contains || false; 138 this.choices = 0; 139 this.single_backstroke_delete = this.options.single_backstroke_delete || false; 151 this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true; 140 152 this.max_selected_options = this.options.max_selected_options || Infinity; 141 return this.inherit_select_classes = this.options.inherit_select_classes || false; 153 this.inherit_select_classes = this.options.inherit_select_classes || false; 154 this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true; 155 return this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true; 142 156 }; 143 157 … … 146 160 this.default_text = this.form_field.getAttribute("data-placeholder"); 147 161 } else if (this.is_multiple) { 148 this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || "Select Some Options";149 } else { 150 this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || "Select an Option";151 } 152 return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || "No results match";162 this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text; 163 } else { 164 this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text; 165 } 166 return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text; 153 167 }; 154 168 … … 163 177 AbstractChosen.prototype.input_focus = function(evt) { 164 178 var _this = this; 179 165 180 if (this.is_multiple) { 166 181 if (!this.active_field) { … … 178 193 AbstractChosen.prototype.input_blur = function(evt) { 179 194 var _this = this; 195 180 196 if (!this.mouse_on_container) { 181 197 this.active_field = false; … … 186 202 }; 187 203 204 AbstractChosen.prototype.results_option_build = function(options) { 205 var content, data, _i, _len, _ref; 206 207 content = ''; 208 _ref = this.results_data; 209 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 210 data = _ref[_i]; 211 if (data.group) { 212 content += this.result_add_group(data); 213 } else { 214 content += this.result_add_option(data); 215 } 216 if (options != null ? options.first : void 0) { 217 if (data.selected && this.is_multiple) { 218 this.choice_build(data); 219 } else if (data.selected && !this.is_multiple) { 220 this.single_set_selected_text(data.text); 221 } 222 } 223 } 224 return content; 225 }; 226 188 227 AbstractChosen.prototype.result_add_option = function(option) { 189 228 var classes, style; 190 if (!option.disabled) { 191 option.dom_id = this.container_id + "_o_" + option.array_index; 192 classes = option.selected && this.is_multiple ? [] : ["active-result"]; 193 if (option.selected) { 194 classes.push("result-selected"); 195 } 196 if (option.group_array_index != null) { 197 classes.push("group-option"); 198 } 199 if (option.classes !== "") { 200 classes.push(option.classes); 201 } 202 style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : ""; 203 return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '"' + style + '>' + option.html + '</li>'; 204 } else { 205 return ""; 206 } 229 230 if (!option.search_match) { 231 return ''; 232 } 233 if (!this.include_option_in_results(option)) { 234 return ''; 235 } 236 classes = []; 237 if (!option.disabled && !(option.selected && this.is_multiple)) { 238 classes.push("active-result"); 239 } 240 if (option.disabled && !(option.selected && this.is_multiple)) { 241 classes.push("disabled-result"); 242 } 243 if (option.selected) { 244 classes.push("result-selected"); 245 } 246 if (option.group_array_index != null) { 247 classes.push("group-option"); 248 } 249 if (option.classes !== "") { 250 classes.push(option.classes); 251 } 252 style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : ""; 253 return "<li class=\"" + (classes.join(' ')) + "\"" + style + " data-option-array-index=\"" + option.array_index + "\">" + option.search_text + "</li>"; 254 }; 255 256 AbstractChosen.prototype.result_add_group = function(group) { 257 if (!(group.search_match || group.group_match)) { 258 return ''; 259 } 260 if (!(group.active_options > 0)) { 261 return ''; 262 } 263 return "<li class=\"group-result\">" + group.search_text + "</li>"; 207 264 }; 208 265 209 266 AbstractChosen.prototype.results_update_field = function() { 267 this.set_default_text(); 210 268 if (!this.is_multiple) { 211 269 this.results_reset_cleanup(); … … 213 271 this.result_clear_highlight(); 214 272 this.result_single_selected = null; 215 return this.results_build(); 273 this.results_build(); 274 if (this.results_showing) { 275 return this.winnow_results(); 276 } 216 277 }; 217 278 … … 232 293 }; 233 294 295 AbstractChosen.prototype.winnow_results = function() { 296 var escapedSearchText, option, regex, regexAnchor, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref; 297 298 this.no_results_clear(); 299 results = 0; 300 searchText = this.get_search_text(); 301 escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); 302 regexAnchor = this.search_contains ? "" : "^"; 303 regex = new RegExp(regexAnchor + escapedSearchText, 'i'); 304 zregex = new RegExp(escapedSearchText, 'i'); 305 _ref = this.results_data; 306 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 307 option = _ref[_i]; 308 option.search_match = false; 309 results_group = null; 310 if (this.include_option_in_results(option)) { 311 if (option.group) { 312 option.group_match = false; 313 option.active_options = 0; 314 } 315 if ((option.group_array_index != null) && this.results_data[option.group_array_index]) { 316 results_group = this.results_data[option.group_array_index]; 317 if (results_group.active_options === 0 && results_group.search_match) { 318 results += 1; 319 } 320 results_group.active_options += 1; 321 } 322 if (!(option.group && !this.group_search)) { 323 option.search_text = option.group ? option.label : option.html; 324 option.search_match = this.search_string_match(option.search_text, regex); 325 if (option.search_match && !option.group) { 326 results += 1; 327 } 328 if (option.search_match) { 329 if (searchText.length) { 330 startpos = option.search_text.search(zregex); 331 text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length); 332 option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos); 333 } 334 if (results_group != null) { 335 results_group.group_match = true; 336 } 337 } else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) { 338 option.search_match = true; 339 } 340 } 341 } 342 } 343 this.result_clear_highlight(); 344 if (results < 1 && searchText.length) { 345 this.update_results_content(""); 346 return this.no_results(searchText); 347 } else { 348 this.update_results_content(this.results_option_build()); 349 return this.winnow_results_set_highlight(); 350 } 351 }; 352 353 AbstractChosen.prototype.search_string_match = function(search_string, regex) { 354 var part, parts, _i, _len; 355 356 if (regex.test(search_string)) { 357 return true; 358 } else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) { 359 parts = search_string.replace(/\[|\]/g, "").split(" "); 360 if (parts.length) { 361 for (_i = 0, _len = parts.length; _i < _len; _i++) { 362 part = parts[_i]; 363 if (regex.test(part)) { 364 return true; 365 } 366 } 367 } 368 } 369 }; 370 371 AbstractChosen.prototype.choices_count = function() { 372 var option, _i, _len, _ref; 373 374 if (this.selected_option_count != null) { 375 return this.selected_option_count; 376 } 377 this.selected_option_count = 0; 378 _ref = this.form_field.options; 379 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 380 option = _ref[_i]; 381 if (option.selected) { 382 this.selected_option_count += 1; 383 } 384 } 385 return this.selected_option_count; 386 }; 387 388 AbstractChosen.prototype.choices_click = function(evt) { 389 evt.preventDefault(); 390 if (!(this.results_showing || this.is_disabled)) { 391 return this.results_show(); 392 } 393 }; 394 234 395 AbstractChosen.prototype.keyup_checker = function(evt) { 235 396 var stroke, _ref; 397 236 398 stroke = (_ref = evt.which) != null ? _ref : evt.keyCode; 237 399 this.search_field_scale(); 238 400 switch (stroke) { 239 401 case 8: 240 if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) {402 if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) { 241 403 return this.keydown_backstroke(); 242 404 } else if (!this.pending_backstroke) { … … 268 430 }; 269 431 270 AbstractChosen.prototype.generate_field_id = function() { 271 var new_id; 272 new_id = this.generate_random_id(); 273 this.form_field.id = new_id; 274 return new_id; 275 }; 276 277 AbstractChosen.prototype.generate_random_char = function() { 278 var chars, newchar, rand; 279 chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 280 rand = Math.floor(Math.random() * chars.length); 281 return newchar = chars.substring(rand, rand + 1); 282 }; 432 AbstractChosen.prototype.container_width = function() { 433 if (this.options.width != null) { 434 return this.options.width; 435 } else { 436 return "" + this.form_field.offsetWidth + "px"; 437 } 438 }; 439 440 AbstractChosen.prototype.include_option_in_results = function(option) { 441 if (this.is_multiple && (!this.display_selected_options && option.selected)) { 442 return false; 443 } 444 if (!this.display_disabled_options && option.disabled) { 445 return false; 446 } 447 if (option.empty) { 448 return false; 449 } 450 return true; 451 }; 452 453 AbstractChosen.browser_is_supported = function() { 454 if (window.navigator.appName === "Microsoft Internet Explorer") { 455 return document.documentMode >= 8; 456 } 457 if (/iP(od|hone)/i.test(window.navigator.userAgent)) { 458 return false; 459 } 460 if (/Android/i.test(window.navigator.userAgent)) { 461 if (/Mobile/i.test(window.navigator.userAgent)) { 462 return false; 463 } 464 } 465 return true; 466 }; 467 468 AbstractChosen.default_multiple_text = "Select Some Options"; 469 470 AbstractChosen.default_single_text = "Select an Option"; 471 472 AbstractChosen.default_no_result_text = "No results match"; 283 473 284 474 return AbstractChosen; 285 475 286 476 })(); 287 288 root.AbstractChosen = AbstractChosen;289 290 }).call(this);291 292 /*293 Chosen source: generate output using 'cake build'294 Copyright (c) 2011 by Harvest295 */296 297 298 (function() {299 var $, Chosen, get_side_border_padding, root,300 __hasProp = {}.hasOwnProperty,301 __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; };302 303 root = this;304 477 305 478 $ = jQuery; … … 307 480 $.fn.extend({ 308 481 chosen: function(options) { 309 var browser, match, ua; 310 ua = navigator.userAgent.toLowerCase(); 311 match = /(msie) ([\w.]+)/.exec(ua) || []; 312 browser = { 313 name: match[1] || "", 314 version: match[2] || "0" 315 }; 316 if (browser.name === "msie" && (browser.version === "6.0" || (browser.version === "7.0" && document.documentMode === 7))) { 482 if (!AbstractChosen.browser_is_supported()) { 317 483 return this; 318 484 } 319 485 return this.each(function(input_field) { 320 var $this; 486 var $this, chosen; 487 321 488 $this = $(this); 322 if (!$this.hasClass("chzn-done")) { 323 return $this.data('chosen', new Chosen(this, options)); 489 chosen = $this.data('chosen'); 490 if (options === 'destroy' && chosen) { 491 chosen.destroy(); 492 } else if (!chosen) { 493 $this.data('chosen', new Chosen(this, options)); 324 494 } 325 495 }); … … 328 498 329 499 Chosen = (function(_super) { 330 331 500 __extends(Chosen, _super); 332 501 333 502 function Chosen() { 334 return Chosen.__super__.constructor.apply(this, arguments); 503 _ref = Chosen.__super__.constructor.apply(this, arguments); 504 return _ref; 335 505 } 336 506 337 507 Chosen.prototype.setup = function() { 338 508 this.form_field_jq = $(this.form_field); 339 this.current_value = this.form_field_jq.val(); 340 return this.is_rtl = this.form_field_jq.hasClass("chzn-rtl"); 341 }; 342 343 Chosen.prototype.finish_setup = function() { 344 return this.form_field_jq.addClass("chzn-done"); 509 this.current_selectedIndex = this.form_field.selectedIndex; 510 return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl"); 345 511 }; 346 512 347 513 Chosen.prototype.set_up_html = function() { 348 var container_classes, container_div, container_props, dd_top, dd_width, sf_width; 349 this.container_id = this.form_field.id.length ? this.form_field.id.replace(/[^\w]/g, '_') : this.generate_field_id(); 350 this.container_id += "_chzn"; 351 container_classes = ["chzn-container"]; 352 container_classes.push("chzn-container-" + (this.is_multiple ? "multi" : "single")); 514 var container_classes, container_props; 515 516 container_classes = ["chosen-container"]; 517 container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single")); 353 518 if (this.inherit_select_classes && this.form_field.className) { 354 519 container_classes.push(this.form_field.className); 355 520 } 356 521 if (this.is_rtl) { 357 container_classes.push("chzn-rtl"); 358 } 359 this.f_width = this.form_field_jq.outerWidth(); 522 container_classes.push("chosen-rtl"); 523 } 360 524 container_props = { 361 id: this.container_id, 362 "class": container_classes.join(' '), 363 style: 'width: ' + this.f_width + 'px;', 364 title: this.form_field.title 525 'class': container_classes.join(' '), 526 'style': "width: " + (this.container_width()) + ";", 527 'title': this.form_field.title 365 528 }; 366 container_div = $("<div />", container_props); 529 if (this.form_field.id.length) { 530 container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen"; 531 } 532 this.container = $("<div />", container_props); 367 533 if (this.is_multiple) { 368 container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'); 369 } else { 370 container_div.html('<a href="javascript:void(0)" class="chzn-single chzn-default" tabindex="-1"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'); 371 } 372 this.form_field_jq.hide().after(container_div); 373 this.container = $('#' + this.container_id); 374 this.dropdown = this.container.find('div.chzn-drop').first(); 375 dd_top = this.container.height(); 376 dd_width = this.f_width - get_side_border_padding(this.dropdown); 377 this.dropdown.css({ 378 "width": dd_width + "px", 379 "top": dd_top + "px" 380 }); 534 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>'); 535 } else { 536 this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><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>'); 537 } 538 this.form_field_jq.hide().after(this.container); 539 this.dropdown = this.container.find('div.chosen-drop').first(); 381 540 this.search_field = this.container.find('input').first(); 382 this.search_results = this.container.find('ul.ch zn-results').first();541 this.search_results = this.container.find('ul.chosen-results').first(); 383 542 this.search_field_scale(); 384 543 this.search_no_results = this.container.find('li.no-results').first(); 385 544 if (this.is_multiple) { 386 this.search_choices = this.container.find('ul.ch zn-choices').first();545 this.search_choices = this.container.find('ul.chosen-choices').first(); 387 546 this.search_container = this.container.find('li.search-field').first(); 388 547 } else { 389 this.search_container = this.container.find('div.chzn-search').first(); 390 this.selected_item = this.container.find('.chzn-single').first(); 391 sf_width = dd_width - get_side_border_padding(this.search_container) - get_side_border_padding(this.search_field); 392 this.search_field.css({ 393 "width": sf_width + "px" 394 }); 548 this.search_container = this.container.find('div.chosen-search').first(); 549 this.selected_item = this.container.find('.chosen-single').first(); 395 550 } 396 551 this.results_build(); 397 552 this.set_tab_index(); 398 return this.form_field_jq.trigger("liszt:ready", { 553 this.set_label_behavior(); 554 return this.form_field_jq.trigger("chosen:ready", { 399 555 chosen: this 400 556 }); … … 403 559 Chosen.prototype.register_observers = function() { 404 560 var _this = this; 405 this.container.mousedown(function(evt) { 406 return _this.container_mousedown(evt); 407 }); 408 this.container.mouseup(function(evt) { 409 return _this.container_mouseup(evt); 410 }); 411 this.container.mouseenter(function(evt) { 412 return _this.mouse_enter(evt); 413 }); 414 this.container.mouseleave(function(evt) { 415 return _this.mouse_leave(evt); 416 }); 417 this.search_results.mouseup(function(evt) { 418 return _this.search_results_mouseup(evt); 419 }); 420 this.search_results.mouseover(function(evt) { 421 return _this.search_results_mouseover(evt); 422 }); 423 this.search_results.mouseout(function(evt) { 424 return _this.search_results_mouseout(evt); 425 }); 426 this.form_field_jq.bind("liszt:updated", function(evt) { 427 return _this.results_update_field(evt); 428 }); 429 this.form_field_jq.bind("liszt:activate", function(evt) { 430 return _this.activate_field(evt); 431 }); 432 this.form_field_jq.bind("liszt:open", function(evt) { 433 return _this.container_mousedown(evt); 434 }); 435 this.search_field.blur(function(evt) { 436 return _this.input_blur(evt); 437 }); 438 this.search_field.keyup(function(evt) { 439 return _this.keyup_checker(evt); 440 }); 441 this.search_field.keydown(function(evt) { 442 return _this.keydown_checker(evt); 443 }); 444 this.search_field.focus(function(evt) { 445 return _this.input_focus(evt); 561 562 this.container.bind('mousedown.chosen', function(evt) { 563 _this.container_mousedown(evt); 564 }); 565 this.container.bind('mouseup.chosen', function(evt) { 566 _this.container_mouseup(evt); 567 }); 568 this.container.bind('mouseenter.chosen', function(evt) { 569 _this.mouse_enter(evt); 570 }); 571 this.container.bind('mouseleave.chosen', function(evt) { 572 _this.mouse_leave(evt); 573 }); 574 this.search_results.bind('mouseup.chosen', function(evt) { 575 _this.search_results_mouseup(evt); 576 }); 577 this.search_results.bind('mouseover.chosen', function(evt) { 578 _this.search_results_mouseover(evt); 579 }); 580 this.search_results.bind('mouseout.chosen', function(evt) { 581 _this.search_results_mouseout(evt); 582 }); 583 this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) { 584 _this.search_results_mousewheel(evt); 585 }); 586 this.form_field_jq.bind("chosen:updated.chosen", function(evt) { 587 _this.results_update_field(evt); 588 }); 589 this.form_field_jq.bind("chosen:activate.chosen", function(evt) { 590 _this.activate_field(evt); 591 }); 592 this.form_field_jq.bind("chosen:open.chosen", function(evt) { 593 _this.container_mousedown(evt); 594 }); 595 this.search_field.bind('blur.chosen', function(evt) { 596 _this.input_blur(evt); 597 }); 598 this.search_field.bind('keyup.chosen', function(evt) { 599 _this.keyup_checker(evt); 600 }); 601 this.search_field.bind('keydown.chosen', function(evt) { 602 _this.keydown_checker(evt); 603 }); 604 this.search_field.bind('focus.chosen', function(evt) { 605 _this.input_focus(evt); 446 606 }); 447 607 if (this.is_multiple) { 448 return this.search_choices. click(function(evt) {449 return_this.choices_click(evt);608 return this.search_choices.bind('click.chosen', function(evt) { 609 _this.choices_click(evt); 450 610 }); 451 611 } else { 452 return this.container. click(function(evt) {453 returnevt.preventDefault();612 return this.container.bind('click.chosen', function(evt) { 613 evt.preventDefault(); 454 614 }); 455 615 } 616 }; 617 618 Chosen.prototype.destroy = function() { 619 $(document).unbind("click.chosen", this.click_test_action); 620 if (this.search_field[0].tabIndex) { 621 this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex; 622 } 623 this.container.remove(); 624 this.form_field_jq.removeData('chosen'); 625 return this.form_field_jq.show(); 456 626 }; 457 627 … … 459 629 this.is_disabled = this.form_field_jq[0].disabled; 460 630 if (this.is_disabled) { 461 this.container.addClass('ch zn-disabled');631 this.container.addClass('chosen-disabled'); 462 632 this.search_field[0].disabled = true; 463 633 if (!this.is_multiple) { 464 this.selected_item.unbind("focus ", this.activate_action);634 this.selected_item.unbind("focus.chosen", this.activate_action); 465 635 } 466 636 return this.close_field(); 467 637 } else { 468 this.container.removeClass('ch zn-disabled');638 this.container.removeClass('chosen-disabled'); 469 639 this.search_field[0].disabled = false; 470 640 if (!this.is_multiple) { 471 return this.selected_item.bind("focus ", this.activate_action);641 return this.selected_item.bind("focus.chosen", this.activate_action); 472 642 } 473 643 } … … 475 645 476 646 Chosen.prototype.container_mousedown = function(evt) { 477 var target_closelink;478 647 if (!this.is_disabled) { 479 target_closelink = evt != null ? ($(evt.target)).hasClass("search-choice-close") : false;480 648 if (evt && evt.type === "mousedown" && !this.results_showing) { 481 649 evt.preventDefault(); 482 650 } 483 if (! this.pending_destroy_click && !target_closelink) {651 if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) { 484 652 if (!this.active_field) { 485 653 if (this.is_multiple) { 486 654 this.search_field.val(""); 487 655 } 488 $(document). click(this.click_test_action);656 $(document).bind('click.chosen', this.click_test_action); 489 657 this.results_show(); 490 } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.ch zn-single").length)) {658 } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) { 491 659 evt.preventDefault(); 492 660 this.results_toggle(); 493 661 } 494 662 return this.activate_field(); 495 } else {496 return this.pending_destroy_click = false;497 663 } 498 664 } … … 505 671 }; 506 672 673 Chosen.prototype.search_results_mousewheel = function(evt) { 674 var delta, _ref1, _ref2; 675 676 delta = -((_ref1 = evt.originalEvent) != null ? _ref1.wheelDelta : void 0) || ((_ref2 = evt.originialEvent) != null ? _ref2.detail : void 0); 677 if (delta != null) { 678 evt.preventDefault(); 679 if (evt.type === 'DOMMouseScroll') { 680 delta = delta * 40; 681 } 682 return this.search_results.scrollTop(delta + this.search_results.scrollTop()); 683 } 684 }; 685 507 686 Chosen.prototype.blur_test = function(evt) { 508 if (!this.active_field && this.container.hasClass("ch zn-container-active")) {687 if (!this.active_field && this.container.hasClass("chosen-container-active")) { 509 688 return this.close_field(); 510 689 } … … 512 691 513 692 Chosen.prototype.close_field = function() { 514 $(document).unbind("click ", this.click_test_action);693 $(document).unbind("click.chosen", this.click_test_action); 515 694 this.active_field = false; 516 695 this.results_hide(); 517 this.container.removeClass("chzn-container-active"); 518 this.winnow_results_clear(); 696 this.container.removeClass("chosen-container-active"); 519 697 this.clear_backstroke(); 520 698 this.show_search_field_default(); … … 523 701 524 702 Chosen.prototype.activate_field = function() { 525 this.container.addClass("ch zn-container-active");703 this.container.addClass("chosen-container-active"); 526 704 this.active_field = true; 527 705 this.search_field.val(this.search_field.val()); … … 530 708 531 709 Chosen.prototype.test_active_click = function(evt) { 532 if ( $(evt.target).parents('#' + this.container_id).length) {710 if (this.container.is($(evt.target).closest('.chosen-container'))) { 533 711 return this.active_field = true; 534 712 } else { … … 538 716 539 717 Chosen.prototype.results_build = function() { 540 var content, data, _i, _len, _ref;541 718 this.parsing = true; 542 this.results_data = root.SelectParser.select_to_array(this.form_field); 543 if (this.is_multiple && this.choices > 0) { 719 this.selected_option_count = null; 720 this.results_data = SelectParser.select_to_array(this.form_field); 721 if (this.is_multiple) { 544 722 this.search_choices.find("li.search-choice").remove(); 545 this.choices = 0;546 723 } else if (!this.is_multiple) { 547 this.s elected_item.addClass("chzn-default").find("span").text(this.default_text);724 this.single_set_selected_text(); 548 725 if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) { 549 this.container.addClass("chzn-container-single-nosearch"); 726 this.search_field[0].readOnly = true; 727 this.container.addClass("chosen-container-single-nosearch"); 550 728 } else { 551 this.container.removeClass("chzn-container-single-nosearch"); 552 } 553 } 554 content = ''; 555 _ref = this.results_data; 556 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 557 data = _ref[_i]; 558 if (data.group) { 559 content += this.result_add_group(data); 560 } else if (!data.empty) { 561 content += this.result_add_option(data); 562 if (data.selected && this.is_multiple) { 563 this.choice_build(data); 564 } else if (data.selected && !this.is_multiple) { 565 this.selected_item.removeClass("chzn-default").find("span").text(data.text); 566 if (this.allow_single_deselect) { 567 this.single_deselect_control_build(); 568 } 569 } 570 } 571 } 729 this.search_field[0].readOnly = false; 730 this.container.removeClass("chosen-container-single-nosearch"); 731 } 732 } 733 this.update_results_content(this.results_option_build({ 734 first: true 735 })); 572 736 this.search_field_disabled(); 573 737 this.show_search_field_default(); 574 738 this.search_field_scale(); 575 this.search_results.html(content);576 739 return this.parsing = false; 577 };578 579 Chosen.prototype.result_add_group = function(group) {580 if (!group.disabled) {581 group.dom_id = this.container_id + "_g_" + group.array_index;582 return '<li id="' + group.dom_id + '" class="group-result">' + $("<div />").text(group.label).html() + '</li>';583 } else {584 return "";585 }586 740 }; 587 741 588 742 Chosen.prototype.result_do_highlight = function(el) { 589 743 var high_bottom, high_top, maxHeight, visible_bottom, visible_top; 744 590 745 if (el.length) { 591 746 this.result_clear_highlight(); … … 613 768 614 769 Chosen.prototype.results_show = function() { 615 var dd_top; 616 if (!this.is_multiple) { 617 this.selected_item.addClass("chzn-single-with-drop"); 618 if (this.result_single_selected) { 619 this.result_do_highlight(this.result_single_selected); 620 } 621 } else if (this.max_selected_options <= this.choices) { 622 this.form_field_jq.trigger("liszt:maxselected", { 770 if (this.is_multiple && this.max_selected_options <= this.choices_count()) { 771 this.form_field_jq.trigger("chosen:maxselected", { 623 772 chosen: this 624 773 }); 625 774 return false; 626 775 } 627 dd_top = this.is_multiple ? this.container.height() : this.container.height() - 1;628 this.form_field_jq.trigger(" liszt:showing_dropdown", {776 this.container.addClass("chosen-with-drop"); 777 this.form_field_jq.trigger("chosen:showing_dropdown", { 629 778 chosen: this 630 });631 this.dropdown.css({632 "top": dd_top + "px",633 "left": 0634 779 }); 635 780 this.results_showing = true; … … 639 784 }; 640 785 786 Chosen.prototype.update_results_content = function(content) { 787 return this.search_results.html(content); 788 }; 789 641 790 Chosen.prototype.results_hide = function() { 642 if (!this.is_multiple) { 643 this.selected_item.removeClass("chzn-single-with-drop"); 644 } 645 this.result_clear_highlight(); 646 this.form_field_jq.trigger("liszt:hiding_dropdown", { 647 chosen: this 648 }); 649 this.dropdown.css({ 650 "left": "-9000px" 651 }); 791 if (this.results_showing) { 792 this.result_clear_highlight(); 793 this.container.removeClass("chosen-with-drop"); 794 this.form_field_jq.trigger("chosen:hiding_dropdown", { 795 chosen: this 796 }); 797 } 652 798 return this.results_showing = false; 653 799 }; … … 655 801 Chosen.prototype.set_tab_index = function(el) { 656 802 var ti; 657 if (this.form_field_jq.attr("tabindex")) { 658 ti = this.form_field_jq.attr("tabindex"); 659 this.form_field_jq.attr("tabindex", -1); 660 return this.search_field.attr("tabindex", ti); 803 804 if (this.form_field.tabIndex) { 805 ti = this.form_field.tabIndex; 806 this.form_field.tabIndex = -1; 807 return this.search_field[0].tabIndex = ti; 808 } 809 }; 810 811 Chosen.prototype.set_label_behavior = function() { 812 var _this = this; 813 814 this.form_field_label = this.form_field_jq.parents("label"); 815 if (!this.form_field_label.length && this.form_field.id.length) { 816 this.form_field_label = $("label[for='" + this.form_field.id + "']"); 817 } 818 if (this.form_field_label.length > 0) { 819 return this.form_field_label.bind('click.chosen', function(evt) { 820 if (_this.is_multiple) { 821 return _this.container_mousedown(evt); 822 } else { 823 return _this.activate_field(); 824 } 825 }); 661 826 } 662 827 }; 663 828 664 829 Chosen.prototype.show_search_field_default = function() { 665 if (this.is_multiple && this.choices < 1 && !this.active_field) {830 if (this.is_multiple && this.choices_count() < 1 && !this.active_field) { 666 831 this.search_field.val(this.default_text); 667 832 return this.search_field.addClass("default"); … … 674 839 Chosen.prototype.search_results_mouseup = function(evt) { 675 840 var target; 841 676 842 target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first(); 677 843 if (target.length) { … … 684 850 Chosen.prototype.search_results_mouseover = function(evt) { 685 851 var target; 852 686 853 target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first(); 687 854 if (target) { … … 696 863 }; 697 864 698 Chosen.prototype.choices_click = function(evt) {699 evt.preventDefault();700 if (this.active_field && !($(evt.target).hasClass("search-choice" || $(evt.target).parents('.search-choice').first)) && !this.results_showing) {701 return this.results_show();702 }703 };704 705 865 Chosen.prototype.choice_build = function(item) { 706 var choice _id, html,link,866 var choice, close_link, 707 867 _this = this; 708 if (this.is_multiple && this.max_selected_options <= this.choices) { 709 this.form_field_jq.trigger("liszt:maxselected", { 710 chosen: this 868 869 choice = $('<li />', { 870 "class": "search-choice" 871 }).html("<span>" + item.html + "</span>"); 872 if (item.disabled) { 873 choice.addClass('search-choice-disabled'); 874 } else { 875 close_link = $('<a />', { 876 "class": 'search-choice-close', 877 'data-option-array-index': item.array_index 711 878 }); 712 return false; 713 } 714 choice_id = this.container_id + "_c_" + item.array_index; 715 this.choices += 1; 716 if (item.disabled) { 717 html = '<li class="search-choice search-choice-disabled" id="' + choice_id + '"><span>' + item.html + '</span></li>'; 718 } else { 719 html = '<li class="search-choice" id="' + choice_id + '"><span>' + item.html + '</span><a href="javascript:void(0)" class="search-choice-close" rel="' + item.array_index + '"></a></li>'; 720 } 721 this.search_container.before(html); 722 link = $('#' + choice_id).find("a").first(); 723 return link.click(function(evt) { 724 return _this.choice_destroy_link_click(evt); 725 }); 879 close_link.bind('click.chosen', function(evt) { 880 return _this.choice_destroy_link_click(evt); 881 }); 882 choice.append(close_link); 883 } 884 return this.search_container.before(choice); 726 885 }; 727 886 728 887 Chosen.prototype.choice_destroy_link_click = function(evt) { 729 888 evt.preventDefault(); 889 evt.stopPropagation(); 730 890 if (!this.is_disabled) { 731 this.pending_destroy_click = true;732 891 return this.choice_destroy($(evt.target)); 733 } else {734 return evt.stopPropagation;735 892 } 736 893 }; 737 894 738 895 Chosen.prototype.choice_destroy = function(link) { 739 if (this.result_deselect(link.attr("rel"))) { 740 this.choices -= 1; 896 if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) { 741 897 this.show_search_field_default(); 742 if (this.is_multiple && this.choices > 0 && this.search_field.val().length < 1) {898 if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) { 743 899 this.results_hide(); 744 900 } … … 750 906 Chosen.prototype.results_reset = function() { 751 907 this.form_field.options[0].selected = true; 752 this.selected_item.find("span").text(this.default_text); 753 if (!this.is_multiple) { 754 this.selected_item.addClass("chzn-default"); 755 } 908 this.selected_option_count = null; 909 this.single_set_selected_text(); 756 910 this.show_search_field_default(); 757 911 this.results_reset_cleanup(); … … 763 917 764 918 Chosen.prototype.results_reset_cleanup = function() { 765 this.current_ value = this.form_field_jq.val();919 this.current_selectedIndex = this.form_field.selectedIndex; 766 920 return this.selected_item.find("abbr").remove(); 767 921 }; 768 922 769 923 Chosen.prototype.result_select = function(evt) { 770 var high, high_id, item, position; 924 var high, item, selected_index; 925 771 926 if (this.result_highlight) { 772 927 high = this.result_highlight; 773 high_id = high.attr("id");774 928 this.result_clear_highlight(); 929 if (this.is_multiple && this.max_selected_options <= this.choices_count()) { 930 this.form_field_jq.trigger("chosen:maxselected", { 931 chosen: this 932 }); 933 return false; 934 } 775 935 if (this.is_multiple) { 776 this.result_deactivate(high);936 high.removeClass("active-result"); 777 937 } else { 778 this.search_results.find(".result-selected").removeClass("result-selected"); 938 if (this.result_single_selected) { 939 this.result_single_selected.removeClass("result-selected"); 940 selected_index = this.result_single_selected[0].getAttribute('data-option-array-index'); 941 this.results_data[selected_index].selected = false; 942 } 779 943 this.result_single_selected = high; 780 this.selected_item.removeClass("chzn-default");781 944 } 782 945 high.addClass("result-selected"); 783 position = high_id.substr(high_id.lastIndexOf("_") + 1); 784 item = this.results_data[position]; 946 item = this.results_data[high[0].getAttribute("data-option-array-index")]; 785 947 item.selected = true; 786 948 this.form_field.options[item.options_index].selected = true; 949 this.selected_option_count = null; 787 950 if (this.is_multiple) { 788 951 this.choice_build(item); 789 952 } else { 790 this.selected_item.find("span").first().text(item.text); 791 if (this.allow_single_deselect) { 792 this.single_deselect_control_build(); 793 } 953 this.single_set_selected_text(item.text); 794 954 } 795 955 if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) { … … 797 957 } 798 958 this.search_field.val(""); 799 if (this.is_multiple || this.form_field _jq.val() !== this.current_value) {959 if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) { 800 960 this.form_field_jq.trigger("change", { 801 961 'selected': this.form_field.options[item.options_index].value 802 962 }); 803 963 } 804 this.current_ value = this.form_field_jq.val();964 this.current_selectedIndex = this.form_field.selectedIndex; 805 965 return this.search_field_scale(); 806 966 } 807 967 }; 808 968 809 Chosen.prototype.result_activate = function(el) { 810 return el.addClass("active-result"); 811 }; 812 813 Chosen.prototype.result_deactivate = function(el) { 814 return el.removeClass("active-result"); 969 Chosen.prototype.single_set_selected_text = function(text) { 970 if (text == null) { 971 text = this.default_text; 972 } 973 if (text === this.default_text) { 974 this.selected_item.addClass("chosen-default"); 975 } else { 976 this.single_deselect_control_build(); 977 this.selected_item.removeClass("chosen-default"); 978 } 979 return this.selected_item.find("span").text(text); 815 980 }; 816 981 817 982 Chosen.prototype.result_deselect = function(pos) { 818 var result, result_data; 983 var result_data; 984 819 985 result_data = this.results_data[pos]; 820 986 if (!this.form_field.options[result_data.options_index].disabled) { 821 987 result_data.selected = false; 822 988 this.form_field.options[result_data.options_index].selected = false; 823 result = $("#" + this.container_id + "_o_" + pos); 824 result.removeClass("result-selected").addClass("active-result").show(); 989 this.selected_option_count = null; 825 990 this.result_clear_highlight(); 826 this.winnow_results(); 991 if (this.results_showing) { 992 this.winnow_results(); 993 } 827 994 this.form_field_jq.trigger("change", { 828 995 deselected: this.form_field.options[result_data.options_index].value … … 836 1003 837 1004 Chosen.prototype.single_deselect_control_build = function() { 838 if (this.allow_single_deselect && this.selected_item.find("abbr").length < 1) { 839 return this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>"); 840 } 841 }; 842 843 Chosen.prototype.winnow_results = function() { 844 var found, option, part, parts, regex, regexAnchor, result, result_id, results, searchText, startpos, text, zregex, _i, _j, _len, _len1, _ref; 845 this.no_results_clear(); 846 results = 0; 847 searchText = this.search_field.val() === this.default_text ? "" : $('<div/>').text($.trim(this.search_field.val())).html(); 848 regexAnchor = this.search_contains ? "" : "^"; 849 regex = new RegExp(regexAnchor + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i'); 850 zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i'); 851 _ref = this.results_data; 852 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 853 option = _ref[_i]; 854 if (!option.disabled && !option.empty) { 855 if (option.group) { 856 $('#' + option.dom_id).css('display', 'none'); 857 } else if (!(this.is_multiple && option.selected)) { 858 found = false; 859 result_id = option.dom_id; 860 result = $("#" + result_id); 861 if (regex.test(option.html)) { 862 found = true; 863 results += 1; 864 } else if (this.enable_split_word_search && (option.html.indexOf(" ") >= 0 || option.html.indexOf("[") === 0)) { 865 parts = option.html.replace(/\[|\]/g, "").split(" "); 866 if (parts.length) { 867 for (_j = 0, _len1 = parts.length; _j < _len1; _j++) { 868 part = parts[_j]; 869 if (regex.test(part)) { 870 found = true; 871 results += 1; 872 } 873 } 874 } 875 } 876 if (found) { 877 if (searchText.length) { 878 startpos = option.html.search(zregex); 879 text = option.html.substr(0, startpos + searchText.length) + '</em>' + option.html.substr(startpos + searchText.length); 880 text = text.substr(0, startpos) + '<em>' + text.substr(startpos); 881 } else { 882 text = option.html; 883 } 884 result.html(text); 885 this.result_activate(result); 886 if (option.group_array_index != null) { 887 $("#" + this.results_data[option.group_array_index].dom_id).css('display', 'list-item'); 888 } 889 } else { 890 if (this.result_highlight && result_id === this.result_highlight.attr('id')) { 891 this.result_clear_highlight(); 892 } 893 this.result_deactivate(result); 894 } 895 } 896 } 897 } 898 if (results < 1 && searchText.length) { 899 return this.no_results(searchText); 900 } else { 901 return this.winnow_results_set_highlight(); 902 } 903 }; 904 905 Chosen.prototype.winnow_results_clear = function() { 906 var li, lis, _i, _len, _results; 907 this.search_field.val(""); 908 lis = this.search_results.find("li"); 909 _results = []; 910 for (_i = 0, _len = lis.length; _i < _len; _i++) { 911 li = lis[_i]; 912 li = $(li); 913 if (li.hasClass("group-result")) { 914 _results.push(li.css('display', 'auto')); 915 } else if (!this.is_multiple || !li.hasClass("result-selected")) { 916 _results.push(this.result_activate(li)); 917 } else { 918 _results.push(void 0); 919 } 920 } 921 return _results; 1005 if (!this.allow_single_deselect) { 1006 return; 1007 } 1008 if (!this.selected_item.find("abbr").length) { 1009 this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>"); 1010 } 1011 return this.selected_item.addClass("chosen-single-with-deselect"); 1012 }; 1013 1014 Chosen.prototype.get_search_text = function() { 1015 if (this.search_field.val() === this.default_text) { 1016 return ""; 1017 } else { 1018 return $('<div/>').text($.trim(this.search_field.val())).html(); 1019 } 922 1020 }; 923 1021 924 1022 Chosen.prototype.winnow_results_set_highlight = function() { 925 1023 var do_high, selected_results; 926 if (!this.result_highlight) { 927 selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : []; 928 do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first(); 929 if (do_high != null) { 930 return this.result_do_highlight(do_high); 931 } 1024 1025 selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : []; 1026 do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first(); 1027 if (do_high != null) { 1028 return this.result_do_highlight(do_high); 932 1029 } 933 1030 }; … … 935 1032 Chosen.prototype.no_results = function(terms) { 936 1033 var no_results_html; 1034 937 1035 no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>'); 938 1036 no_results_html.find("span").first().html(terms); … … 945 1043 946 1044 Chosen.prototype.keydown_arrow = function() { 947 var first_active, next_sib; 948 if (!this.result_highlight) { 949 first_active = this.search_results.find("li.active-result").first(); 950 if (first_active) { 951 this.result_do_highlight($(first_active)); 952 } 953 } else if (this.results_showing) { 1045 var next_sib; 1046 1047 if (this.results_showing && this.result_highlight) { 954 1048 next_sib = this.result_highlight.nextAll("li.active-result").first(); 955 1049 if (next_sib) { 956 this.result_do_highlight(next_sib); 957 } 958 } 959 if (!this.results_showing) { 1050 return this.result_do_highlight(next_sib); 1051 } 1052 } else { 960 1053 return this.results_show(); 961 1054 } … … 964 1057 Chosen.prototype.keyup_arrow = function() { 965 1058 var prev_sibs; 1059 966 1060 if (!this.results_showing && !this.is_multiple) { 967 1061 return this.results_show(); … … 971 1065 return this.result_do_highlight(prev_sibs.first()); 972 1066 } else { 973 if (this.choices > 0) {1067 if (this.choices_count() > 0) { 974 1068 this.results_hide(); 975 1069 } … … 981 1075 Chosen.prototype.keydown_backstroke = function() { 982 1076 var next_available_destroy; 1077 983 1078 if (this.pending_backstroke) { 984 1079 this.choice_destroy(this.pending_backstroke.find("a").first()); … … 1005 1100 1006 1101 Chosen.prototype.keydown_checker = function(evt) { 1007 var stroke, _ref; 1008 stroke = (_ref = evt.which) != null ? _ref : evt.keyCode; 1102 var stroke, _ref1; 1103 1104 stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode; 1009 1105 this.search_field_scale(); 1010 1106 if (stroke !== 8 && this.pending_backstroke) { … … 1029 1125 break; 1030 1126 case 40: 1127 evt.preventDefault(); 1031 1128 this.keydown_arrow(); 1032 1129 break; … … 1035 1132 1036 1133 Chosen.prototype.search_field_scale = function() { 1037 var dd_top, div, h, style, style_block, styles, w, _i, _len; 1134 var div, f_width, h, style, style_block, styles, w, _i, _len; 1135 1038 1136 if (this.is_multiple) { 1039 1137 h = 0; … … 1052 1150 w = div.width() + 25; 1053 1151 div.remove(); 1054 if (w > this.f_width - 10) { 1055 w = this.f_width - 10; 1056 } 1057 this.search_field.css({ 1152 f_width = this.container.outerWidth(); 1153 if (w > f_width - 10) { 1154 w = f_width - 10; 1155 } 1156 return this.search_field.css({ 1058 1157 'width': w + 'px' 1059 1158 }); 1060 dd_top = this.container.height(); 1061 return this.dropdown.css({ 1062 "top": dd_top + "px" 1063 }); 1064 } 1065 }; 1066 1067 Chosen.prototype.generate_random_id = function() { 1068 var string; 1069 string = "sel" + this.generate_random_char() + this.generate_random_char() + this.generate_random_char(); 1070 while ($("#" + string).length > 0) { 1071 string += this.generate_random_char(); 1072 } 1073 return string; 1159 } 1074 1160 }; 1075 1161 … … 1078 1164 })(AbstractChosen); 1079 1165 1080 root.Chosen = Chosen;1081 1082 get_side_border_padding = function(elmt) {1083 var side_border_padding;1084 return side_border_padding = elmt.outerWidth() - elmt.width();1085 };1086 1087 root.get_side_border_padding = get_side_border_padding;1088 1089 1166 }).call(this); -
woocommerce-poor-guys-swiss-knife/trunk/assets/js/chosen/chosen.jquery.min.js
r820403 r1085102 1 // Chosen, a Select Box Enhancer for jQuery and Proto ype1 // Chosen, a Select Box Enhancer for jQuery and Prototype 2 2 // by Patrick Filler for Harvest, http://getharvest.com 3 3 // 4 // Version 0.9.114 // Version 1.0.0 5 5 // Full source at https://github.com/harvesthq/chosen 6 6 // Copyright (c) 2011 Harvest http://getharvest.com 7 7 // MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md 8 // This file is generated by ` cakebuild`, do not edit it by hand.9 (function(){var e ;e=function(){function e(){this.options_index=0;this.parsed=[]}e.prototype.add_node=function(e){return e.nodeName.toUpperCase()==="OPTGROUP"?this.add_group(e):this.add_option(e)};e.prototype.add_group=function(e){var t,n,r,i,s,o;t=this.parsed.length;this.parsed.push({array_index:t,group:!0,label:e.label,children:0,disabled:e.disabled});s=e.childNodes;o=[];for(r=0,i=s.length;r<i;r++){n=s[r];o.push(this.add_option(n,t,e.disabled))}return o};e.prototype.add_option=function(e,t,n){if(e.nodeName.toUpperCase()==="OPTION"){if(e.text!==""){t!=null&&(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,selected:e.selected,disabled:n===!0?n:e.disabled,group_array_index:t,classes:e.className,style:e.style.cssText})}else this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0});return this.options_index+=1}};return e}();e.select_to_array=function(t){var n,r,i,s,o;r=new e;o=t.childNodes;for(i=0,s=o.length;i<s;i++){n=o[i];r.add_node(n)}return r.parsed};this.SelectParser=e}).call(this);(function(){var e,t;t=this;e=function(){function e(e,t){this.form_field=e;this.options=t!=null?t:{};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.finish_setup()}e.prototype.set_default_values=function(){var e=this;this.click_test_action=function(t){return e.test_active_click(t)};this.activate_action=function(t){return e.activate_field(t)};this.active_field=!1;this.mouse_on_container=!1;this.results_showing=!1;this.result_highlighted=null;this.result_single_selected=null;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:!1;this.disable_search_threshold=this.options.disable_search_threshold||0;this.disable_search=this.options.disable_search||!1;this.enable_split_word_search=this.options.enable_split_word_search!=null?this.options.enable_split_word_search:!0;this.search_contains=this.options.search_contains||!1;this.choices=0;this.single_backstroke_delete=this.options.single_backstroke_delete||!1;this.max_selected_options=this.options.max_selected_options||Infinity;return this.inherit_select_classes=this.options.inherit_select_classes||!1};e.prototype.set_default_text=function(){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||"Select Some Options":this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||"Select an Option";return this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||"No results match"};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){var t=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return t.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()};e.prototype.input_blur=function(e){var t=this;if(!this.mouse_on_container){this.active_field=!1;return setTimeout(function(){return t.blur_test()},100)}};e.prototype.result_add_option=function(e){var t,n;if(!e.disabled){e.dom_id=this.container_id+"_o_"+e.array_index;t=e.selected&&this.is_multiple?[]:["active-result"];e.selected&&t.push("result-selected");e.group_array_index!=null&&t.push("group-option");e.classes!==""&&t.push(e.classes);n=e.style.cssText!==""?' style="'+e.style+'"':"";return'<li id="'+e.dom_id+'" class="'+t.join(" ")+'"'+n+">"+e.html+"</li>"}return""};e.prototype.results_update_field=function(){this.is_multiple||this.results_reset_cleanup();this.result_clear_highlight();this.result_single_selected=null;return this.results_build()};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.keyup_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode;this.search_field_scale();switch(t){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke){this.result_clear_highlight();return this.results_search()}break;case 13:e.preventDefault();if(this.results_showing)return this.result_select(e);break;case 27:this.results_showing&&this.results_hide();return!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}};e.prototype.generate_field_id=function(){var e;e=this.generate_random_id();this.form_field.id=e;return e};e.prototype.generate_random_char=function(){var e,t,n;e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";n=Math.floor(Math.random()*e.length);return t=e.substring(n,n+1)};return e}();t.AbstractChosen=e}).call(this);(function(){var e,t,n,r,i={}.hasOwnProperty,s=function(e,t){function r(){this.constructor=e}for(var n in t)i.call(t,n)&&(e[n]=t[n]);r.prototype=t.prototype;e.prototype=new r;e.__super__=t.prototype;return e};r=this;e=jQuery;e.fn.extend({chosen:function(n){var r,i,s;s=navigator.userAgent.toLowerCase();i=/(msie) ([\w.]+)/.exec(s)||[];r={name:i[1]||"",version:i[2]||"0"};return r.name==="msie"&&(r.version==="6.0"||r.version==="7.0"&&document.documentMode===7)?this:this.each(function(r){var i;i=e(this);if(!i.hasClass("chzn-done"))return i.data("chosen",new t(this,n))})}});t=function(t){function i(){return i.__super__.constructor.apply(this,arguments)}s(i,t);i.prototype.setup=function(){this.form_field_jq=e(this.form_field);this.current_value=this.form_field_jq.val();return this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")};i.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")};i.prototype.set_up_html=function(){var t,r,i,s,o,u;this.container_id=this.form_field.id.length?this.form_field.id.replace(/[^\w]/g,"_"):this.generate_field_id();this.container_id+="_chzn";t=["chzn-container"];t.push("chzn-container-"+(this.is_multiple?"multi":"single"));this.inherit_select_classes&&this.form_field.className&&t.push(this.form_field.className);this.is_rtl&&t.push("chzn-rtl");this.f_width=this.form_field_jq.outerWidth();i={id:this.container_id,"class":t.join(" "),style:"width: "+this.f_width+"px;",title:this.form_field.title};r=e("<div />",i);this.is_multiple?r.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'):r.html('<a href="javascript:void(0)" class="chzn-single chzn-default" tabindex="-1"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');this.form_field_jq.hide().after(r);this.container=e("#"+this.container_id);this.dropdown=this.container.find("div.chzn-drop").first();s=this.container.height();o=this.f_width-n(this.dropdown);this.dropdown.css({width:o+"px",top:s+"px"});this.search_field=this.container.find("input").first();this.search_results=this.container.find("ul.chzn-results").first();this.search_field_scale();this.search_no_results=this.container.find("li.no-results").first();if(this.is_multiple){this.search_choices=this.container.find("ul.chzn-choices").first();this.search_container=this.container.find("li.search-field").first()}else{this.search_container=this.container.find("div.chzn-search").first();this.selected_item=this.container.find(".chzn-single").first();u=o-n(this.search_container)-n(this.search_field);this.search_field.css({width:u+"px"})}this.results_build();this.set_tab_index();return this.form_field_jq.trigger("liszt:ready",{chosen:this})};i.prototype.register_observers=function(){var e=this;this.container.mousedown(function(t){return e.container_mousedown(t)});this.container.mouseup(function(t){return e.container_mouseup(t)});this.container.mouseenter(function(t){return e.mouse_enter(t)});this.container.mouseleave(function(t){return e.mouse_leave(t)});this.search_results.mouseup(function(t){return e.search_results_mouseup(t)});this.search_results.mouseover(function(t){return e.search_results_mouseover(t)});this.search_results.mouseout(function(t){return e.search_results_mouseout(t)});this.form_field_jq.bind("liszt:updated",function(t){return e.results_update_field(t)});this.form_field_jq.bind("liszt:activate",function(t){return e.activate_field(t)});this.form_field_jq.bind("liszt:open",function(t){return e.container_mousedown(t)});this.search_field.blur(function(t){return e.input_blur(t)});this.search_field.keyup(function(t){return e.keyup_checker(t)});this.search_field.keydown(function(t){return e.keydown_checker(t)});this.search_field.focus(function(t){return e.input_focus(t)});return this.is_multiple?this.search_choices.click(function(t){return e.choices_click(t)}):this.container.click(function(e){return e.preventDefault()})};i.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled){this.container.addClass("chzn-disabled");this.search_field[0].disabled=!0;this.is_multiple||this.selected_item.unbind("focus",this.activate_action);return this.close_field()}this.container.removeClass("chzn-disabled");this.search_field[0].disabled=!1;if(!this.is_multiple)return this.selected_item.bind("focus",this.activate_action)};i.prototype.container_mousedown=function(t){var n;if(!this.is_disabled){n=t!=null?e(t.target).hasClass("search-choice-close"):!1;t&&t.type==="mousedown"&&!this.results_showing&&t.preventDefault();if(!this.pending_destroy_click&&!n){if(!this.active_field){this.is_multiple&&this.search_field.val("");e(document).click(this.click_test_action);this.results_show()}else if(!this.is_multiple&&t&&(e(t.target)[0]===this.selected_item[0]||e(t.target).parents("a.chzn-single").length)){t.preventDefault();this.results_toggle()}return this.activate_field()}return this.pending_destroy_click=!1}};i.prototype.container_mouseup=function(e){if(e.target.nodeName==="ABBR"&&!this.is_disabled)return this.results_reset(e)};i.prototype.blur_test=function(e){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()};i.prototype.close_field=function(){e(document).unbind("click",this.click_test_action);this.active_field=!1;this.results_hide();this.container.removeClass("chzn-container-active");this.winnow_results_clear();this.clear_backstroke();this.show_search_field_default();return this.search_field_scale()};i.prototype.activate_field=function(){this.container.addClass("chzn-container-active");this.active_field=!0;this.search_field.val(this.search_field.val());return this.search_field.focus()};i.prototype.test_active_click=function(t){return e(t.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()};i.prototype.results_build=function(){var e,t,n,i,s;this.parsing=!0;this.results_data=r.SelectParser.select_to_array(this.form_field);if(this.is_multiple&&this.choices>0){this.search_choices.find("li.search-choice").remove();this.choices=0}else if(!this.is_multiple){this.selected_item.addClass("chzn-default").find("span").text(this.default_text);this.disable_search||this.form_field.options.length<=this.disable_search_threshold?this.container.addClass("chzn-container-single-nosearch"):this.container.removeClass("chzn-container-single-nosearch")}e="";s=this.results_data;for(n=0,i=s.length;n<i;n++){t=s[n];if(t.group)e+=this.result_add_group(t);else if(!t.empty){e+=this.result_add_option(t);if(t.selected&&this.is_multiple)this.choice_build(t);else if(t.selected&&!this.is_multiple){this.selected_item.removeClass("chzn-default").find("span").text(t.text);this.allow_single_deselect&&this.single_deselect_control_build()}}}this.search_field_disabled();this.show_search_field_default();this.search_field_scale();this.search_results.html(e);return this.parsing=!1};i.prototype.result_add_group=function(t){if(!t.disabled){t.dom_id=this.container_id+"_g_"+t.array_index;return'<li id="'+t.dom_id+'" class="group-result">'+e("<div />").text(t.label).html()+"</li>"}return""};i.prototype.result_do_highlight=function(e){var t,n,r,i,s;if(e.length){this.result_clear_highlight();this.result_highlight=e;this.result_highlight.addClass("highlighted");r=parseInt(this.search_results.css("maxHeight"),10);s=this.search_results.scrollTop();i=r+s;n=this.result_highlight.position().top+this.search_results.scrollTop();t=n+this.result_highlight.outerHeight();if(t>=i)return this.search_results.scrollTop(t-r>0?t-r:0);if(n<s)return this.search_results.scrollTop(n)}};i.prototype.result_clear_highlight=function(){this.result_highlight&&this.result_highlight.removeClass("highlighted");return this.result_highlight=null};i.prototype.results_show=function(){var e;if(!this.is_multiple){this.selected_item.addClass("chzn-single-with-drop");this.result_single_selected&&this.result_do_highlight(this.result_single_selected)}else if(this.max_selected_options<=this.choices){this.form_field_jq.trigger("liszt:maxselected",{chosen:this});return!1}e=this.is_multiple?this.container.height():this.container.height()-1;this.form_field_jq.trigger("liszt:showing_dropdown",{chosen:this});this.dropdown.css({top:e+"px",left:0});this.results_showing=!0;this.search_field.focus();this.search_field.val(this.search_field.val());return this.winnow_results()};i.prototype.results_hide=function(){this.is_multiple||this.selected_item.removeClass("chzn-single-with-drop");this.result_clear_highlight();this.form_field_jq.trigger("liszt:hiding_dropdown",{chosen:this});this.dropdown.css({left:"-9000px"});return this.results_showing=!1};i.prototype.set_tab_index=function(e){var t;if(this.form_field_jq.attr("tabindex")){t=this.form_field_jq.attr("tabindex");this.form_field_jq.attr("tabindex",-1);return this.search_field.attr("tabindex",t)}};i.prototype.show_search_field_default=function(){if(this.is_multiple&&this.choices<1&&!this.active_field){this.search_field.val(this.default_text);return this.search_field.addClass("default")}this.search_field.val("");return this.search_field.removeClass("default")};i.prototype.search_results_mouseup=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n.length){this.result_highlight=n;this.result_select(t);return this.search_field.focus()}};i.prototype.search_results_mouseover=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n)return this.result_do_highlight(n)};i.prototype.search_results_mouseout=function(t){if(e(t.target).hasClass("active-result"))return this.result_clear_highlight()};i.prototype.choices_click=function(t){t.preventDefault();if(this.active_field&&!e(t.target).hasClass("search-choice")&&!this.results_showing)return this.results_show()};i.prototype.choice_build=function(t){var n,r,i,s=this;if(this.is_multiple&&this.max_selected_options<=this.choices){this.form_field_jq.trigger("liszt:maxselected",{chosen:this});return!1}n=this.container_id+"_c_"+t.array_index;this.choices+=1;t.disabled?r='<li class="search-choice search-choice-disabled" id="'+n+'"><span>'+t.html+"</span></li>":r='<li class="search-choice" id="'+n+'"><span>'+t.html+'</span><a href="javascript:void(0)" class="search-choice-close" rel="'+t.array_index+'"></a></li>';this.search_container.before(r);i=e("#"+n).find("a").first();return i.click(function(e){return s.choice_destroy_link_click(e)})};i.prototype.choice_destroy_link_click=function(t){t.preventDefault();if(!this.is_disabled){this.pending_destroy_click=!0;return this.choice_destroy(e(t.target))}return t.stopPropagation};i.prototype.choice_destroy=function(e){if(this.result_deselect(e.attr("rel"))){this.choices-=1;this.show_search_field_default();this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide();e.parents("li").first().remove();return this.search_field_scale()}};i.prototype.results_reset=function(){this.form_field.options[0].selected=!0;this.selected_item.find("span").text(this.default_text);this.is_multiple||this.selected_item.addClass("chzn-default");this.show_search_field_default();this.results_reset_cleanup();this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()};i.prototype.results_reset_cleanup=function(){this.current_value=this.form_field_jq.val();return this.selected_item.find("abbr").remove()};i.prototype.result_select=function(e){var t,n,r,i;if(this.result_highlight){t=this.result_highlight;n=t.attr("id");this.result_clear_highlight();if(this.is_multiple)this.result_deactivate(t);else{this.search_results.find(".result-selected").removeClass("result-selected");this.result_single_selected=t;this.selected_item.removeClass("chzn-default")}t.addClass("result-selected");i=n.substr(n.lastIndexOf("_")+1);r=this.results_data[i];r.selected=!0;this.form_field.options[r.options_index].selected=!0;if(this.is_multiple)this.choice_build(r);else{this.selected_item.find("span").first().text(r.text);this.allow_single_deselect&&this.single_deselect_control_build()}(!e.metaKey&&!e.ctrlKey||!this.is_multiple)&&this.results_hide();this.search_field.val("");(this.is_multiple||this.form_field_jq.val()!==this.current_value)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[r.options_index].value});this.current_value=this.form_field_jq.val();return this.search_field_scale()}};i.prototype.result_activate=function(e){return e.addClass("active-result")};i.prototype.result_deactivate=function(e){return e.removeClass("active-result")};i.prototype.result_deselect=function(t){var n,r;r=this.results_data[t];if(!this.form_field.options[r.options_index].disabled){r.selected=!1;this.form_field.options[r.options_index].selected=!1;n=e("#"+this.container_id+"_o_"+t);n.removeClass("result-selected").addClass("active-result").show();this.result_clear_highlight();this.winnow_results();this.form_field_jq.trigger("change",{deselected:this.form_field.options[r.options_index].value});this.search_field_scale();return!0}return!1};i.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1)return this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>')};i.prototype.winnow_results=function(){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y;this.no_results_clear();f=0;l=this.search_field.val()===this.default_text?"":e("<div/>").text(e.trim(this.search_field.val())).html();o=this.search_contains?"":"^";s=new RegExp(o+l.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i");p=new RegExp(l.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i");y=this.results_data;for(d=0,m=y.length;d<m;d++){n=y[d];if(!n.disabled&&!n.empty)if(n.group)e("#"+n.dom_id).css("display","none");else if(!this.is_multiple||!n.selected){t=!1;a=n.dom_id;u=e("#"+a);if(s.test(n.html)){t=!0;f+=1}else if(this.enable_split_word_search&&(n.html.indexOf(" ")>=0||n.html.indexOf("[")===0)){i=n.html.replace(/\[|\]/g,"").split(" ");if(i.length)for(v=0,g=i.length;v<g;v++){r=i[v];if(s.test(r)){t=!0;f+=1}}}if(t){if(l.length){c=n.html.search(p);h=n.html.substr(0,c+l.length)+"</em>"+n.html.substr(c+l.length);h=h.substr(0,c)+"<em>"+h.substr(c)}else h=n.html;u.html(h);this.result_activate(u);n.group_array_index!=null&&e("#"+this.results_data[n.group_array_index].dom_id).css("display","list-item")}else{this.result_highlight&&a===this.result_highlight.attr("id")&&this.result_clear_highlight();this.result_deactivate(u)}}}return f<1&&l.length?this.no_results(l):this.winnow_results_set_highlight()};i.prototype.winnow_results_clear=function(){var t,n,r,i,s;this.search_field.val("");n=this.search_results.find("li");s=[];for(r=0,i=n.length;r<i;r++){t=n[r];t=e(t);t.hasClass("group-result")?s.push(t.css("display","auto")):!this.is_multiple||!t.hasClass("result-selected")?s.push(this.result_activate(t)):s.push(void 0)}return s};i.prototype.winnow_results_set_highlight=function(){var e,t;if(!this.result_highlight){t=this.is_multiple?[]:this.search_results.find(".result-selected.active-result");e=t.length?t.first():this.search_results.find(".active-result").first();if(e!=null)return this.result_do_highlight(e)}};i.prototype.no_results=function(t){var n;n=e('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>');n.find("span").first().html(t);return this.search_results.append(n)};i.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()};i.prototype.keydown_arrow=function(){var t,n;if(!this.result_highlight){t=this.search_results.find("li.active-result").first();t&&this.result_do_highlight(e(t))}else if(this.results_showing){n=this.result_highlight.nextAll("li.active-result").first();n&&this.result_do_highlight(n)}if(!this.results_showing)return this.results_show()};i.prototype.keyup_arrow=function(){var e;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight){e=this.result_highlight.prevAll("li.active-result");if(e.length)return this.result_do_highlight(e.first());this.choices>0&&this.results_hide();return this.result_clear_highlight()}};i.prototype.keydown_backstroke=function(){var e;if(this.pending_backstroke){this.choice_destroy(this.pending_backstroke.find("a").first());return this.clear_backstroke()}e=this.search_container.siblings("li.search-choice").last();if(e.length&&!e.hasClass("search-choice-disabled")){this.pending_backstroke=e;return this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")}};i.prototype.clear_backstroke=function(){this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus");return this.pending_backstroke=null};i.prototype.keydown_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode;this.search_field_scale();t!==8&&this.pending_backstroke&&this.clear_backstroke();switch(t){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(e);this.mouse_on_container=!1;break;case 13:e.preventDefault();break;case 38:e.preventDefault();this.keyup_arrow();break;case 40:this.keydown_arrow()}};i.prototype.search_field_scale=function(){var t,n,r,i,s,o,u,a,f;if(this.is_multiple){r=0;u=0;s="position:absolute; left: -1000px; top: -1000px; display:none;";o=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(a=0,f=o.length;a<f;a++){i=o[a];s+=i+":"+this.search_field.css(i)+";"}n=e("<div />",{style:s});n.text(this.search_field.val());e("body").append(n);u=n.width()+25;n.remove();u>this.f_width-10&&(u=this.f_width-10);this.search_field.css({width:u+"px"});t=this.container.height();return this.dropdown.css({top:t+"px"})}};i.prototype.generate_random_id=function(){var t;t="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(e("#"+t).length>0)t+=this.generate_random_char();return t};return i}(AbstractChosen);r.Chosen=t;n=function(e){var t;return t=e.outerWidth()-e.width()};r.get_side_border_padding=n}).call(this);8 // This file is generated by `grunt build`, do not edit it by hand. 9 (function(){var e,t,n,r,i,s={}.hasOwnProperty,o=function(e,t){function r(){this.constructor=e}for(var n in t)s.call(t,n)&&(e[n]=t[n]);r.prototype=t.prototype;e.prototype=new r;e.__super__=t.prototype;return e};r=function(){function e(){this.options_index=0;this.parsed=[]}e.prototype.add_node=function(e){return e.nodeName.toUpperCase()==="OPTGROUP"?this.add_group(e):this.add_option(e)};e.prototype.add_group=function(e){var t,n,r,i,s,o;t=this.parsed.length;this.parsed.push({array_index:t,group:!0,label:this.escapeExpression(e.label),children:0,disabled:e.disabled});s=e.childNodes;o=[];for(r=0,i=s.length;r<i;r++){n=s[r];o.push(this.add_option(n,t,e.disabled))}return o};e.prototype.add_option=function(e,t,n){if(e.nodeName.toUpperCase()==="OPTION"){if(e.text!==""){t!=null&&(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,selected:e.selected,disabled:n===!0?n:e.disabled,group_array_index:t,classes:e.className,style:e.style.cssText})}else this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0});return this.options_index+=1}};e.prototype.escapeExpression=function(e){var t,n;if(e==null||e===!1)return"";if(!/[\&\<\>\"\'\`]/.test(e))return e;t={"<":"<",">":">",'"':""","'":"'","`":"`"};n=/&(?!\w+;)|[\<\>\"\'\`]/g;return e.replace(n,function(e){return t[e]||"&"})};return e}();r.select_to_array=function(e){var t,n,i,s,o;n=new r;o=e.childNodes;for(i=0,s=o.length;i<s;i++){t=o[i];n.add_node(t)}return n.parsed};t=function(){function e(t,n){this.form_field=t;this.options=n!=null?n:{};if(!e.browser_is_supported())return;this.is_multiple=this.form_field.multiple;this.set_default_text();this.set_default_values();this.setup();this.set_up_html();this.register_observers()}e.prototype.set_default_values=function(){var e=this;this.click_test_action=function(t){return e.test_active_click(t)};this.activate_action=function(t){return e.activate_field(t)};this.active_field=!1;this.mouse_on_container=!1;this.results_showing=!1;this.result_highlighted=null;this.result_single_selected=null;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:!1;this.disable_search_threshold=this.options.disable_search_threshold||0;this.disable_search=this.options.disable_search||!1;this.enable_split_word_search=this.options.enable_split_word_search!=null?this.options.enable_split_word_search:!0;this.group_search=this.options.group_search!=null?this.options.group_search:!0;this.search_contains=this.options.search_contains||!1;this.single_backstroke_delete=this.options.single_backstroke_delete!=null?this.options.single_backstroke_delete:!0;this.max_selected_options=this.options.max_selected_options||Infinity;this.inherit_select_classes=this.options.inherit_select_classes||!1;this.display_selected_options=this.options.display_selected_options!=null?this.options.display_selected_options:!0;return this.display_disabled_options=this.options.display_disabled_options!=null?this.options.display_disabled_options:!0};e.prototype.set_default_text=function(){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;return this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||e.default_no_result_text};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){var t=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return t.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()};e.prototype.input_blur=function(e){var t=this;if(!this.mouse_on_container){this.active_field=!1;return setTimeout(function(){return t.blur_test()},100)}};e.prototype.results_option_build=function(e){var t,n,r,i,s;t="";s=this.results_data;for(r=0,i=s.length;r<i;r++){n=s[r];n.group?t+=this.result_add_group(n):t+=this.result_add_option(n);if(e!=null?e.first:void 0)n.selected&&this.is_multiple?this.choice_build(n):n.selected&&!this.is_multiple&&this.single_set_selected_text(n.text)}return t};e.prototype.result_add_option=function(e){var t,n;if(!e.search_match)return"";if(!this.include_option_in_results(e))return"";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");e.group_array_index!=null&&t.push("group-option");e.classes!==""&&t.push(e.classes);n=e.style.cssText!==""?' style="'+e.style+'"':"";return'<li class="'+t.join(" ")+'"'+n+' data-option-array-index="'+e.array_index+'">'+e.search_text+"</li>"};e.prototype.result_add_group=function(e){return!e.search_match&&!e.group_match?"":e.active_options>0?'<li class="group-result">'+e.search_text+"</li>":""};e.prototype.results_update_field=function(){this.set_default_text();this.is_multiple||this.results_reset_cleanup();this.result_clear_highlight();this.result_single_selected=null;this.results_build();if(this.results_showing)return this.winnow_results()};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(){var e,t,n,r,i,s,o,u,a,f,l,c,h;this.no_results_clear();i=0;o=this.get_search_text();e=o.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");r=this.search_contains?"":"^";n=new RegExp(r+e,"i");f=new RegExp(e,"i");h=this.results_data;for(l=0,c=h.length;l<c;l++){t=h[l];t.search_match=!1;s=null;if(this.include_option_in_results(t)){if(t.group){t.group_match=!1;t.active_options=0}if(t.group_array_index!=null&&this.results_data[t.group_array_index]){s=this.results_data[t.group_array_index];s.active_options===0&&s.search_match&&(i+=1);s.active_options+=1}if(!t.group||!!this.group_search){t.search_text=t.group?t.label:t.html;t.search_match=this.search_string_match(t.search_text,n);t.search_match&&!t.group&&(i+=1);if(t.search_match){if(o.length){u=t.search_text.search(f);a=t.search_text.substr(0,u+o.length)+"</em>"+t.search_text.substr(u+o.length);t.search_text=a.substr(0,u)+"<em>"+a.substr(u)}s!=null&&(s.group_match=!0)}else t.group_array_index!=null&&this.results_data[t.group_array_index].search_match&&(t.search_match=!0)}}}this.result_clear_highlight();if(i<1&&o.length){this.update_results_content("");return this.no_results(o)}this.update_results_content(this.results_option_build());return this.winnow_results_set_highlight()};e.prototype.search_string_match=function(e,t){var n,r,i,s;if(t.test(e))return!0;if(this.enable_split_word_search&&(e.indexOf(" ")>=0||e.indexOf("[")===0)){r=e.replace(/\[|\]/g,"").split(" ");if(r.length)for(i=0,s=r.length;i<s;i++){n=r[i];if(t.test(n))return!0}}};e.prototype.choices_count=function(){var e,t,n,r;if(this.selected_option_count!=null)return this.selected_option_count;this.selected_option_count=0;r=this.form_field.options;for(t=0,n=r.length;t<n;t++){e=r[t];e.selected&&(this.selected_option_count+=1)}return this.selected_option_count};e.prototype.choices_click=function(e){e.preventDefault();if(!this.results_showing&&!this.is_disabled)return this.results_show()};e.prototype.keyup_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode;this.search_field_scale();switch(t){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke){this.result_clear_highlight();return this.results_search()}break;case 13:e.preventDefault();if(this.results_showing)return this.result_select(e);break;case 27:this.results_showing&&this.results_hide();return!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}};e.prototype.container_width=function(){return this.options.width!=null?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?!1:!this.display_disabled_options&&e.disabled?!1:e.empty?!1:!0};e.browser_is_supported=function(){return window.navigator.appName==="Microsoft Internet Explorer"?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)?!1:/Android/i.test(window.navigator.userAgent)&&/Mobile/i.test(window.navigator.userAgent)?!1:!0};e.default_multiple_text="Select Some Options";e.default_single_text="Select an Option";e.default_no_result_text="No results match";return e}();e=jQuery;e.fn.extend({chosen:function(r){return t.browser_is_supported()?this.each(function(t){var i,s;i=e(this);s=i.data("chosen");r==="destroy"&&s?s.destroy():s||i.data("chosen",new n(this,r))}):this}});n=function(t){function n(){i=n.__super__.constructor.apply(this,arguments);return i}o(n,t);n.prototype.setup=function(){this.form_field_jq=e(this.form_field);this.current_selectedIndex=this.form_field.selectedIndex;return this.is_rtl=this.form_field_jq.hasClass("chosen-rtl")};n.prototype.set_up_html=function(){var t,n;t=["chosen-container"];t.push("chosen-container-"+(this.is_multiple?"multi":"single"));this.inherit_select_classes&&this.form_field.className&&t.push(this.form_field.className);this.is_rtl&&t.push("chosen-rtl");n={"class":t.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title};this.form_field.id.length&&(n.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen");this.container=e("<div />",n);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" tabindex="-1"><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();if(this.is_multiple){this.search_choices=this.container.find("ul.chosen-choices").first();this.search_container=this.container.find("li.search-field").first()}else{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();return this.form_field_jq.trigger("chosen:ready",{chosen:this})};n.prototype.register_observers=function(){var e=this;this.container.bind("mousedown.chosen",function(t){e.container_mousedown(t)});this.container.bind("mouseup.chosen",function(t){e.container_mouseup(t)});this.container.bind("mouseenter.chosen",function(t){e.mouse_enter(t)});this.container.bind("mouseleave.chosen",function(t){e.mouse_leave(t)});this.search_results.bind("mouseup.chosen",function(t){e.search_results_mouseup(t)});this.search_results.bind("mouseover.chosen",function(t){e.search_results_mouseover(t)});this.search_results.bind("mouseout.chosen",function(t){e.search_results_mouseout(t)});this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",function(t){e.search_results_mousewheel(t)});this.form_field_jq.bind("chosen:updated.chosen",function(t){e.results_update_field(t)});this.form_field_jq.bind("chosen:activate.chosen",function(t){e.activate_field(t)});this.form_field_jq.bind("chosen:open.chosen",function(t){e.container_mousedown(t)});this.search_field.bind("blur.chosen",function(t){e.input_blur(t)});this.search_field.bind("keyup.chosen",function(t){e.keyup_checker(t)});this.search_field.bind("keydown.chosen",function(t){e.keydown_checker(t)});this.search_field.bind("focus.chosen",function(t){e.input_focus(t)});return this.is_multiple?this.search_choices.bind("click.chosen",function(t){e.choices_click(t)}):this.container.bind("click.chosen",function(e){e.preventDefault()})};n.prototype.destroy=function(){e(document).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");return this.form_field_jq.show()};n.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(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);return this.close_field()}this.container.removeClass("chosen-disabled");this.search_field[0].disabled=!1;if(!this.is_multiple)return this.selected_item.bind("focus.chosen",this.activate_action)};n.prototype.container_mousedown=function(t){if(!this.is_disabled){t&&t.type==="mousedown"&&!this.results_showing&&t.preventDefault();if(t==null||!e(t.target).hasClass("search-choice-close")){if(!this.active_field){this.is_multiple&&this.search_field.val("");e(document).bind("click.chosen",this.click_test_action);this.results_show()}else if(!this.is_multiple&&t&&(e(t.target)[0]===this.selected_item[0]||e(t.target).parents("a.chosen-single").length)){t.preventDefault();this.results_toggle()}return this.activate_field()}}};n.prototype.container_mouseup=function(e){if(e.target.nodeName==="ABBR"&&!this.is_disabled)return this.results_reset(e)};n.prototype.search_results_mousewheel=function(e){var t,n,r;t=-((n=e.originalEvent)!=null?n.wheelDelta:void 0)||((r=e.originialEvent)!=null?r.detail:void 0);if(t!=null){e.preventDefault();e.type==="DOMMouseScroll"&&(t*=40);return this.search_results.scrollTop(t+this.search_results.scrollTop())}};n.prototype.blur_test=function(e){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()};n.prototype.close_field=function(){e(document).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();return this.search_field_scale()};n.prototype.activate_field=function(){this.container.addClass("chosen-container-active");this.active_field=!0;this.search_field.val(this.search_field.val());return this.search_field.focus()};n.prototype.test_active_click=function(t){return this.container.is(e(t.target).closest(".chosen-container"))?this.active_field=!0:this.close_field()};n.prototype.results_build=function(){this.parsing=!0;this.selected_option_count=null;this.results_data=r.select_to_array(this.form_field);if(this.is_multiple)this.search_choices.find("li.search-choice").remove();else if(!this.is_multiple){this.single_set_selected_text();if(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")}else{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();return this.parsing=!1};n.prototype.result_do_highlight=function(e){var t,n,r,i,s;if(e.length){this.result_clear_highlight();this.result_highlight=e;this.result_highlight.addClass("highlighted");r=parseInt(this.search_results.css("maxHeight"),10);s=this.search_results.scrollTop();i=r+s;n=this.result_highlight.position().top+this.search_results.scrollTop();t=n+this.result_highlight.outerHeight();if(t>=i)return this.search_results.scrollTop(t-r>0?t-r:0);if(n<s)return this.search_results.scrollTop(n)}};n.prototype.result_clear_highlight=function(){this.result_highlight&&this.result_highlight.removeClass("highlighted");return this.result_highlight=null};n.prototype.results_show=function(){if(this.is_multiple&&this.max_selected_options<=this.choices_count()){this.form_field_jq.trigger("chosen:maxselected",{chosen:this});return!1}this.container.addClass("chosen-with-drop");this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this});this.results_showing=!0;this.search_field.focus();this.search_field.val(this.search_field.val());return this.winnow_results()};n.prototype.update_results_content=function(e){return this.search_results.html(e)};n.prototype.results_hide=function(){if(this.results_showing){this.result_clear_highlight();this.container.removeClass("chosen-with-drop");this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})}return this.results_showing=!1};n.prototype.set_tab_index=function(e){var t;if(this.form_field.tabIndex){t=this.form_field.tabIndex;this.form_field.tabIndex=-1;return this.search_field[0].tabIndex=t}};n.prototype.set_label_behavior=function(){var t=this;this.form_field_label=this.form_field_jq.parents("label");!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=e("label[for='"+this.form_field.id+"']"));if(this.form_field_label.length>0)return this.form_field_label.bind("click.chosen",function(e){return t.is_multiple?t.container_mousedown(e):t.activate_field()})};n.prototype.show_search_field_default=function(){if(this.is_multiple&&this.choices_count()<1&&!this.active_field){this.search_field.val(this.default_text);return this.search_field.addClass("default")}this.search_field.val("");return this.search_field.removeClass("default")};n.prototype.search_results_mouseup=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n.length){this.result_highlight=n;this.result_select(t);return this.search_field.focus()}};n.prototype.search_results_mouseover=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n)return this.result_do_highlight(n)};n.prototype.search_results_mouseout=function(t){if(e(t.target).hasClass("active-result"))return this.result_clear_highlight()};n.prototype.choice_build=function(t){var n,r,i=this;n=e("<li />",{"class":"search-choice"}).html("<span>"+t.html+"</span>");if(t.disabled)n.addClass("search-choice-disabled");else{r=e("<a />",{"class":"search-choice-close","data-option-array-index":t.array_index});r.bind("click.chosen",function(e){return i.choice_destroy_link_click(e)});n.append(r)}return this.search_container.before(n)};n.prototype.choice_destroy_link_click=function(t){t.preventDefault();t.stopPropagation();if(!this.is_disabled)return this.choice_destroy(e(t.target))};n.prototype.choice_destroy=function(e){if(this.result_deselect(e[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();e.parents("li").first().remove();return this.search_field_scale()}};n.prototype.results_reset=function(){this.form_field.options[0].selected=!0;this.selected_option_count=null;this.single_set_selected_text();this.show_search_field_default();this.results_reset_cleanup();this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()};n.prototype.results_reset_cleanup=function(){this.current_selectedIndex=this.form_field.selectedIndex;return this.selected_item.find("abbr").remove()};n.prototype.result_select=function(e){var t,n,r;if(this.result_highlight){t=this.result_highlight;this.result_clear_highlight();if(this.is_multiple&&this.max_selected_options<=this.choices_count()){this.form_field_jq.trigger("chosen:maxselected",{chosen:this});return!1}if(this.is_multiple)t.removeClass("active-result");else{if(this.result_single_selected){this.result_single_selected.removeClass("result-selected");r=this.result_single_selected[0].getAttribute("data-option-array-index");this.results_data[r].selected=!1}this.result_single_selected=t}t.addClass("result-selected");n=this.results_data[t[0].getAttribute("data-option-array-index")];n.selected=!0;this.form_field.options[n.options_index].selected=!0;this.selected_option_count=null;this.is_multiple?this.choice_build(n):this.single_set_selected_text(n.text);(!e.metaKey&&!e.ctrlKey||!this.is_multiple)&&this.results_hide();this.search_field.val("");(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[n.options_index].value});this.current_selectedIndex=this.form_field.selectedIndex;return this.search_field_scale()}};n.prototype.single_set_selected_text=function(e){e==null&&(e=this.default_text);if(e===this.default_text)this.selected_item.addClass("chosen-default");else{this.single_deselect_control_build();this.selected_item.removeClass("chosen-default")}return this.selected_item.find("span").text(e)};n.prototype.result_deselect=function(e){var t;t=this.results_data[e];if(!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.form_field_jq.trigger("change",{deselected:this.form_field.options[t.options_index].value});this.search_field_scale();return!0}return!1};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>');return this.selected_item.addClass("chosen-single-with-deselect")};n.prototype.get_search_text=function(){return this.search_field.val()===this.default_text?"":e("<div/>").text(e.trim(this.search_field.val())).html()};n.prototype.winnow_results_set_highlight=function(){var e,t;t=this.is_multiple?[]:this.search_results.find(".result-selected.active-result");e=t.length?t.first():this.search_results.find(".active-result").first();if(e!=null)return this.result_do_highlight(e)};n.prototype.no_results=function(t){var n;n=e('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>');n.find("span").first().html(t);return this.search_results.append(n)};n.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()};n.prototype.keydown_arrow=function(){var e;if(!this.results_showing||!this.result_highlight)return this.results_show();e=this.result_highlight.nextAll("li.active-result").first();if(e)return this.result_do_highlight(e)};n.prototype.keyup_arrow=function(){var e;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight){e=this.result_highlight.prevAll("li.active-result");if(e.length)return this.result_do_highlight(e.first());this.choices_count()>0&&this.results_hide();return this.result_clear_highlight()}};n.prototype.keydown_backstroke=function(){var e;if(this.pending_backstroke){this.choice_destroy(this.pending_backstroke.find("a").first());return this.clear_backstroke()}e=this.search_container.siblings("li.search-choice").last();if(e.length&&!e.hasClass("search-choice-disabled")){this.pending_backstroke=e;return this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")}};n.prototype.clear_backstroke=function(){this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus");return this.pending_backstroke=null};n.prototype.keydown_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode;this.search_field_scale();t!==8&&this.pending_backstroke&&this.clear_backstroke();switch(t){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(e);this.mouse_on_container=!1;break;case 13:e.preventDefault();break;case 38:e.preventDefault();this.keyup_arrow();break;case 40:e.preventDefault();this.keydown_arrow()}};n.prototype.search_field_scale=function(){var t,n,r,i,s,o,u,a,f;if(this.is_multiple){r=0;u=0;s="position:absolute; left: -1000px; top: -1000px; display:none;";o=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(a=0,f=o.length;a<f;a++){i=o[a];s+=i+":"+this.search_field.css(i)+";"}t=e("<div />",{style:s});t.text(this.search_field.val());e("body").append(t);u=t.width()+25;t.remove();n=this.container.outerWidth();u>n-10&&(u=n-10);return this.search_field.css({width:u+"px"})}};return n}(t)}).call(this); -
woocommerce-poor-guys-swiss-knife/trunk/classes/woocommerce-poor-guys-swiss-knife.php
r1040604 r1085102 751 751 $product_type = 'simple'; 752 752 if ( $product_type === 'simple' || $product_type === 'variable' ) : 753 echo "<li class=\"wcpgsk_product_tab\"><a class=\"icon16 icon-media\" href=\"#wcpgsk_data_tab\">" . __( ' ProductCart Quantities', WCPGSK_DOMAIN ) . "</a></li>";753 echo "<li class=\"wcpgsk_product_tab\"><a class=\"icon16 icon-media\" href=\"#wcpgsk_data_tab\">" . __( 'Cart Quantities', WCPGSK_DOMAIN ) . "</a></li>"; 754 754 endif; 755 755 endif; … … 960 960 $stepqty = isset($stepqty) && !empty($stepqty) ? $stepqty : 0; 961 961 */ 962 $style = ' width:125px;padding:5px 5px 5px 5px;font-size:inherit !important;font-family:inherit !important;font-face:inherit !important;line-height: 18px !important;';962 $style = 'min-width:140px;padding:10px 10px 10px 10px;display:block;font-size:inherit !important;font-family:inherit !important;font-face:inherit !important;line-height: 18px !important;'; 963 963 $style_before = 'height:auto !important;vertical-align:sub;padding: 0 3px 0 0 !important;font:400 20px/1 dashicons !important;line-height: 18px !important;content:"\f163";'; 964 964 $active_style = ''; … … 4428 4428 $wcpgsk_name = apply_filters('wcpgsk_plus_name', $wcpgsk_name); 4429 4429 add_submenu_page( 'woocommerce' , __( $wcpgsk_name, WCPGSK_DOMAIN ), __( $wcpgsk_name, WCPGSK_DOMAIN ), 'manage_options', WCPGSK_DOMAIN, array($this, 'wcpgsk__options_page') ); 4430 add_action( 'admin_enqueue_scripts', array($this, 'wcpgsk_admin_scripts') );4430 add_action( 'admin_enqueue_scripts', array($this, 'wcpgsk_admin_scripts'), 20 ); 4431 4431 } 4432 4432 … … 4452 4452 wp_enqueue_script('jquery-ui-dialog'); 4453 4453 } 4454 wp_enqueue_script( 'chosen-order', plugins_url( '/assets/js/chosen.order.jquery.min.js', $this->file ), '', '' ); 4454 if(!wp_script_is('jquery-ui-sortable', 'queue')){ 4455 wp_enqueue_script('jquery-ui-sortable'); 4456 } 4457 4455 4458 4456 4459 wp_register_script('accordion-js', plugins_url( '/assets/js/accordion.js', $this->file ), '', '', false); … … 4537 4540 'woocommerce_countries_tax_or_vat' => $this->WC()->countries->tax_or_vat(), 4538 4541 'woocommerce_countries_inc_tax_or_vat' => $this->WC()->countries->inc_tax_or_vat(), 4539 'woocommerce_countries_ex_tax_or_vat' => $this->WC()->countries->ex_tax_or_vat(), 4542 'woocommerce_countries_ex_tax_or_vat' => $this->WC()->countries->ex_tax_or_vat(), 4540 4543 ), 4541 4544 'wcpgsk_forms' => array( array( -
woocommerce-poor-guys-swiss-knife/trunk/readme.txt
r1040604 r1085102 2 2 Contributors: ulih 3 3 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KJ4K2X953H8CC 4 Tags: WooCommerce checkout manager, WooCommerce cart manager, quantity management, file upload, color picker, WooCommerce color picker, WooCommerce file upload, cart manager, checkout manager, checkout, cart, shop, WooCommerce, shop settings, cart settings, checkout settings, variations bulk manager, variations manager, minimum items, maximum items, quantity input, product quantities, incremental quantities, minimum quantity, maximum quantity, wholesale, checkout personalization, checkout form, checkout customization, custom forms, custom fields, confirmation, confirmation fields, cart button, payment gateways, payment gateways customization, gateways, shipping, field editor, field, buy, pay, bulk management, variations, variation extender, custom fields per product, custom fields per variation, checkout localization, WooCommerce labels, WooCommerce email recipients, priceable extras, member registration, extras, product extras, price labels, custom price labels, ecommerce, e-commerce, product notifications, product email 4 Tags: WooCommerce checkout manager, WooCommerce cart manager, quantity management, file upload, color picker, WooCommerce color picker, WooCommerce file upload, cart manager, checkout manager, checkout, cart, shop, WooCommerce, shop settings, cart settings, checkout settings, variations bulk manager, variations manager, minimum items, maximum items, quantity input, product quantities, incremental quantities, minimum quantity, maximum quantity, wholesale, checkout personalization, checkout form, checkout customization, custom forms, custom fields, confirmation, confirmation fields, cart button, payment gateways, payment gateways customization, gateways, shipping, field editor, field, buy, pay, bulk management, variations, variation extender, custom fields per product, custom fields per variation, checkout localization, WooCommerce labels, WooCommerce email recipients, priceable extras, member registration, extras, product extras, price labels, custom price labels, ecommerce, e-commerce, product notifications, product email, export, order export 5 5 Requires at least: Wordpress 3.1 and WooCommerce 2.0 6 6 Tested up to: 4.0 7 Stable tag: 2.2. 37 Stable tag: 2.2.4 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 92 92 = What's new? = 93 93 94 * XML export for orders and order item meta in WooCommerce Rich Guys Swiss Knife 94 95 * Manage price labels on per product basis 95 * WooCommerce 2. 2compatibility96 * WooCommerce 2.3 compatibility 96 97 * input pattern attribute support with fallback for Safari browser 97 98 * Add one CC and/or BCC email recipient to all WooCommerce emails … … 183 184 You need to upgrade to WooCommerce Rich Guys Swiss Knife to use this feature in the context of item personalization during checkout. 184 185 186 = XML Export = 187 188 XML export for orders and order item meta in WooCommerce Rich Guys Swiss Knife 185 189 186 190 == Installation == … … 302 306 303 307 == Changelog == 308 309 = 2.2.4 = 310 311 * Support for upcoming WooCommerce 2.3 304 312 305 313 = 2.2.3 = -
woocommerce-poor-guys-swiss-knife/trunk/woocommerce-poor-guys-swiss-knife.php
r1040604 r1085102 8 8 * Author: Uli Hake 9 9 * Author URI: http://takebarcelona.com/authorship/uli-hake 10 * Version: 2.2. 310 * Version: 2.2.4 11 11 * @package WordPress 12 12 * @subpackage WooCommerce Poor Guys Swiss Knife … … 121 121 //load into our global 122 122 $wcpgsk = new WCPGSK_Main( __FILE__ ); 123 $wcpgsk->version = '2.2. 3';123 $wcpgsk->version = '2.2.4'; 124 124 $wcpgsk->wcpgsk_hook_woocommerce_filters(); 125 125
Note: See TracChangeset
for help on using the changeset viewer.