1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-06-28 15:27:43 +00:00

added feature for Issue 1090

This commit is contained in:
Niklas Thy 2021-11-10 10:01:03 +01:00
parent 032c8821df
commit b4eebe6b87
3 changed files with 19 additions and 2 deletions

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "frankerfacez",
"version": "4.28.6",
"version": "4.29.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -184,6 +184,15 @@ export default class Chat extends Module {
}
});
this.settings.add('test', {
default: true,
ui: {
path: 'Chat > Appearance >> General',
title: 'Displays amount of written characters in your Chatinput',
component: 'setting-check-box'
}
});
this.settings.add('chat.name-format', {
default: 0,
ui: {

View file

@ -5,7 +5,7 @@
// ============================================================================
import Module from 'utilities/module';
import { findReactFragment } from 'utilities/dom';
import { findReactFragment, createElement } from 'utilities/dom';
import { TWITCH_POINTS_SETS, TWITCH_GLOBAL_SETS, TWITCH_PRIME_SETS, KNOWN_CODES, REPLACEMENTS, REPLACEMENT_BASE, KEYS } from 'utilities/constants';
import Twilight from 'site';
@ -324,10 +324,18 @@ export default class Input extends Module {
inst.tempInput = '';
inst.messageHistoryPos = -1;
let element = this.fine.getChildNode(inst);
let container = element && element.querySelector('div[class="Layout-sc-nxg1ff-0 chat-input__input-icons"]');
container.append(<div class="Layout-sc-nxg1ff-0 appendChildForWrittenChars"><p id="textForCharsWritten">( 0 / 500 )</p></div>);
let replacedDivP = element && element.querySelector('p[id="textForCharsWritten"]');
inst.onKeyDown = function(event) {
try {
const code = event.charCode || event.keyCode;
let charsWritten = '( ' + inst.chatInputRef.value.length.toString() + '/500 )';
replacedDivP.innerHTML = charsWritten;
if ( inst.onEmotePickerToggle && t.chat.context.get('chat.emote-menu.shortcut') && event.key === 'e' && event.ctrlKey && ! event.altKey && ! event.shiftKey ) {
inst.onEmotePickerToggle();
event.preventDefault();