use two characters for the default avatar

pull/1/head
ansuz 3 years ago
parent eafe27ffb4
commit 82101bcb9b

@ -4,7 +4,7 @@
@width: 30px @width: 30px
) { ) {
@avatar-width: @width; @avatar-width: @width;
@avatar-font-size: @width / 1.2; @avatar-font-size: @width / 1.8;
} }
.avatar_main(@width: 30px) { .avatar_main(@width: 30px) {
--LessLoader_require: LessLoader_currentFile(); --LessLoader_require: LessLoader_currentFile();

@ -855,7 +855,7 @@
span { span {
text-align: center; text-align: center;
width: 100%; width: 100%;
font-size: 48px; font-size: 40px;
display: inline-flex; display: inline-flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;

@ -82,7 +82,16 @@ define([
MT.displayAvatar = function (common, $container, href, name, _cb) { MT.displayAvatar = function (common, $container, href, name, _cb) {
var cb = Util.once(Util.mkAsync(_cb || function () {})); var cb = Util.once(Util.mkAsync(_cb || function () {}));
var displayDefault = function () { var displayDefault = function () {
var text = Util.getFirstCharacter(name || Messages.anonymous); name = (name || "").trim() || Messages.anonymous;
var parts = name.split(/\s+/);
var text;
if (parts.length > 1) {
text = parts.slice(0, 2).map(Util.getFirstCharacter).join('');
} else {
text = Util.getFirstCharacter(name);
text += Util.getFirstCharacter(name.replace(text, ''));
}
var $avatar = $('<span>', {'class': 'cp-avatar-default'}).text(text); var $avatar = $('<span>', {'class': 'cp-avatar-default'}).text(text);
$container.append($avatar); $container.append($avatar);
if (cb) { cb(); } if (cb) { cb(); }

Loading…
Cancel
Save