From 988d2032c520ab04ad7f0a0bd57fb4a21bbdcf6b Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Wed, 9 Oct 2013 15:33:31 +0200 Subject: [PATCH] replace blank identicon with ghosts --- isso/js/app/isso.js | 3 +-- isso/js/app/lib/identicons.js | 10 +++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/isso/js/app/isso.js b/isso/js/app/isso.js index 6d44cb0..877c692 100644 --- a/isso/js/app/isso.js +++ b/isso/js/app/isso.js @@ -11,8 +11,7 @@ define(["behave", "app/text/html", "app/dom", "app/utils", "app/api", "app/marku var el = $.htmlify(Mark.up(templates["postbox"])); - // add a blank identicon to not waste CPU cycles - // XXX show a space invader instead :> + // add a default identicon to not waste CPU cycles $(".avatar > canvas", el).replace(lib.identicons.blank(48, 48)); // on text area focus, generate identicon from IP address diff --git a/isso/js/app/lib/identicons.js b/isso/js/app/lib/identicons.js index 118f04c..5ab0423 100644 --- a/isso/js/app/lib/identicons.js +++ b/isso/js/app/lib/identicons.js @@ -108,8 +108,16 @@ define(["q"], function(Q) { }; var generateBlank = function(height, width) { - var el = generateIdenticon(null, height, width); + + var blank = parseInt([ + 0, 1, 1, 1, 1, + 1, 0, 1, 1, 0, + 1, 1, 1, 1, 1, /* purple: */ 0, 1, 0 + ].join(""), 2).toString(16); + + var el = generateIdenticon(blank, height, width); el.className = "blank"; + return el; };