From ed2fa06a26ad1f43dcf750133cd658638a0e9481 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Wed, 28 Aug 2013 16:52:12 +0200 Subject: [PATCH] reviewers comments --- core/js/{visualize.js => placeholder.js} | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) rename core/js/{visualize.js => placeholder.js} (76%) diff --git a/core/js/visualize.js b/core/js/placeholder.js similarity index 76% rename from core/js/visualize.js rename to core/js/placeholder.js index d6891085ce2..6a1c653b587 100644 --- a/core/js/visualize.js +++ b/core/js/placeholder.js @@ -30,7 +30,7 @@ * * And call this from Javascript: * - * $('#albumart').visualize('The Album Title'); + * $('#albumart').placeholder('The Album Title'); * * Which will result in: * @@ -39,14 +39,22 @@ */ (function ($) { - $.fn.visualize = function(seed) { + $.fn.placeholder = function(seed) { var hash = md5(seed), maxRange = parseInt('ffffffffff', 16), red = parseInt(hash.substr(0,10), 16) / maxRange * 256, green = parseInt(hash.substr(10,10), 16) / maxRange * 256, - blue = parseInt(hash.substr(20,10), 16) / maxRange * 256; - rgb = [Math.floor(red), Math.floor(green), Math.floor(blue)]; + blue = parseInt(hash.substr(20,10), 16) / maxRange * 256, + rgb = [Math.floor(red), Math.floor(green), Math.floor(blue)]; this.css('background-color', 'rgb(' + rgb.join(',') + ')'); - this.html(seed[0].toUpperCase()); + + // CSS rules + this.css('color', 'rgb(255, 255, 255)'); + this.css('font-weight', 'bold'); + this.css('text-align', 'center'); + + if(seed !== null && seed.length) { + this.html(seed[0].toUpperCase()); + } }; -}(jQuery)); \ No newline at end of file +}(jQuery)); -- 2.39.5