use two characters for the default avatar

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

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

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

@ -82,7 +82,16 @@ define([
MT.displayAvatar = function (common, $container, href, name, _cb) {
var cb = Util.once(Util.mkAsync(_cb || 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);
$container.append($avatar);
if (cb) { cb(); }

Loading…
Cancel
Save