Skip to content

Commit

Permalink
Merge pull request muan#36 from chrishunt/search-once
Browse files Browse the repository at this point in the history
Only search once when search term changes
  • Loading branch information
muan committed Jun 8, 2014
2 parents 10569f2 + 14bbc37 commit 7232f91
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 3 additions & 4 deletions _assets/speedy.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ setRelatedDOMVisibility = (keyword) ->
$('.js-queue-all').toggle (!!keyword.length && foundSomething)
$('.no-result').toggle( !foundSomething )

$(document).on 'search keyup', '.speedy-filter', ->
search( $(this).val() )
$(document).on 'search keyup', '.speedy-filter', ->
location.hash = $(this).val()

$(document).on 'click', '.group', ->
Expand All @@ -35,9 +34,9 @@ $(document).on 'click', '.group', ->
$(document).on 'click', '.speedy-remover', ->
$('.speedy-filter').val('')
$('.result').show()
search (location.hash = '')
location.hash = ''

window.onhashchange = ->
search $('.speedy-filter').val(location.hash.substr(1)).val()
$('[href^="#"]').removeClass('active')
$("[href='#{location.hash}']").addClass('active')
$("[href='#{location.hash}']").addClass('active')
3 changes: 1 addition & 2 deletions javascripts/speedy.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7232f91

Please sign in to comment.