Skip to content

Commit

Permalink
Adding in one liner comment for version and license on minified files
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Earley committed Jun 17, 2013
1 parent cc83713 commit 9fea347
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 20 deletions.
2 changes: 2 additions & 0 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = (grunt) ->
// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
// This file is generated by `grunt build`, do not edit it by hand.\n
"""
minified_comments: "/* Chosen #{version_tag()} | (c) 2011-2013 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */\n"

concat:
options:
Expand All @@ -38,6 +39,7 @@ module.exports = (grunt) ->
options:
mangle:
except: ['jQuery', 'AbstractChosen', 'Chosen', 'SelectParser']
banner: "<%= minified_comments %>"
minified_chosen_js:
files:
'public/chosen.jquery.min.js': ['public/chosen.jquery.js']
Expand Down
34 changes: 34 additions & 0 deletions public/chosen.jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

SelectParser.prototype.add_group = function(group) {
var group_position, option, _i, _len, _ref, _results;

group_position = this.parsed.length;
this.parsed.push({
array_index: group_position,
Expand Down Expand Up @@ -78,6 +79,7 @@

SelectParser.select_to_array = function(select) {
var child, parser, _i, _len, _ref;

parser = new SelectParser();
_ref = select.childNodes;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
Expand Down Expand Up @@ -114,6 +116,7 @@

AbstractChosen.prototype.set_default_values = function() {
var _this = this;

this.click_test_action = function(evt) {
return _this.test_active_click(evt);
};
Expand Down Expand Up @@ -156,6 +159,7 @@

AbstractChosen.prototype.input_focus = function(evt) {
var _this = this;

if (this.is_multiple) {
if (!this.active_field) {
return setTimeout((function() {
Expand All @@ -171,6 +175,7 @@

AbstractChosen.prototype.input_blur = function(evt) {
var _this = this;

if (!this.mouse_on_container) {
this.active_field = false;
return setTimeout((function() {
Expand All @@ -181,6 +186,7 @@

AbstractChosen.prototype.result_add_option = function(option) {
var classes, style;

if (!option.disabled) {
option.dom_id = this.container_id + "_o_" + option.array_index;
classes = option.selected && this.is_multiple ? [] : ["active-result"];
Expand Down Expand Up @@ -228,6 +234,7 @@

AbstractChosen.prototype.choices_count = function() {
var option, _i, _len, _ref;

if (this.selected_option_count != null) {
return this.selected_option_count;
}
Expand All @@ -251,6 +258,7 @@

AbstractChosen.prototype.keyup_checker = function(evt) {
var stroke, _ref;

stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
this.search_field_scale();
switch (stroke) {
Expand Down Expand Up @@ -287,13 +295,15 @@

AbstractChosen.prototype.generate_field_id = function() {
var new_id;

new_id = this.generate_random_id();
this.form_field.id = new_id;
return new_id;
};

AbstractChosen.prototype.generate_random_char = function() {
var chars, newchar, rand;

chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
rand = Math.floor(Math.random() * chars.length);
return newchar = chars.substring(rand, rand + 1);
Expand All @@ -309,6 +319,7 @@

AbstractChosen.browser_is_supported = function() {
var _ref;

if (window.navigator.appName === "Microsoft Internet Explorer") {
return (null !== (_ref = document.documentMode) && _ref >= 8);
}
Expand Down Expand Up @@ -345,6 +356,7 @@
}
return this.each(function(input_field) {
var $this;

$this = $(this);
if (!$this.hasClass("chzn-done")) {
return $this.data('chosen', new Chosen(this, options));
Expand Down Expand Up @@ -373,6 +385,7 @@

Chosen.prototype.set_up_html = function() {
var container_classes, container_props;

this.container_id = this.form_field.id.length ? this.form_field.id.replace(/[^\w]/g, '_') : this.generate_field_id();
this.container_id += "_chzn";
container_classes = ["chzn-container"];
Expand Down Expand Up @@ -418,6 +431,7 @@

Chosen.prototype.register_observers = function() {
var _this = this;

this.container.mousedown(function(evt) {
_this.container_mousedown(evt);
});
Expand Down Expand Up @@ -521,6 +535,7 @@

Chosen.prototype.search_results_mousewheel = function(evt) {
var delta, _ref1, _ref2;

delta = -((_ref1 = evt.originalEvent) != null ? _ref1.wheelDelta : void 0) || ((_ref2 = evt.originialEvent) != null ? _ref2.detail : void 0);
if (delta != null) {
evt.preventDefault();
Expand Down Expand Up @@ -565,6 +580,7 @@

Chosen.prototype.results_build = function() {
var content, data, _i, _len, _ref1;

this.parsing = true;
this.selected_option_count = null;
this.results_data = root.SelectParser.select_to_array(this.form_field);
Expand Down Expand Up @@ -614,6 +630,7 @@

Chosen.prototype.result_do_highlight = function(el) {
var high_bottom, high_top, maxHeight, visible_bottom, visible_top;

if (el.length) {
this.result_clear_highlight();
this.result_highlight = el;
Expand Down Expand Up @@ -668,6 +685,7 @@

Chosen.prototype.set_tab_index = function(el) {
var ti;

if (this.form_field_jq.attr("tabindex")) {
ti = this.form_field_jq.attr("tabindex");
this.form_field_jq.attr("tabindex", -1);
Expand All @@ -677,6 +695,7 @@

Chosen.prototype.set_label_behavior = function() {
var _this = this;

this.form_field_label = this.form_field_jq.parents("label");
if (!this.form_field_label.length && this.form_field.id.length) {
this.form_field_label = $("label[for='" + this.form_field.id + "']");
Expand Down Expand Up @@ -704,6 +723,7 @@

Chosen.prototype.search_results_mouseup = function(evt) {
var target;

target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
if (target.length) {
this.result_highlight = target;
Expand All @@ -714,6 +734,7 @@

Chosen.prototype.search_results_mouseover = function(evt) {
var target;

target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
if (target) {
return this.result_do_highlight(target);
Expand All @@ -729,6 +750,7 @@
Chosen.prototype.choice_build = function(item) {
var choice, close_link,
_this = this;

choice = $('<li />', {
"class": "search-choice"
}).html("<span>" + item.html + "</span>");
Expand Down Expand Up @@ -789,6 +811,7 @@

Chosen.prototype.result_select = function(evt) {
var high, high_id, item, position;

if (this.result_highlight) {
high = this.result_highlight;
high_id = high.attr("id");
Expand Down Expand Up @@ -844,6 +867,7 @@

Chosen.prototype.result_deselect = function(pos) {
var result, result_data;

result_data = this.results_data[pos];
if (!this.form_field.options[result_data.options_index].disabled) {
result_data.selected = false;
Expand Down Expand Up @@ -875,6 +899,7 @@

Chosen.prototype.winnow_results = function() {
var found, option, part, parts, regex, regexAnchor, result, result_id, results, searchText, startpos, text, zregex, _i, _j, _len, _len1, _ref1;

this.no_results_clear();
results = 0;
searchText = this.search_field.val() === this.default_text ? "" : $('<div/>').text($.trim(this.search_field.val())).html();
Expand Down Expand Up @@ -937,6 +962,7 @@

Chosen.prototype.winnow_results_clear = function() {
var li, lis, _i, _len, _results;

this.search_field.val("");
lis = this.search_results.find("li");
_results = [];
Expand All @@ -956,6 +982,7 @@

Chosen.prototype.winnow_results_set_highlight = function() {
var do_high, selected_results;

if (!this.result_highlight) {
selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
Expand All @@ -967,6 +994,7 @@

Chosen.prototype.no_results = function(terms) {
var no_results_html;

no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
no_results_html.find("span").first().html(terms);
return this.search_results.append(no_results_html);
Expand All @@ -978,6 +1006,7 @@

Chosen.prototype.keydown_arrow = function() {
var first_active, next_sib;

if (!this.result_highlight) {
first_active = this.search_results.find("li.active-result").first();
if (first_active) {
Expand All @@ -996,6 +1025,7 @@

Chosen.prototype.keyup_arrow = function() {
var prev_sibs;

if (!this.results_showing && !this.is_multiple) {
return this.results_show();
} else if (this.result_highlight) {
Expand All @@ -1013,6 +1043,7 @@

Chosen.prototype.keydown_backstroke = function() {
var next_available_destroy;

if (this.pending_backstroke) {
this.choice_destroy(this.pending_backstroke.find("a").first());
return this.clear_backstroke();
Expand All @@ -1038,6 +1069,7 @@

Chosen.prototype.keydown_checker = function(evt) {
var stroke, _ref1;

stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
this.search_field_scale();
if (stroke !== 8 && this.pending_backstroke) {
Expand Down Expand Up @@ -1068,6 +1100,7 @@

Chosen.prototype.search_field_scale = function() {
var div, h, style, style_block, styles, w, _i, _len;

if (this.is_multiple) {
h = 0;
w = 0;
Expand Down Expand Up @@ -1098,6 +1131,7 @@

Chosen.prototype.generate_random_id = function() {
var string;

string = "sel" + this.generate_random_char() + this.generate_random_char() + this.generate_random_char();
while ($("#" + string).length > 0) {
string += this.generate_random_char();
Expand Down
12 changes: 2 additions & 10 deletions public/chosen.jquery.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 9fea347

Please sign in to comment.