50:c47569b938dd
Anton Shestakov <av6@dwimlabs.net>, Sun, 27 Mar 2016 14:47:06 +0800
css: improve contact list borders (between contacts and on the right)

next change 78:32a3b275330a
previous change 43:95e2cabea44b

coffee/favicon.coffee

Permissions: -rw-r--r--

Other formats: Feeds:
class window.Tram.FavState extends Backbone.Model
defaults:
show: 'offline'
class window.Tram.FaviconApp extends Backbone.View
tagName: 'link'
attributes:
rel: 'icon'
type: 'image/x-icon'
pipColors: Tram.colors.show
initialize: ->
@canvas = document.createElement('canvas')
@canvas.height = 16
@canvas.width = 16
@listenTo(@model, 'change', @updateFavicon)
@updateFavicon()
@render()
updateFavicon: ->
color = @pipColors[@model.get('show')] ? @pipColors['default']
@renderFavicon(color)
renderFavicon: (color) ->
ctx = @canvas.getContext('2d')
ctx.clearRect(0, 0, @canvas.width, @canvas.height)
ctx.fillStyle = color
ctx.beginPath()
ctx.arc(7.5, 7.5, 5.5, 0, Math.PI * 2)
ctx.fill()
@el.href = @canvas.toDataURL()
render: ->
$('head').append(@el)
@