322:7dfdf32e8577
Anton Shestakov <av6@dwimlabs.net>, Sat, 14 Jul 2018 20:23:13 +0800
index: authorizing contact also adds it to the roster Maybe there are cases when this doesn't make sense, but so far this looks like the right thing to do.

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