clean code

This commit is contained in:
daria 2025-06-10 11:12:54 +03:00
parent b52da4c664
commit 7f55741b1b
No known key found for this signature in database
GPG Key ID: 3B75240E6B2F2701
2 changed files with 13 additions and 16 deletions

View File

@ -88,15 +88,11 @@ define([
role: 'button'
});
Common.displayAvatar($(avatar), userData.avatar, userData.displayName || userData.name);
$(avatar).keydown(function (e) {
if (e.which === 13 || e.which === 32) {
$(avatar).click();
}
});
$(avatar).click(function (e) {
const handler = function (e) {
e.stopPropagation();
Common.openURL(Hash.hashToHref(userData.profile, 'profile'));
});
};
Util.onClickEnter($(avatar), handler, { space: true });
} else if (userData && userData.supportTeam) {
avatar = h('span.cp-avatar-image', h('img', { src:'/customize/CryptPad_logo.svg' }));
}
@ -128,7 +124,8 @@ define([
$(notif).find('.cp-notification-content p').html(data.content.getFormatText());
}, 60000);
}
$(notif).find('.cp-notification-content').attr('aria-label', data.content.getFormatText().replace(/<[^>]*>/g, '')); // removes html tags from the text
const label = $(notif).find('.cp-notification-content p').text();
$(notif).find('.cp-notification-content').attr('aria-label', label);
}
$(notif).mouseenter((e) => {

View File

@ -14,6 +14,7 @@ define([
'/common/common-interface.js',
'/common/common-ui-elements.js',
'/common/notifications.js',
'/common/common-util.js',
'css!/components/bootstrap/dist/css/bootstrap.min.css',
'css!/components/components-font-awesome/css/font-awesome.min.css',
@ -29,7 +30,8 @@ define([
Messages,
UI,
UIElements,
Notifications
Notifications,
Util,
)
{
var APP = {};
@ -160,19 +162,17 @@ define([
$('.cp-app-notification-archived[data-hash="' + data.hash + '"]').css('display', 'flex');
}
});
$(dismissAll).keydown(function (e) {
if (e.keyCode === 13 || e.keyCode === 32) {
$(dismissAll).click();
const handler = function (e) {
if (!notifsData) {
return;
}
});
$(dismissAll).click(function () {
notifsData.forEach(function (data) {
if (data.content.isDismissible) {
data.content.dismissHandler();
}
});
});
};
Util.onClickEnter($(dismissAll), handler, { space: true });
return $div;
};