Skip to content
Snippets Groups Projects
Commit 70dccd28 authored by Morris Jobke's avatar Morris Jobke
Browse files

Merge pull request #4987 from owncloud/different_color_placeholder

Make it possible to have a different color than the username for placeholder
parents 2feb753b 5e7a7b3f
No related branches found
No related tags found
No related merge requests found
......@@ -36,10 +36,21 @@
*
* <div id="albumart" style="background-color: hsl(123, 90%, 65%); ... ">T</div>
*
* You may also call it like this, to have a different background, than the seed:
*
* $('#albumart').placeholder('The Album Title', 'Album Title');
*
* Resulting in:
*
* <div id="albumart" style="background-color: hsl(123, 90%, 65%); ... ">A</div>
*
*/
(function ($) {
$.fn.placeholder = function(seed) {
$.fn.placeholder = function(seed, text) {
// set optional argument "text" to value of "seed" if undefined
text = text || seed;
var hash = md5(seed),
maxRange = parseInt('ffffffffffffffffffffffffffffffff', 16),
hue = parseInt(hash, 16) / maxRange * 256,
......@@ -56,7 +67,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));
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment