From 8caad7361bdddc25ae81912892061dd1b04f759f Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Wed, 24 Aug 2016 17:07:47 +0100 Subject: [PATCH] Revert "rename liszt: chosen: and add JUI hacks" This reverts commit 86116716d6ff7ba307621de3b0e1fdc8f90bc2b1. --- media/jui/js/chosen.jquery.js | 78 +++++------------------------------ 1 file changed, 10 insertions(+), 68 deletions(-) diff --git a/media/jui/js/chosen.jquery.js b/media/jui/js/chosen.jquery.js index b021ae437ca59..c8e9053089592 100755 --- a/media/jui/js/chosen.jquery.js +++ b/media/jui/js/chosen.jquery.js @@ -6,11 +6,9 @@ Version 1.6.2 Full source at https://github.com/harvesthq/chosen Copyright (c) 2011-2016 Harvest http://getharvest.com -// -// Modified for Joomla! UI: -// - fix zero width, based on https://github.com/harvesthq/chosen/pull/1439 -// - allow to add a custom value on fly, based on https://github.com/harvesthq/chosen/pull/749 -// +MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md +This file is generated by `grunt build`, do not edit it by hand. +*/ (function() { var $, AbstractChosen, Chosen, SelectParser, _ref, @@ -147,10 +145,6 @@ Copyright (c) 2011-2016 Harvest http://getharvest.com this.mouse_on_container = false; this.results_showing = false; this.result_highlighted = null; - /**/ - /* Original: not exist */ - this.allow_custom_value = false; - /**/ this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false; this.disable_search_threshold = this.options.disable_search_threshold || 0; this.disable_search = this.options.disable_search || false; @@ -175,10 +169,6 @@ Copyright (c) 2011-2016 Harvest http://getharvest.com } else { this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text; } - /**/ - /* Original: not exist */ - this.custom_group_text = this.form_field.getAttribute("data-custom_group_text") || this.options.custom_group_text || "Custom Value"; - /**/ return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text; }; @@ -505,12 +495,7 @@ Copyright (c) 2011-2016 Harvest http://getharvest.com if (this.options.width != null) { return this.options.width; } else { - /**/ - /* Original: return "" + this.form_field.offsetWidth + "px"; - */ - return this.form_field_jq.css("width") || "" + this.form_field.offsetWidth + "px"; - /**/ } }; @@ -576,7 +561,7 @@ Copyright (c) 2011-2016 Harvest http://getharvest.com $ = jQuery; $.fn.extend({ - chosen: function(options) { + liszt: function(options) { if (!AbstractChosen.browser_is_supported()) { return this; } @@ -608,10 +593,6 @@ Copyright (c) 2011-2016 Harvest http://getharvest.com Chosen.prototype.setup = function() { this.form_field_jq = $(this.form_field); this.current_selectedIndex = this.form_field.selectedIndex; - /**/ - /* Original: not exist */ - this.allow_custom_value = this.form_field_jq.hasClass("chzn-custom-value") || this.options.allow_custom_value; - /**/ return this.is_rtl = this.form_field_jq.hasClass("chzn-rtl"); }; @@ -659,7 +640,7 @@ Copyright (c) 2011-2016 Harvest http://getharvest.com Chosen.prototype.on_ready = function() { return this.form_field_jq.trigger("liszt:ready", { - chosen: this + liszt: this }); }; @@ -903,7 +884,7 @@ Copyright (c) 2011-2016 Harvest http://getharvest.com Chosen.prototype.results_show = function() { if (this.is_multiple && this.max_selected_options <= this.choices_count()) { this.form_field_jq.trigger("liszt:maxselected", { - chosen: this + liszt: this }); return false; } @@ -913,7 +894,7 @@ Copyright (c) 2011-2016 Harvest http://getharvest.com this.search_field.val(this.search_field.val()); this.winnow_results(); return this.form_field_jq.trigger("liszt:showing_dropdown", { - chosen: this + liszt: this }); }; @@ -926,7 +907,7 @@ Copyright (c) 2011-2016 Harvest http://getharvest.com this.result_clear_highlight(); this.container.removeClass("chzn-with-drop"); this.form_field_jq.trigger("liszt:hiding_dropdown", { - chosen: this + liszt: this }); } return this.results_showing = false; @@ -1056,7 +1037,7 @@ Copyright (c) 2011-2016 Harvest http://getharvest.com this.result_clear_highlight(); if (this.is_multiple && this.max_selected_options <= this.choices_count()) { this.form_field_jq.trigger("liszt:maxselected", { - chosen: this + liszt: this }); return false; } @@ -1088,46 +1069,7 @@ Copyright (c) 2011-2016 Harvest http://getharvest.com evt.preventDefault(); return this.search_field_scale(); } - /**/ - /* Original: not exist */ - else if ((!this.is_multiple) && this.allow_custom_value) { - value = this.search_field.val(); - group = this.add_unique_custom_group(); - option = $(''); - group.append(option); - this.form_field_jq.append(group); - this.form_field.options[this.form_field.options.length - 1].selected = true; - if (!evt.metaKey) { - this.results_hide(); - } - return this.results_build(); - } - /**/ - }; - - /**/ - /* Original: not exist */ - Chosen.prototype.find_custom_group = function() { - var found, group, _i, _len, _ref; - _ref = $('optgroup', this.form_field); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - group = _ref[_i]; - if (group.getAttribute('label') === this.custom_group_text) { - found = group; - } - } - return found; - }; - - Chosen.prototype.add_unique_custom_group = function() { - var group; - group = this.find_custom_group(); - if (!group) { - group = $(''); - } - return $(group); }; - /**/ Chosen.prototype.single_set_selected_text = function(text) { if (text == null) { @@ -1192,7 +1134,7 @@ Copyright (c) 2011-2016 Harvest http://getharvest.com no_results_html.find("span").first().html(terms); this.search_results.append(no_results_html); return this.form_field_jq.trigger("liszt:no_results", { - chosen: this + liszt: this }); };