From e5c02a8320b2086e7536252c3c1177ad0f8a261b Mon Sep 17 00:00:00 2001 From: Chris Hunt <chrishunt@github.com> Date: Wed, 8 Jan 2014 15:14:07 -0800 Subject: [PATCH] Update favcount.js to v1.4.0 --- vendor/assets/javascripts/favcount.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/vendor/assets/javascripts/favcount.js b/vendor/assets/javascripts/favcount.js index 6cfe059e9..3528d5b25 100644 --- a/vendor/assets/javascripts/favcount.js +++ b/vendor/assets/javascripts/favcount.js @@ -1,5 +1,5 @@ /* - * favcount.js v1.1.0 + * favcount.js v1.4.0 * http://chrishunt.co/favcount * Dynamically updates the favicon with a number. * @@ -10,7 +10,9 @@ (function(){ function Favcount(icon) { this.icon = icon; + this.opacity = 0.4; this.canvas = document.createElement('canvas'); + this.font = "Helvetica, Arial, sans-serif"; } Favcount.prototype.set = function(count) { @@ -19,12 +21,12 @@ if (self.canvas.getContext) { img.onload = function() { - drawCanvas(self.canvas, img, normalize(count)); + drawCanvas(self.canvas, self.opacity, self.font, img, normalize(count)); }; img.src = this.icon; } - } + }; function normalize(count) { count = Math.round(count); @@ -40,7 +42,7 @@ } } - function drawCanvas(canvas, img, count) { + function drawCanvas(canvas, opacity, font, img, count) { var head = document.getElementsByTagName('head')[0], favicon = document.createElement('link'), multiplier, fontSize, context, xOffset, yOffset, border, shadow; @@ -57,10 +59,10 @@ canvas.height = canvas.width = img.width; context = canvas.getContext('2d'); - context.font = 'bold ' + fontSize + 'px "helvetica", sans-serif'; + context.font = 'bold ' + fontSize + 'px ' + font; // Draw faded favicon background - if (count) { context.globalAlpha = 0.4; } + if (count) { context.globalAlpha = opacity; } context.drawImage(img, 0, 0); context.globalAlpha = 1.0; @@ -94,5 +96,5 @@ }).call(this); (function(){ - Favcount.VERSION = '1.1.0'; + Favcount.VERSION = '1.4.0'; }).call(this);