301:2d95d63792f0
Anton Shestakov <av6@dwimlabs.net>, Wed, 27 Jun 2018 22:58:20 +0800
Makefile: get 3rd-party client dependencies using just wget and tar

previous change 233:7d12b9fc2f41

coffee/favicon.coffee

Permissions: -rw-r--r--

Other formats: Feeds:
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(8, 8, 5.5, 0, Math.PI * 2)
ctx.fill()
@el.href = @canvas.toDataURL()
render: ->
$('head').append(@el)
@