Sha256: 899c43f4768043907a6edc3795199012a251980d36d88070096d05dd7cdbb07a

Contents?: true

Size: 1.99 KB

Versions: 15

Compression:

Stored size: 1.99 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", ".hide_da_notice", ->
    $("body").toggleClass("with_important_notice")
    false

  $("body").on "click", ".get_some_borders", ->
    $("#nav-aside").toggleClass("bordered")
    false

  $("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

15 entries across 15 versions & 1 rubygems

Version Path
magic_stylez-0.0.0.54 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.53 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.52 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.51 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.50 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.49 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.48 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.45 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.44 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.43 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.42 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.41 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.40 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.39 test/dummy/app/assets/javascripts/app.js.coffee
magic_stylez-0.0.0.38 test/dummy/app/assets/javascripts/app.js.coffee