Sha256: 26c570ed0e0da76a5abe42bc57e4e327ef1192eba7119c7607135833574fec84

Contents?: true

Size: 982 Bytes

Versions: 1

Compression:

Stored size: 982 Bytes

Contents

$(document).on 'change', 'input.looking_for', ->
  name =  $(this).attr('name')
  val  =  $(this).val()    
  if ( $(this).attr('looking_for_id')!= undefined )
    looking_for_id = '#' + $(this).attr('looking_for_id')
    href_old = $(looking_for_id).attr('href')
    if (val!='')
      href_new = href_old + '&' + name + '=' + encodeURI(val) + '&validate=true'
    else
      href_new = href_old + '&' + name + '=' + encodeURI(val) + '&clear=true'
    $(looking_for_id).attr('href',href_new)
    $(looking_for_id).click()
    $(looking_for_id).attr('href',href_old)

t = null
last_id = null
last_value = null

$(document).on 'keyup', 'input.looking_for_filter', (e) ->
  if (last_id == $(this).id && last_value == $(this).val())
    return;
  last_id = $(this).id
  last_value = $(this).val()  
  if ( e.keyCode == 13 )
    $('#looking_for_find').click()
  else
    if t!=null
      clearTimeout(t)
    t=setTimeout("$('#looking_for_find').click()",250)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
looking_for-0.2.0 app/assets/javascripts/looking_for/looking_for.js.coffee