Merge branch 'staging' into accessible-media

This commit is contained in:
ansuz 2021-09-01 17:02:56 +05:30
commit 22dd995a28
9 changed files with 29 additions and 25 deletions

View File

@ -69,7 +69,6 @@
background: @cp_sidebar-right-bg;
color: @cp_sidebar-right-fg;
overflow: auto;
//padding-bottom: 200px; // XXX what was the intent behind this?
// Following rules are only in settings
.cp-sidebarlayout-element {

View File

@ -532,7 +532,13 @@
&> button {
height: @toolbar_line-height;
width: @toolbar_line-height;
span { font-size: unset; }
span {
.avatar_vars(36px);
font-size: @avatar-font-size;
.animal {
font-size: @avatar-font-size-animal;
}
}
}
&> button.cp-avatar.cp-avatar {
media-tag {
@ -862,7 +868,6 @@
align-items: center;
.animal {
font-size: @avatar-font-size-animal;
}
}
&.cp-avatar {

View File

@ -34,6 +34,7 @@ try {
define([
'/common/requireconfig.js'
], function (RequireConfig) {
require.config(RequireConfig());
// most of CryptPad breaks if you don't support isArray
@ -91,4 +92,10 @@ define([
} catch (e) { console.error(e); failStore(); }
require([document.querySelector('script[data-bootload]').getAttribute('data-bootload')]);
if (typeof(Promise) !== 'function') {
setTimeout(function () {
var s = "Internet Explorer is not supported anymore, including by Microsoft.\n\nMost of CryptPad's collaborative functionality requires a modern browser to work.\n\nWe recommend Mozilla Firefox.";
window.alert(s);
});
}
});

View File

@ -18,7 +18,7 @@ define([
curvePublic: proxy.curvePublic,
notifications: Util.find(proxy, ['mailboxes', 'notifications', 'channel']),
avatar: proxy.profile && proxy.profile.avatar,
uid: proxy.uid, // XXX test without this and see if it breaks things
uid: proxy.uid,
};
if (hash === false) { delete data.channel; }
return data;

View File

@ -90,17 +90,12 @@ define([
// https://emojipedia.org/nature/
var ANIMALS = AppConfig.emojiAvatars || [];
var getRandomAnimal = function () { // XXX should never actually happen?
if (!ANIMALS.length) { return ''; }
return ANIMALS[Math.floor(Math.random() * ANIMALS.length)];
};
var getPseudorandomAnimal = MT.getPseudorandomAnimal = function (seed) {
if (!ANIMALS.length) { return ''; }
if (typeof(seed) !== 'string') { return getRandomAnimal(); }
seed = seed.replace(/\D/g, '').slice(0, 10); // XXX possible optimization for on-wire uid
if (typeof(seed) !== 'string') { return; }
seed = seed.replace(/\D/g, '').slice(0, 10); // TODO possible optimization for on-wire uid
seed = parseInt(seed);
if (!seed) { return getRandomAnimal(); }
if (!seed) { return; }
return ANIMALS[seed % ANIMALS.length] || '';
};
@ -141,7 +136,7 @@ define([
var $avatar = $('<span>', {
'class': 'cp-avatar-default' + (animal_avatar? ' animal': ''),
// XXX prevents screenreaders from trying to describe this
// this prevents screenreaders from trying to describe this
alt: '',
'aria-hidden': true,
}).text(text);
@ -196,7 +191,7 @@ define([
var $img = $(mt).appendTo($container);
MT.displayMediatagImage(common, $img, function (err, $image) {
if (err) { return void console.error(err); }
centerImage($img, $image); // XXX add alt="" (unless the media-tag has an alt attr)
centerImage($img, $image);
});
});
}

View File

@ -235,9 +235,6 @@ define([
};
};
funcs.getAuthorId = function () { // XXX
};
var authorUid = function(existing) {
if (!Array.isArray(existing)) { existing = []; }
var n;
@ -263,7 +260,7 @@ define([
});
return uid || authorUid(existing);
}
// XXX this should check for a matching curvePublic / uid if:
// TODO this should check for a matching curvePublic / uid if:
// 1. you are logged in OR
// 2. you have a token
// so that users that register recognize comments from before

View File

@ -164,6 +164,7 @@ MessengerUI, Messages, Pages) {
});
};
var showColors = false;
Messages.userlist_visitProfile = "Visit {0}'s profile"; // XXX "'s" is incorrect for names that end in "s" in English... don't care?
var updateUserList = function (toolbar, config, forceOffline) {
if (!config.displayed || config.displayed.indexOf('userlist') === -1) { return; }
if (toolbar.isAlone) { return; }
@ -249,6 +250,7 @@ MessengerUI, Messages, Pages) {
var friendRequests = Common.getFriendRequests(); // Friend requests received
editUsersNames.forEach(function (data) {
var name = data.name || Messages.anonymous;
var safeName = Util.fixHTML(name);
var $span = $('<span>', {'class': 'cp-avatar'});
if (data.color && showColors) {
$span.css('border-color', data.color);
@ -323,7 +325,7 @@ MessengerUI, Messages, Pages) {
$('<button>', {
'class': 'fa fa-bell cp-toolbar-userlist-button',
'data-cptippy-html': true,
'title': Messages._getKey('friendRequest_received', [Util.fixHTML(name)]),
'title': Messages._getKey('friendRequest_received', [safeName]),
}).appendTo($nameSpan).click(function (e) {
e.stopPropagation();
UIElements.displayFriendRequestModal(Common, friendRequests[data.curvePublic]);
@ -334,7 +336,7 @@ MessengerUI, Messages, Pages) {
'class': 'fa fa-user-plus cp-toolbar-userlist-button',
'data-cptippy-html': true,
'title': Messages._getKey('userlist_addAsFriendTitle', [
Util.fixHTML(name)
safeName,
])
}).appendTo($nameSpan).click(function (e) {
e.stopPropagation();
@ -356,9 +358,9 @@ MessengerUI, Messages, Pages) {
});
}
if (data.profile) {
// XXX title to visit their profile "Visit {0}'s profile"
// Messages.contacts_info3 "Double-click their icon to view their profile",
$span.addClass('cp-userlist-clickable');
$span.attr('title', Messages._getKey('userlist_visitProfile', [name]));
$span.click(function () {
Common.openURL(origin+'/profile/#' + data.profile);
});

View File

@ -162,10 +162,9 @@
&.cp-cursor.cp-tippy-html {
.avatar_vars(20px);
background-color: var(--red);
// XXX figure out how to inherit this from avatar.less
font-size: @avatar-font-size; //var(11px; // 20px / 1.8 as per avatar.less..
font-size: @avatar-font-size;
&.animal {
font-size: @avatar-font-size-animal; //14px; // 20px / 1.8 * (6/5)...
font-size: @avatar-font-size-animal;
}
}
}

View File

@ -42,7 +42,7 @@ define([
var cursors = {};
// XXX despite the name of this function this doesn't actually render as a tippy tooltip
// FIXME despite the name of this function this doesn't actually render as a tippy tooltip
// that means that emojis will use the system font that shows up in native tooltips
// so this might be of limited value/aesthetic appeal compared to other apps' cursors
var makeTippy = function (cursor) {