Change favicon format to .ico. Small improvements to the script.
authorVlad Chernushevich <mailbox@happytodesign.com>
Fri, 28 Jun 2013 13:14:41 +0000 (15:14 +0200)
committerVlad Chernushevich <mailbox@happytodesign.com>
Fri, 28 Jun 2013 13:14:41 +0000 (15:14 +0200)
client/assets/img/favicon.ico [new file with mode: 0644]
client/assets/img/favicon.png [deleted file]
client/assets/src/index.html.tmpl
client/assets/src/views/favicon.js

diff --git a/client/assets/img/favicon.ico b/client/assets/img/favicon.ico
new file mode 100644 (file)
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 (file)
index 4cbbd8c..0000000
Binary files a/client/assets/img/favicon.png and /dev/null differ
index 87d2e2c0429803177e05a61df3875b66c78a8fbe..81856d36f41a06dca6a728a4bac67d4e76af28a1 100644 (file)
@@ -7,7 +7,7 @@
 \r
 <title> KiwiIRC </title>\r
 \r
-<link rel="shortcut icon" href="<%base_path%>/assets/img/favicon.png">\r
+<link rel="shortcut icon" href="<%base_path%>/assets/img/favicon.ico">\r
 \r
 <link rel="stylesheet" type="text/css" href="<%base_path%>/assets/css/style.css" />\r
 <link rel="stylesheet" type="text/css" href="<%base_path%>/assets/css/font-awesome.min.css" />\r
index f4d5720c789181d616df1a04c655a24ec0fcbb07..bbda5a0e7c7a23d324cb181b557b572adf3aba49 100644 (file)
@@ -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({
         $('<link rel="shortcut icon" href="' + url + '">').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) {