Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 5.6 KiB |
@ -0,0 +1,24 @@
|
||||
class app.views.Menu extends app.View
|
||||
@el: '._menu'
|
||||
@activeClass: 'active'
|
||||
|
||||
@events:
|
||||
click: 'onClick'
|
||||
|
||||
init: ->
|
||||
$.on document.body, 'click', @onGlobalClick
|
||||
return
|
||||
|
||||
onClick: =>
|
||||
prev = @el.previousElementSibling
|
||||
$.remove @el
|
||||
$.requestAnimationFrame => $.after(prev, @el)
|
||||
return
|
||||
|
||||
onGlobalClick: (event) =>
|
||||
return if event.which isnt 1
|
||||
if event.target.hasAttribute?('data-toggle-menu')
|
||||
@toggleClass @constructor.activeClass
|
||||
else if @hasClass @constructor.activeClass
|
||||
@removeClass @constructor.activeClass
|
||||
return
|
@ -1,26 +0,0 @@
|
||||
class app.views.Nav extends app.View
|
||||
@el: '._nav'
|
||||
@activeClass: '_nav-current'
|
||||
|
||||
@routes:
|
||||
after: 'afterRoute'
|
||||
|
||||
select: (href) ->
|
||||
@deselect()
|
||||
if @current = @find "a[href='#{href}']"
|
||||
@current.classList.add @constructor.activeClass
|
||||
@current.setAttribute 'tabindex', '-1'
|
||||
return
|
||||
|
||||
deselect: ->
|
||||
if @current
|
||||
@current.classList.remove @constructor.activeClass
|
||||
@current.removeAttribute 'tabindex'
|
||||
@current = null
|
||||
return
|
||||
|
||||
afterRoute: (route, context) =>
|
||||
if route in ['page', 'offline']
|
||||
@select context.pathname
|
||||
else
|
||||
@deselect()
|
Before Width: | Height: | Size: 157 B |
Before Width: | Height: | Size: 267 B |
Before Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 343 B |
@ -1 +0,0 @@
|
||||
http://www.entypo.com/
|
Before Width: | Height: | Size: 97 B |
Before Width: | Height: | Size: 123 B |