diff --git a/package-lock.json b/package-lock.json index 6a6d6b0a..15a543a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "frankerfacez", - "version": "4.28.6", + "version": "4.29.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/modules/chat/index.js b/src/modules/chat/index.js index 63d644ec..9b557493 100644 --- a/src/modules/chat/index.js +++ b/src/modules/chat/index.js @@ -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: { diff --git a/src/sites/twitch-twilight/modules/chat/input.jsx b/src/sites/twitch-twilight/modules/chat/input.jsx index 9fa95105..7c9af003 100644 --- a/src/sites/twitch-twilight/modules/chat/input.jsx +++ b/src/sites/twitch-twilight/modules/chat/input.jsx @@ -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(
); + 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();