293:6635f14613ba
Anton Shestakov <av6@dwimlabs.net>, Wed, 01 Nov 2017 00:50:57 +0800
Makefile: use file targets more, results in incremental building Less work to do when only some files get changed, but more work when building from scratch. But, multiple compilers can run in parallel.

previous change 291:923afdc60aaf

js/favicon.js

Permissions: -rw-r--r--

Other formats: Feeds:
// Generated by CoffeeScript 1.12.7
(function() {
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);
function FaviconApp() {
return FaviconApp.__super__.constructor.apply(this, arguments);
}
FaviconApp.prototype.tagName = 'link';
FaviconApp.prototype.attributes = {
rel: 'icon',
type: 'image/x-icon'
};
FaviconApp.prototype.pipColors = Tram.colors.show;
FaviconApp.prototype.initialize = function() {
this.canvas = document.createElement('canvas');
this.canvas.height = 16;
this.canvas.width = 16;
this.listenTo(this.model, 'change', this.updateFavicon);
this.updateFavicon();
return this.render();
};
FaviconApp.prototype.updateFavicon = function() {
var color, ref;
color = (ref = this.pipColors[this.model.get('show')]) != null ? ref : this.pipColors['default'];
return this.renderFavicon(color);
};
FaviconApp.prototype.renderFavicon = function(color) {
var ctx;
ctx = this.canvas.getContext('2d');
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
ctx.fillStyle = color;
ctx.beginPath();
ctx.arc(8, 8, 5.5, 0, Math.PI * 2);
ctx.fill();
return this.el.href = this.canvas.toDataURL();
};
FaviconApp.prototype.render = function() {
$('head').append(this.el);
return this;
};
return FaviconApp;
})(Backbone.View);
}).call(this);
//# sourceMappingURL=favicon.js.map