From 24eb41548eb6fc08849619b9725cbb61679f04f6 Mon Sep 17 00:00:00 2001 From: kondou Date: Wed, 25 Sep 2013 12:57:41 +0200 Subject: [PATCH] Make it possible to have a different color than the username for placeholder --- core/js/placeholder.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/core/js/placeholder.js b/core/js/placeholder.js index d63730547d7..3c7b11ef468 100644 --- a/core/js/placeholder.js +++ b/core/js/placeholder.js @@ -36,10 +36,22 @@ * *
T
* + * You may also call it like this, to have a different background, than the seed: + * + * $('#albumart').placeholder('The Album Title', 'Album Title'); + * + * Resulting in: + * + *
A
+ * */ (function ($) { - $.fn.placeholder = function(seed) { + $.fn.placeholder = function(seed, text) { + if (typeof(text) === "undefined") { + text = seed; + } + var hash = md5(seed), maxRange = parseInt('ffffffffffffffffffffffffffffffff', 16), hue = parseInt(hash, 16) / maxRange * 256, @@ -56,7 +68,7 @@ this.css('font-size', (height * 0.55) + 'px'); if(seed !== null && seed.length) { - this.html(seed[0].toUpperCase()); + this.html(text[0].toUpperCase()); } }; }(jQuery)); -- 2.39.5