mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-07-31 23:18:31 +00:00
4.0.0-rc19
* Added: Option to hide Squad Streaming banners on channel pages. * Changed: Rewrite the entire i18n system to use the standard ICU message format. * Changed: Render the context menu for chat messages in Chat on Videos. * Fixed: Badges not appearing correctly in chat. * Fixed: Messages in Chat on Videos with embeds appearing too wide.
This commit is contained in:
parent
8bc25b8d5f
commit
35316b8827
43 changed files with 1061 additions and 348 deletions
|
@ -1168,7 +1168,7 @@ export default class Chat extends Module {
|
|||
l = parts.length,
|
||||
emotes = {};
|
||||
|
||||
let idx = 0, ret, last_type = null;
|
||||
let idx = 0, ret, last_type = null, bits = 0;
|
||||
|
||||
for(let i=0; i < l; i++) {
|
||||
const part = parts[i],
|
||||
|
@ -1186,10 +1186,11 @@ export default class Chat extends Module {
|
|||
else if ( content.url )
|
||||
ret = content.url;
|
||||
|
||||
else if ( content.cheerAmount )
|
||||
else if ( content.cheerAmount ) {
|
||||
bits += content.cheerAmount;
|
||||
ret = `${content.alt}${content.cheerAmount}`;
|
||||
|
||||
else if ( content.images ) {
|
||||
} else if ( content.images ) {
|
||||
const url = (content.images.themed ? content.images.dark : content.images.sources),
|
||||
match = url && /\/emoticons\/v1\/(\d+)\/[\d.]+$/.exec(url['1x']),
|
||||
id = match && match[1];
|
||||
|
@ -1219,6 +1220,7 @@ export default class Chat extends Module {
|
|||
if ( ! emotes_only )
|
||||
msg.message = out.join('');
|
||||
|
||||
msg.bits = bits;
|
||||
msg.ffz_emotes = emotes;
|
||||
return msg;
|
||||
}
|
||||
|
@ -1228,8 +1230,15 @@ export default class Chat extends Module {
|
|||
if (!( time instanceof Date ))
|
||||
time = new Date(time);
|
||||
|
||||
const fmt = this.context.get('chat.timestamp-format');
|
||||
return dayjs(time).locale(this.i18n.locale).format(fmt);
|
||||
const fmt = this.context.get('chat.timestamp-format'),
|
||||
d = dayjs(time);
|
||||
|
||||
try {
|
||||
return d.locale(this.i18n.locale).format(fmt);
|
||||
} catch(err) {
|
||||
// If the locale isn't loaded, this can fail.
|
||||
return d.format(fmt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue