diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-09-20 18:17:08 +0200 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-09-20 18:25:20 +0200 |
commit | 2131e95c6157c5614e3412f5b2fa22395c4ea03d (patch) | |
tree | a1e73d9c3394c9f38eb0f7ee414a710deb8af979 | |
parent | ea10a1292a7674149581b4332fb0849cd84cf467 (diff) | |
download | nextcloud-server-2131e95c6157c5614e3412f5b2fa22395c4ea03d.tar.gz nextcloud-server-2131e95c6157c5614e3412f5b2fa22395c4ea03d.zip |
Extract setting the avatar for the unknown user to its own function
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
-rw-r--r-- | core/js/jquery.avatar.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/js/jquery.avatar.js b/core/js/jquery.avatar.js index c8ac70ac692..fae100fda21 100644 --- a/core/js/jquery.avatar.js +++ b/core/js/jquery.avatar.js @@ -48,6 +48,11 @@ (function ($) { $.fn.avatar = function(user, size, ie8fix, hidedefault, callback, displayname) { + var setAvatarForUnknownUser = function(target) { + target.imageplaceholder('?'); + target.css('background-color', '#b9b9b9'); + }; + if (typeof(user) !== 'undefined') { user = String(user); } @@ -72,8 +77,7 @@ if (typeof(this.data('user')) !== 'undefined') { user = this.data('user'); } else { - this.imageplaceholder('?'); - this.css('background-color', '#b9b9b9'); + setAvatarForUnknownUser(this); return; } } @@ -113,8 +117,7 @@ $div.imageplaceholder(user, result.data.displayname); } else { // User does not exist - $div.imageplaceholder('?'); - $div.css('background-color', '#b9b9b9'); + setAvatarForUnknownUser($div); } } else { $div.hide(); |