       )
   )
 
-$ ->
+$(document).on 'turbolinks:load', ->
   if Cookies.get("openTag")
     $('a[data-toggle="tab"]').parent().removeClass('active')
     $("a[href='##{Cookies.get('openTag')}']").click()

      Cookies.set("openTag",items[1], { expires: 365 * 20 })
  )

$ ->
  $(".pagination").on 'ajax:send', (xhr) ->
    $('#container').infinitescroll('update', {currPage: 1})
    location.href = xhr.target.href

    div.append(ul)
    form.prepend(div)

$(document).on 'turbolinks:load', ->
  $container = $('#masonry')
  $container.imagesLoaded(
    ->
