summaryrefslogtreecommitdiffstats
path: root/core/js/placeholder.js
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2015-12-17 07:56:02 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2015-12-17 16:30:23 +0100
commit6248bad0f7b23c16049045ea150a11948b0ebeb1 (patch)
tree71a72d456851e8b6eec69954c26816b5c4b482c4 /core/js/placeholder.js
parent3818a055b96a528263585b93f598fb479b5a1ec4 (diff)
downloadnextcloud-server-6248bad0f7b23c16049045ea150a11948b0ebeb1.tar.gz
nextcloud-server-6248bad0f7b23c16049045ea150a11948b0ebeb1.zip
Add a default size to the avatar placeholders
This removed the need to do an avatar request on the "empty" row in the user settings.
Diffstat (limited to 'core/js/placeholder.js')
-rw-r--r--core/js/placeholder.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/js/placeholder.js b/core/js/placeholder.js
index 74bb9b1881d..26eb3507d7b 100644
--- a/core/js/placeholder.js
+++ b/core/js/placeholder.js
@@ -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');