Sha256: ef32943cf5a4012c55e0fe76197858f297e7084e0584208f66ec3e9d0a87701d

Contents?: true

Size: 1.79 KB

Versions: 18

Compression:

Stored size: 1.79 KB

Contents

currentPath = ""

loadCircles = ->
  if $('.circle-diagram').length > 1
    window.circles = {}
    count = 0
    $('.circle-diagram').each ->
      window.circles[count] = new CircleDiagram( circle: $(@) )
      count = count + 1
  else if $('.circle-diagram').length > 0
    window.circleDiagram = new CircleDiagram( circle: $('.circle-diagram') )



navigate = ->
  path = window.location.hash.replace(/#/, "")
  if path != currentPath
    if path != ""
      $("#app_content").html( $(renderView( path )) )
    else
      $("#app_content").html( $(renderView( "app/start" )) )
  lnk = $(".app_lnk[data-target='#{path}']").closest("li")
  nav = lnk.closest(".nav_list")
  nul = lnk.closest("ul")
  nav.find("li.active").removeClass("active")
  nav.find("li.current").removeClass("current")
  if nav == nul
    lnk.addClass("current")
  else
    nul.closest("li").addClass("current")
  lnk.addClass("active")
  loadCircles()
  currentPath = path
    
  

$ ->

  $("body").on "click", ".lst_lnk", ->
    # nav = $(@).closest(".nav")
    nav = $(@).closest(".nav_list")
    nul = $(@).closest("ul")
    nav.find("li.active").removeClass("active")
    if nav == nul
      nav.find("li.current").removeClass("current")
    else
      nul.find("li.current").removeClass("current")
    $(@).closest("li").addClass("current")
    $(@).closest("li").addClass("active")
    return false if $(@).attr("href") == "#"
  
  
  $("body").on "click", ".app_lnk", ->
    path = $(@).attr("data-target")
    path = "" if path == undefined
    # $("#app_content").html( $(renderView( path )) )
    window.location.hash = path
    
  # $(window).on 'hashchange', ->
  #   console.log "hashchange", window.location.pathname
  #   navigate()
  
  $(window).on 'popstate', ->
    console.log "Popstate", window.location.pathname
    navigate()
    

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
magic_stylez-0.0.0.36 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.35 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.34 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.33 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.32 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.31 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.30 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.29 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.28 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.27 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.26 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.25 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.24 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.23 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.22 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.21 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.20 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.19 test/dummy/app/assets/javascripts/app.js.coffee