Skip to content

Commit d0ed6e2

Browse files
committed
For Streamer.bot 1.0.5 Beta
1 parent b8116c5 commit d0ed6e2

10 files changed

Lines changed: 189 additions & 82 deletions

File tree

beta/chat.html

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/simple-notify.min.css">
1414
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/animate.min.css">
1515

16-
<link rel="stylesheet" href="css/chatrd.css?nocache=51">
16+
<link rel="stylesheet" href="css/chatrd.css?nocache=52">
1717
<link id="chatrd-skins" rel="stylesheet" href="css/skin-default.css">
1818
</head>
1919
<body>
@@ -60,6 +60,7 @@
6060
</button>
6161
</label>
6262
<label id="chat-input-send-button">
63+
<button id="chat-input-send-all"><i class="fa-solid fa-globe"></i></button>
6364
<button id="chat-input-send"><i class="fa-solid fa-paper-plane"></i></button>
6465
</label>
6566
</form>
@@ -170,46 +171,46 @@
170171
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/purify.min.js"></script>
171172
<script src="https://unpkg.com/@streamerbot/client/dist/streamerbot-client.js"></script>
172173

173-
<script src="js/i18n-chatrd.js?nocache=51"></script>
174+
<script src="js/i18n-chatrd.js?nocache=52"></script>
174175

175-
<script src="js/speakerbot.js?nocache=51"></script>
176-
<script src="js/sb.js?nocache=51"></script>
177-
<script src="js/queue.js?nocache=51"></script>
176+
<script src="js/speakerbot.js?nocache=52"></script>
177+
<script src="js/sb.js?nocache=52"></script>
178+
<script src="js/queue.js?nocache=52"></script>
178179

179-
<script src="js/chatrd.js?nocache=51"></script>
180+
<script src="js/chatrd.js?nocache=52"></script>
180181

181-
<script src="js/modules/twitch/addon-seventv-paint.js?nocache=51"></script>
182-
<script src="js/modules/twitch/addon-message-effects-canvas.js?nocache=51"></script>
182+
<script src="js/modules/twitch/addon-seventv-paint.js?nocache=52"></script>
183+
<script src="js/modules/twitch/addon-message-effects-canvas.js?nocache=52"></script>
183184

184-
<link href="js/modules/twitch/module.css?nocache=51" rel="stylesheet">
185-
<script src="js/modules/twitch/module.js?nocache=51"></script>
185+
<link href="js/modules/twitch/module.css?nocache=52" rel="stylesheet">
186+
<script src="js/modules/twitch/module.js?nocache=52"></script>
186187

187-
<link href="js/modules/youtube/module.css?nocache=51" rel="stylesheet">
188-
<script src="js/modules/youtube/module.js?nocache=51"></script>
188+
<link href="js/modules/youtube/module.css?nocache=52" rel="stylesheet">
189+
<script src="js/modules/youtube/module.js?nocache=52"></script>
189190

190-
<link href="js/modules/tiktok/module.css?nocache=51" rel="stylesheet">
191-
<script src="js/modules/tiktok/module.js?nocache=51"></script>
191+
<link href="js/modules/tiktok/module.css?nocache=52" rel="stylesheet">
192+
<script src="js/modules/tiktok/module.js?nocache=52"></script>
192193

193-
<link href="js/modules/kick/module.css?nocache=51" rel="stylesheet">
194-
<script src="js/modules/kick/module.js?nocache=51"></script>
194+
<link href="js/modules/kick/module.css?nocache=52" rel="stylesheet">
195+
<script src="js/modules/kick/module.js?nocache=52"></script>
195196

196-
<link href="js/modules/streamelements/module.css?nocache=51" rel="stylesheet">
197-
<script src="js/modules/streamelements/module.js?nocache=51"></script>
197+
<link href="js/modules/streamelements/module.css?nocache=52" rel="stylesheet">
198+
<script src="js/modules/streamelements/module.js?nocache=52"></script>
198199

199-
<link href="js/modules/streamlabs/module.css?nocache=51" rel="stylesheet">
200-
<script src="js/modules/streamlabs/module.js?nocache=51"></script>
200+
<link href="js/modules/streamlabs/module.css?nocache=52" rel="stylesheet">
201+
<script src="js/modules/streamlabs/module.js?nocache=52"></script>
201202

202-
<link href="js/modules/patreon/module.css?nocache=51" rel="stylesheet">
203-
<script src="js/modules/patreon/module.js?nocache=51"></script>
203+
<link href="js/modules/patreon/module.css?nocache=52" rel="stylesheet">
204+
<script src="js/modules/patreon/module.js?nocache=52"></script>
204205

205-
<link href="js/modules/tipeeestream/module.css?nocache=51" rel="stylesheet">
206-
<script src="js/modules/tipeeestream/module.js?nocache=51"></script>
206+
<link href="js/modules/tipeeestream/module.css?nocache=52" rel="stylesheet">
207+
<script src="js/modules/tipeeestream/module.js?nocache=52"></script>
207208

208-
<link href="js/modules/kofi/module.css?nocache=51" rel="stylesheet">
209-
<script src="js/modules/kofi/module.js?nocache=51"></script>
209+
<link href="js/modules/kofi/module.css?nocache=52" rel="stylesheet">
210+
<script src="js/modules/kofi/module.js?nocache=52"></script>
210211

