Commit badb092a authored by Robert Speicher's avatar Robert Speicher

Don't initialize Tree History unless tree-slider is present

This was breaking breadcrumb links on non-Tree pages
parent 57e6777b
...@@ -17,23 +17,21 @@ $ -> ...@@ -17,23 +17,21 @@ $ ->
"ajax:beforeSend": -> $('.tree_progress').addClass("loading") "ajax:beforeSend": -> $('.tree_progress').addClass("loading")
"ajax:complete": -> $('.tree_progress').removeClass("loading") "ajax:complete": -> $('.tree_progress').removeClass("loading")
# Maintain forward/back history while browsing the file tree # Maintain forward/back history while browsing the file tree
((window) ->
((window) -> History = window.History
History = window.History $ = window.jQuery
$ = window.jQuery document = window.document
document = window.document
# Check to see if History.js is enabled for our Browser
# Check to see if History.js is enabled for our Browser unless History.enabled
unless History.enabled return false
return false
$('#tree-slider .tree-item-file-name a, .breadcrumb li > a').live 'click', (e) ->
$ -> History.pushState(null, null, $(@).attr('href'))
$('#tree-slider .tree-item-file-name a, .breadcrumb li > a').live 'click', (e) -> return false
History.pushState(null, null, $(@).attr('href'))
return false History.Adapter.bind window, 'statechange', ->
state = History.getState()
History.Adapter.bind window, 'statechange', -> window.ajaxGet(state.url)
state = History.getState() )(window)
window.ajaxGet(state.url)
)(window)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment