class NavBar constructor: (@session) -> @session.onCard (card) => if card.jid == @session.bareJid() $('#current-user-avatar').attr 'src', @session.avatar card.jid draw: -> $(""" """).appendTo 'body' $('
').appendTo 'body' $('#current-user-presence').change (event) => selected = $ 'option:selected', event.currentTarget $('#current-user-presence-form .text').text selected.text() @session.sendPresence selected.val() == 'xa', selected.text() addButton: (label, icon) -> id = "nav-link-#{label.toLowerCase()}" node = $("""
  • #{label}
  • """).appendTo '#nav-links' this.button(id, icon) node.click (event) => this.select(event.currentTarget) select: (button) -> button = $(button) $('#nav-links li').removeClass('selected') $('#nav-links li a').removeClass('selected') button.addClass('selected') $('a', button).addClass('selected') dark = $('#nav-links svg path') dark.attr 'opacity', '0.6' dark.css 'opacity', '0.6' light = $('svg path', button) light.attr 'opacity', '1.0' light.css 'opacity', '1.0' button: (id, path) -> paper = Raphael(id) icon = paper.path(path).attr fill: '#fff' stroke: '#000' 'stroke-width': 0.3 opacity: 0.6 node = $('#' + id) node.hover( -> icon.animate(opacity: 1.0, 200), -> icon.animate(opacity: 0.6, 200) unless node.hasClass('selected')) node.get 0