Merge pull request #37 from adamnbowen/master

Trivial: removing some eol characters like spaces and semicolons
This commit is contained in:
Patrick Filler 2011-07-22 09:08:16 -07:00
commit d8cc2f97ef
2 changed files with 19 additions and 19 deletions

View file

@ -12,7 +12,7 @@ $ = jQuery
$.fn.extend({ $.fn.extend({
chosen: (data, options) -> chosen: (data, options) ->
$(this).each((input_field) -> $(this).each((input_field) ->
new Chosen(this, data, options) unless ($ this).hasClass "chzn-done" new Chosen(this, data, options) unless ($ this).hasClass "chzn-done"
) )
}) })
@ -58,7 +58,7 @@ class Chosen
if @is_multiple if @is_multiple
container_div.html '<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + @default_text + '" class="default" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>' container_div.html '<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + @default_text + '" class="default" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'
else else
container_div.html '<a href="javascript:void(0)" class="chzn-single"><span>' + @default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" /></div><ul class="chzn-results"></ul></div>'; container_div.html '<a href="javascript:void(0)" class="chzn-single"><span>' + @default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" /></div><ul class="chzn-results"></ul></div>'
@form_field_jq.hide().after container_div @form_field_jq.hide().after container_div
@container = ($ '#' + @container_id) @container = ($ '#' + @container_id)
@ -212,7 +212,7 @@ class Chosen
"" ""
result_add_option: (option) -> result_add_option: (option) ->
if not option.disabled if not option.disabled
option.dom_id = @form_field.id + "chzn_o_" + option.array_index option.dom_id = @form_field.id + "chzn_o_" + option.array_index
classes = if option.selected and @is_multiple then [] else ["active-result"] classes = if option.selected and @is_multiple then [] else ["active-result"]
@ -230,9 +230,9 @@ class Chosen
result_do_highlight: (el) -> result_do_highlight: (el) ->
if el.length if el.length
this.result_clear_highlight(); this.result_clear_highlight()
@result_highlight = el; @result_highlight = el
@result_highlight.addClass "highlighted" @result_highlight.addClass "highlighted"
maxHeight = parseInt @search_results.css("maxHeight"), 10 maxHeight = parseInt @search_results.css("maxHeight"), 10
@ -343,11 +343,11 @@ class Chosen
high = @result_highlight high = @result_highlight
high_id = high.attr "id" high_id = high.attr "id"
this.result_clear_highlight(); this.result_clear_highlight()
high.addClass "result-selected" high.addClass "result-selected"
if @is_multiple if @is_multiple
this.result_deactivate high this.result_deactivate high
else else
@result_single_selected = high @result_single_selected = high
@ -414,8 +414,8 @@ class Chosen
result_id = option.dom_id result_id = option.dom_id
if regex.test option.text if regex.test option.text
found = true; found = true
results += 1; results += 1
else if option.text.indexOf(" ") >= 0 or option.text.indexOf("[") == 0 else if option.text.indexOf(" ") >= 0 or option.text.indexOf("[") == 0
#TODO: replace this substitution of /\[\]/ with a list of characters to skip. #TODO: replace this substitution of /\[\]/ with a list of characters to skip.
parts = option.text.replace(/\[|\]/g, "").split(" ") parts = option.text.replace(/\[|\]/g, "").split(" ")
@ -484,7 +484,7 @@ class Chosen
keyup_arrow: -> keyup_arrow: ->
if not @results_showing and not @is_multiple if not @results_showing and not @is_multiple
this.results_show() this.results_show()
else if @result_highlight else if @result_highlight
prev_sibs = @result_highlight.prevAll("li.active-result") prev_sibs = @result_highlight.prevAll("li.active-result")
@ -630,4 +630,4 @@ SelectParser.select_to_array = (select) ->
parser.add_node( child ) for child in select.childNodes parser.add_node( child ) for child in select.childNodes
parser.parsed parser.parsed
root.SelectParser = SelectParser root.SelectParser = SelectParser

View file

@ -206,7 +206,7 @@ class Chosen
"" ""
result_add_option: (option) -> result_add_option: (option) ->
if not option.disabled if not option.disabled
option.dom_id = @form_field.id + "chzn_o_" + option.array_index option.dom_id = @form_field.id + "chzn_o_" + option.array_index
classes = if option.selected and @is_multiple then [] else ["active-result"] classes = if option.selected and @is_multiple then [] else ["active-result"]
@ -223,9 +223,9 @@ class Chosen
this.results_build() this.results_build()
result_do_highlight: (el) -> result_do_highlight: (el) ->
this.result_clear_highlight(); this.result_clear_highlight()
@result_highlight = el; @result_highlight = el
@result_highlight.addClassName "highlighted" @result_highlight.addClassName "highlighted"
maxHeight = parseInt @search_results.getStyle('maxHeight'), 10 maxHeight = parseInt @search_results.getStyle('maxHeight'), 10
@ -334,11 +334,11 @@ class Chosen
result_select: -> result_select: ->
if @result_highlight if @result_highlight
high = @result_highlight high = @result_highlight
this.result_clear_highlight(); this.result_clear_highlight()
high.addClassName("result-selected") high.addClassName("result-selected")
if @is_multiple if @is_multiple
this.result_deactivate high this.result_deactivate high
else else
@result_single_selected = high @result_single_selected = high
@ -405,8 +405,8 @@ class Chosen
result_id = option.dom_id result_id = option.dom_id
if regex.test option.text if regex.test option.text
found = true; found = true
results += 1; results += 1
else if option.text.indexOf(" ") >= 0 or option.text.indexOf("[") == 0 else if option.text.indexOf(" ") >= 0 or option.text.indexOf("[") == 0
#TODO: replace this substitution of /\[\]/ with a list of characters to skip. #TODO: replace this substitution of /\[\]/ with a list of characters to skip.
parts = option.text.replace(/\[|\]/g, "").split(" ") parts = option.text.replace(/\[|\]/g, "").split(" ")
@ -626,4 +626,4 @@ SelectParser.select_to_array = (select) ->
parser.add_node( child ) for child in select.childNodes parser.add_node( child ) for child in select.childNodes
parser.parsed parser.parsed
root.SelectParser = SelectParser root.SelectParser = SelectParser