211-
<link href="js/modules/fourthwall/module.css?nocache=51" rel="stylesheet">
212-
<script src="js/modules/fourthwall/module.js?nocache=51"></script>
212+
<link href="js/modules/fourthwall/module.css?nocache=52" rel="stylesheet">
213+
<script src="js/modules/fourthwall/module.js?nocache=52"></script>
213214

214215
<script src="js/testmode.js"></script>
215216

beta/css/chatrd.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ body {
245245
padding: 0 2px;
246246
}
247247

248+
#chat-input #chat-input-platorms-buttons button.hidden {
249+
display: none;
250+
}
251+
248252
#chat-input #chat-input-platorms-buttons button img {
249253
width: 18px;
250254
transition: var(--transition);

beta/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,8 +1097,8 @@ <h3 data-i18n="modal_actions.title">⚠️ Streamer.bot Actions Not Found ⚠️
10971097
<script src="js/libs/mchoice/multi-choice-field.js"></script>
10981098

10991099
<!-- i18n deve ser carregado ANTES do settings.js -->
1100-
<script src="js/i18n-settings.js?nocache=51"></script>
1101-
<script src="js/speakerbot.js?nocache=51"></script>
1102-
<script src="js/settings.js?nocache=51"></script>
1100+
<script src="js/i18n-settings.js?nocache=52"></script>
1101+
<script src="js/speakerbot.js?nocache=52"></script>
1102+
<script src="js/settings.js?nocache=52"></script>
11031103
</body>
11041104
</html>

beta/js/chatrd.js

Lines changed: 117 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ const loadedEmotes = new Set();
6464

6565
/* ✅ Explicit whitelist */
6666
const 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

7373
const skinFile = SKINS[chatrdSkin] || SKINS.default;
@@ -590,6 +590,7 @@ const chatcommandslist = document.getElementById('chat-autocomplete-list');
590590
let chatcurrentFocus = -1;
591591

592592
const chatInputSend = document.getElementById("chat-input-send");
593+
const chatInputSendAll = document.getElementById("chat-input-send-all");
593594
//const chatInputSettings = document.getElementById("chat-input-settings");
594595
const chatInputForm = document.querySelector("#chat-input form");
595596
const 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

12991320
function 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

13101326
async 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

13481403
function 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+
13971473
function 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+
});

beta/locale/de.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,12 @@
218218
},
219219

220220
"general": {
221-
"button_toggle_twitch": "Twitch umschalten\n(CTRL+ALT+1)",
222-
"button_toggle_youtube": "YouTube umschalten\n(CTRL+ALT+2)",
223-
"button_toggle_kick": "Kick umschalten\n(CTRL+ALT+3)",
224-
"button_toggle_tiktok": "TikTok umschalten\n(CTRL+ALT+4)",
221+
"button_toggle_twitch": "Twitch umschalten\n({shortcut})",
222+
"button_toggle_youtube": "YouTube umschalten\n({shortcut})",
223+
"button_toggle_kick": "Kick umschalten\n({shortcut})",
224+
"button_toggle_tiktok": "TikTok umschalten\n({shortcut})",
225+
"button_send_message": "An Ausgewählte senden",
226+
"button_send_message_all": "An Alle senden",
225227
"chat_input_placeholder" : "Nachricht eingeben..."
226228
}
227229
}

beta/locale/en.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,12 @@
218218
},
219219

220220
"general": {
221-
"button_toggle_twitch": "Toggle Twitch\n(CTRL+ALT+1)",
222-
"button_toggle_youtube": "Toggle YouTube\n(CTRL+ALT+2)",
223-
"button_toggle_kick": "Toggle Kick\n(CTRL+ALT+3)",
224-
"button_toggle_tiktok": "Toggle TikTok\n(CTRL+ALT+4)",
221+
"button_toggle_twitch": "Toggle Twitch\n({shortcut})",
222+
"button_toggle_youtube": "Toggle YouTube\n({shortcut})",
223+
"button_toggle_kick": "Toggle Kick\n({shortcut})",
224+
"button_toggle_tiktok": "Toggle TikTok\n({shortcut})",
225+
"button_send_message": "Send to Selected",
226+
"button_send_message_all": "Send to All",
225227
"chat_input_placeholder" : "Type a message..."
226228
}
227229
}

beta/locale/es-ES.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,12 @@
218218
},
219219

220220
"general": {
221-
"button_toggle_twitch": "Alternar Twitch\n(CTRL+ALT+1)",
222-
"button_toggle_youtube": "Alternar YouTube\n(CTRL+ALT+2)",
223-
"button_toggle_kick": "Alternar Kick\n(CTRL+ALT+3)",
224-
"button_toggle_tiktok": "Alternar TikTok\n(CTRL+ALT+4)",
221+
"button_toggle_twitch": "Alternar Twitch\n({shortcut})",
222+
"button_toggle_youtube": "Alternar YouTube\n({shortcut})",
223+
"button_toggle_kick": "Alternar Kick\n({shortcut})",
224+
"button_toggle_tiktok": "Alternar TikTok\n({shortcut})",
225+
"button_send_message": "Enviar a seleccionados",
226+
"button_send_message_all": "Enviar a todos",
225227
"chat_input_placeholder" : "Escribe un mensaje..."
226228
}
227229
}

0 commit comments

Comments
 (0)