@@ -64,10 +64,10 @@ const loadedEmotes = new Set();
6464
6565/* ✅ Explicit whitelist */
6666const SKINS = {
67- default : "skin-default.css?nocache=51 " ,
68- nutting : "skin-nutting.css?nocache=51 " ,
69- kimballs : "skin-kimballs.css?nocache=51 " ,
70- bubbles : "skin-bubbles.css?nocache=51 "
67+ default : "skin-default.css?nocache=52 " ,
68+ nutting : "skin-nutting.css?nocache=52 " ,
69+ kimballs : "skin-kimballs.css?nocache=52 " ,
70+ bubbles : "skin-bubbles.css?nocache=52 "
7171} ;
7272
7373const skinFile = SKINS [ chatrdSkin ] || SKINS . default ;
@@ -590,6 +590,7 @@ const chatcommandslist = document.getElementById('chat-autocomplete-list');
590590let chatcurrentFocus = - 1 ;
591591
592592const chatInputSend = document . getElementById ( "chat-input-send" ) ;
593+ const chatInputSendAll = document . getElementById ( "chat-input-send-all" ) ;
593594//const chatInputSettings = document.getElementById("chat-input-settings");
594595const chatInputForm = document . querySelector ( "#chat-input form" ) ;
595596const chatInput = chatInputForm . querySelector ( "input[type=text]" )
@@ -727,10 +728,10 @@ async function pushChatInputSettings() {
727728 const tiktokSwitch = chatInputPlatformButtons . querySelector ( '#tiktok' ) ;
728729 const kickSwitch = chatInputPlatformButtons . querySelector ( '#kick' ) ;
729730
730- if ( showTwitch == false ) { twitchSwitch . style . display = 'none' ; }
731- if ( showYoutube == false ) { youtubeSwitch . style . display = 'none' ; }
732- if ( showTiktok == false ) { tiktokSwitch . style . display = 'none' ; }
733- if ( showKick == false ) { kickSwitch . style . display = 'none' ; }
731+ if ( showTwitch == false ) { twitchSwitch . classList . add ( 'hidden' ) ; }
732+ if ( showYoutube == false ) { youtubeSwitch . classList . add ( 'hidden' ) ; }
733+ if ( showTiktok == false ) { tiktokSwitch . classList . add ( 'hidden' ) ; }
734+ if ( showKick == false ) { kickSwitch . classList . add ( 'hidden' ) ; }
734735
735736 pushChatInputButtonsToSettings ( ) ;
736737
@@ -796,6 +797,26 @@ chatInputSend.addEventListener("click", function () {
796797 chatInputForm . requestSubmit ( ) ;
797798} ) ;
798799
800+ chatInputSendAll . addEventListener ( "click" , function ( ) {
801+ const container = document . querySelector ( '#chat-input-platorms-buttons' ) ;
802+ const allButtons = Array . from ( container . querySelectorAll ( 'button:not(.hidden)' ) ) ;
803+
804+ const buttonsInactives = [ ] ;
805+
806+ allButtons . forEach ( btn => {
807+ if ( btn . classList . contains ( 'inactive' ) ) {
808+ buttonsInactives . push ( btn ) ;
809+ btn . click ( ) ;
810+ }
811+ } ) ;
812+
813+ chatInputSend . click ( ) ;
814+
815+ buttonsInactives . forEach ( btn => {
816+ btn . click ( ) ;
817+ } ) ;
818+ } ) ;
819+
799820/*chatInputSettings.addEventListener("click", function () {
800821 const chatSettingsToggles = document.querySelector("#chat-settings");
801822 const isOpen = chatSettingsToggles.classList.contains("active");
@@ -1297,14 +1318,9 @@ function adjustScreenMediaQuery() {
12971318}
12981319
12991320function applyLanguageToItems ( ) {
1300- const chatInputPlatforms = document . querySelector ( '#chat-input-platorms-buttons' ) ;
1301- if ( chatInputPlatforms ) {
1302- chatInputPlatforms . querySelector ( '#twitch' ) . setAttribute ( 'title' , tRD ( 'general.button_toggle_twitch' ) ) ;
1303- chatInputPlatforms . querySelector ( '#youtube' ) . setAttribute ( 'title' , tRD ( 'general.button_toggle_youtube' ) ) ;
1304- chatInputPlatforms . querySelector ( '#tiktok' ) . setAttribute ( 'title' , tRD ( 'general.button_toggle_tiktok' ) ) ;
1305- chatInputPlatforms . querySelector ( '#kick' ) . setAttribute ( 'title' , tRD ( 'general.button_toggle_kick' ) ) ;
1306- }
13071321 document . querySelector ( '#chat-input-text-field' ) . setAttribute ( 'placeholder' , tRD ( 'general.chat_input_placeholder' ) ) ;
1322+ document . querySelector ( '#chat-input-send' ) . setAttribute ( 'title' , tRD ( 'general.button_send_message' ) ) ;
1323+ document . querySelector ( '#chat-input-send-all' ) . setAttribute ( 'title' , tRD ( 'general.button_send_message_all' ) ) ;
13081324}
13091325
13101326async function pushChatInputButtonsToSettings ( ) {
@@ -1337,13 +1353,52 @@ async function pushChatInputButtonsToSettings() {
13371353/* ------ Yo RexBordz!😁 ------- */
13381354/* ----------------------------- */
13391355
1340- const keyboardShortCuts = [
1341- { shortcut : 'CTRL+ALT+1' , action : ( ) => document . querySelector ( '#chat-input-platorms-buttons button#twitch' ) . click ( ) } ,
1342- { shortcut : 'CTRL+ALT+2' , action : ( ) => document . querySelector ( '#chat-input-platorms-buttons button#youtube' ) . click ( ) } ,
1343- { shortcut : 'CTRL+ALT+3' , action : ( ) => document . querySelector ( '#chat-input-platorms-buttons button#kick' ) . click ( ) } ,
1344- { shortcut : 'CTRL+ALT+4' , action : ( ) => document . querySelector ( '#chat-input-platorms-buttons button#tiktok' ) . click ( ) } ,
1345- ] . map ( s => ( { ...s , ...parseShortcut ( s . shortcut ) } ) ) ;
1356+ let dynamicShortcuts = [ ] ;
1357+ let staticShortcuts = [ ] ;
13461358
1359+ function addStaticShortcut ( shortcutString , action ) {
1360+ staticShortcuts . push ( {
1361+ shortcut : shortcutString ,
1362+ action,
1363+ ...parseShortcut ( shortcutString )
1364+ } ) ;
1365+ }
1366+
1367+ function getAllShortcuts ( ) {
1368+ return [ ...staticShortcuts , ...dynamicShortcuts ] ;
1369+ }
1370+
1371+ function buildDynamicShortcuts ( ) {
1372+ const container = document . querySelector ( '#chat-input-platorms-buttons' ) ;
1373+
1374+ if ( ! container ) {
1375+ console . warn ( '[ChatRD] Platform Buttons Container not found.' ) ;
1376+ dynamicShortcuts = [ ] ;
1377+ return ;
1378+ }
1379+
1380+ const allButtons = Array . from ( container . querySelectorAll ( 'button' ) ) ;
1381+
1382+ // Limpa o dataset de todos antes de reatribuir (evita "sobra" em botões que ficaram hidden)
1383+ allButtons . forEach ( btn => delete btn . dataset . shortcut ) ;
1384+
1385+ const visibleButtons = allButtons . filter ( btn => ! btn . classList . contains ( 'hidden' ) ) ;
1386+
1387+ let counter = 0 ;
1388+
1389+ dynamicShortcuts = visibleButtons . map ( btn => {
1390+ counter ++ ;
1391+ const shortcutString = 'CTRL+ALT+' + counter ;
1392+
1393+ btn . dataset . shortcut = shortcutString ;
1394+
1395+ return {
1396+ shortcut : shortcutString ,
1397+ action : ( ) => btn . click ( ) ,
1398+ ...parseShortcut ( shortcutString )
1399+ } ;
1400+ } ) ;
1401+ }
13471402
13481403function parseShortcut ( shortcutString ) {
13491404 const validModifiers = [ 'CTRL' , 'ALT' , 'SHIFT' , 'META' , 'CMD' , 'WIN' ] ;
@@ -1352,7 +1407,7 @@ function parseShortcut(shortcutString) {
13521407 const mainKeyParts = parts . filter ( p => ! validModifiers . includes ( p ) ) ;
13531408
13541409 if ( mainKeyParts . length !== 1 ) {
1355- console . warn ( `[ChatRD] Shorcut not formatted correctly: "${ shortcutString } ".` ) ;
1410+ console . warn ( `[ChatRD] Shortcut not formatted correctly: "${ shortcutString } ".` ) ;
13561411 }
13571412
13581413 return {
@@ -1394,13 +1449,36 @@ function keyNameToCode(key) {
13941449 return specialKeys [ key ] || key ;
13951450}
13961451
1452+ function observeShortcutButtons ( ) {
1453+ const container = document . querySelector ( '#chat-input-platorms-buttons' ) ;
1454+ if ( ! container ) {
1455+ console . warn ( '[ChatRD] Platform Buttons Container not found to apply the MutationObserver.' ) ;
1456+ return ;
1457+ }
1458+
1459+ // Monta a lista inicial
1460+ buildDynamicShortcuts ( ) ;
1461+
1462+ const observer = new MutationObserver ( ( ) => {
1463+ buildDynamicShortcuts ( ) ;
1464+ } ) ;
1465+
1466+ observer . observe ( container , {
1467+ attributes : true ,
1468+ attributeFilter : [ 'class' ] ,
1469+ subtree : true
1470+ } ) ;
1471+ }
1472+
13971473function applyKeyboardShortcuts ( ) {
1474+ observeShortcutButtons ( ) ;
1475+
13981476 document . addEventListener ( 'keydown' , function ( event ) {
13991477 const isAltGr = event . getModifierState && event . getModifierState ( 'AltGraph' ) ;
14001478 const ctrlPressed = event . ctrlKey || isAltGr ;
14011479 const altPressed = event . altKey || isAltGr ;
14021480
1403- const shortcut = keyboardShortCuts . find ( s =>
1481+ const shortcut = getAllShortcuts ( ) . find ( s =>
14041482 s . ctrl === ctrlPressed &&
14051483 s . alt === altPressed &&
14061484 s . shift === event . shiftKey &&
@@ -1409,6 +1487,7 @@ function applyKeyboardShortcuts() {
14091487 ) ;
14101488
14111489 if ( shortcut ) {
1490+ event . preventDefault ( ) ;
14121491 shortcut . action ( ) ;
14131492 }
14141493 } ) ;
@@ -1425,7 +1504,6 @@ document.addEventListener("DOMContentLoaded", async function () {
14251504 await loadLang ( ) ;
14261505
14271506 chatcommands = tRD ( 'chatrd.commands' ) ;
1428- applyLanguageToItems ( ) ;
14291507
14301508 pushChatInputSettings ( ) ;
14311509 loadChatInputSettingFromLocalStorage ( ) ;
@@ -1446,10 +1524,22 @@ document.addEventListener("DOMContentLoaded", async function () {
14461524 chatGhostResize ( ) ;
14471525 adjustScreenMediaQuery ( ) ;
14481526
1449-
14501527 console . debug ( `[ChatRD] Applying keyboard shortcuts ...` ) ;
1451- applyKeyboardShortcuts ( ) ;
14521528
1529+ addStaticShortcut ( 'SHIFT+ENTER' , ( ) => {
1530+ if ( document . activeElement ?. matches ( '#chat-input-text-field' ) ) {
1531+ chatInputSendAll . click ( ) ;
1532+ }
1533+ } ) ;
14531534
1454- } ) ;
1535+ addStaticShortcut ( 'ENTER' , ( ) => {
1536+ if ( document . activeElement ?. matches ( '#chat-input-text-field' ) ) {
1537+ chatInputSend . click ( ) ;
1538+ }
1539+ } ) ;
1540+
1541+ applyKeyboardShortcuts ( ) ;
1542+
1543+ applyLanguageToItems ( ) ;
14551544
1545+ } ) ;
0 commit comments