1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-07-03 17:48:30 +00:00

Refactor chat line rendering to support lines with system messages, making it possible to customize the rendering of re-sub messages and eventually other types, like purchases. Fix the emote data structure being all screwed up in self-sent /me commands.

This commit is contained in:
SirStendec 2017-11-23 02:49:23 -05:00
parent 6c4966166a
commit 2e5fe7f177
7 changed files with 173 additions and 73 deletions

View file

@ -5,21 +5,15 @@
// ============================================================================
import {sanitize, createElement as e} from 'utilities/dom';
import {has} from 'utilities/object';
import {has, split_chars} from 'utilities/object';
const EMOTE_CLASS = 'chat-line__message--emote',
LINK_REGEX = /([^\w@#%\-+=:~])?((?:(https?:\/\/)?(?:[\w@#%\-+=:~]+\.)+[a-z]{2,6}(?:\/[\w.\/@#%&()\-+=:?~]*)?))([^\w.\/@#%&()\-+=:?~]|\s|$)/g,
MENTION_REGEX = /([^\w@#%\-+=:~])?(@([^\u0000-\u007F]+|\w+)+)([^\w.\/@#%&()\-+=:?~]|\s|$)/g,
SPLIT_REGEX = /[^\uD800-\uDFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDFFF]/g,
TWITCH_BASE = '//static-cdn.jtvnw.net/emoticons/v1/';
function split_chars(str) {
return str.match(SPLIT_REGEX);
}
// ============================================================================
// Links
// ============================================================================