Anton Shestakov <av6@dwimlabs.net>, Wed, 01 Jun 2016 21:26:22 +0800
index: expand, but also deduplicate existence checks for previous and contact
js/favicon.js
Permissions: -rw-r--r--
// Generated by CoffeeScript 1.10.0 var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; window.Tram.FaviconApp = (function(superClass) { extend(FaviconApp, superClass); return FaviconApp.__super__.constructor.apply(this, arguments); FaviconApp.prototype.tagName = 'link'; FaviconApp.prototype.attributes = { FaviconApp.prototype.pipColors = Tram.colors.show; FaviconApp.prototype.initialize = function() { this.canvas = document.createElement('canvas'); this.listenTo(this.model, 'change', this.updateFavicon); FaviconApp.prototype.updateFavicon = function() { color = (ref = this.pipColors[this.model.get('show')]) != null ? ref : this.pipColors['default']; return this.renderFavicon(color); FaviconApp.prototype.renderFavicon = function(color) { ctx = this.canvas.getContext('2d'); ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); ctx.arc(7.5, 7.5, 5.5, 0, Math.PI * 2); return this.el.href = this.canvas.toDataURL(); FaviconApp.prototype.render = function() { $('head').append(this.el); //# sourceMappingURL=favicon.js.map