From: Vlad Chernushevich Date: Fri, 28 Jun 2013 13:14:41 +0000 (+0200) Subject: Change favicon format to .ico. Small improvements to the script. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=aa92fb91a4bdc78df23054365ade4dc2af435580;p=KiwiIRC.git Change favicon format to .ico. Small improvements to the script. --- diff --git a/client/assets/img/favicon.ico b/client/assets/img/favicon.ico new file mode 100644 index 0000000..a76262a Binary files /dev/null and b/client/assets/img/favicon.ico differ diff --git a/client/assets/img/favicon.png b/client/assets/img/favicon.png deleted file mode 100644 index 4cbbd8c..0000000 Binary files a/client/assets/img/favicon.png and /dev/null differ diff --git a/client/assets/src/index.html.tmpl b/client/assets/src/index.html.tmpl index 87d2e2c..81856d3 100644 --- a/client/assets/src/index.html.tmpl +++ b/client/assets/src/index.html.tmpl @@ -7,7 +7,7 @@ KiwiIRC - + diff --git a/client/assets/src/views/favicon.js b/client/assets/src/views/favicon.js index f4d5720..bbda5a0 100644 --- a/client/assets/src/views/favicon.js +++ b/client/assets/src/views/favicon.js @@ -34,16 +34,12 @@ _kiwi.view.Favicon = Backbone.View.extend({ _resetHighlights: function () { var that = this; this.highlight_count = 0; - if (this.has_canvas_support) { - this._drawFavicon(function(canvas) { - that._refreshFavicon(canvas.toDataURL()); - }); - } + this._refreshFavicon(this.original_favicon); }, _drawFavicon: function (callback) { var that = this, - context = this._createCanvas().getContext('2d'), + context = this._getCanvas().getContext('2d'), favicon_image = new Image(); // Allow cross origin resource requests @@ -52,6 +48,7 @@ _kiwi.view.Favicon = Backbone.View.extend({ favicon_image.src = this.original_favicon; favicon_image.onload = function() { + context.clearRect(0, 0, canvas.width, canvas.height); // Draw the favicon itself context.drawImage(favicon_image, 0, 0, favicon_image.width, favicon_image.height); callback(canvas); @@ -95,12 +92,14 @@ _kiwi.view.Favicon = Backbone.View.extend({ $('').appendTo($('head')); }, - _createCanvas: function () { - canvas = document.createElement('canvas'); - canvas.width = 16; - canvas.height = 16; - - return canvas; + _getCanvas: function () { + if (!this.canvas) { + canvas = document.createElement('canvas'); + canvas.width = 16; + canvas.height = 16; + this.canvas = canvas; + } + return this.canvas; }, _renderText: function (context, text, x, y, letter_spacing) {