Commit d77019f5 authored by Thomas Müller's avatar Thomas Müller
Browse files

Merge pull request #21247 from owncloud/placeholder_size

Add a default size to the avatar placeholders
parents 792b270f c64e827f
$(document).ready(function(){
if (OC.currentUser) {
}
// User settings
$.each($('td.avatar .avatardiv'), function(i, element) {
$(element).avatar($(element).parent().parent().data('uid'), 32);
});
});
......@@ -47,16 +47,20 @@
*/
(function ($) {
$.fn.imageplaceholder = function(seed, text) {
$.fn.imageplaceholder = function(seed, text, size) {
// 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,
height = this.height();
height = this.height() || size || 32;
this.css('background-color', 'hsl(' + hue + ', 90%, 65%)');
// Placeholders are square
this.height(height);
this.width(height);
// CSS rules
this.css('color', '#fff');
this.css('font-weight', 'normal');
......
......@@ -119,7 +119,6 @@ class OC_Template extends \OC\Template\Base {
// avatars
if (\OC::$server->getSystemConfig()->getValue('enable_avatars', true) === true) {
\OC_Util::addScript('avatar', null, true);
\OC_Util::addScript('jquery.avatar', null, true);
\OC_Util::addScript('placeholder', null, true);
}
......
......@@ -68,7 +68,7 @@ var UserList = {
if (user.isAvatarAvailable === true) {
$('div.avatardiv', $tr).avatar(user.name, 32, undefined, undefined, undefined, user.displayname);
} else {
$('div.avatardiv', $tr).imageplaceholder(user.displayname);
$('div.avatardiv', $tr).imageplaceholder(user.displayname, undefined, 32);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment