Skip to content

Commit

Permalink
Merge pull request #127 from projecthydra/turbolinks
Browse files Browse the repository at this point in the history
Support turbolinks 5 and previous versions
  • Loading branch information
jcoyne committed Jul 12, 2016
2 parents 518d905 + 48f65b0 commit 0c75164
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/assets/javascripts/browse_everything/behavior.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,11 @@ auto_toggle = ->
triggers = $('*[data-toggle=browse-everything]')
triggers.each () -> $(this).browseEverything($(this).data())

if Turbolinks?
$(document).on 'page:change', auto_toggle
if Turbolinks? && Turbolinks.supported
# Use turbolinks:load for Turbolinks 5, otherwise use the old way
if (Turbolinks.BrowserAdapter)
$(document).on 'turbolinks:load', auto_toggle
else
$(document).on 'page:change', auto_toggle
else
$(document).ready auto_toggle

0 comments on commit 0c75164

Please sign in to comment.