This commit is contained in:
2025-12-11 13:09:53 -05:00
parent 4914392f1f
commit c833462a9a
2 changed files with 9 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name cams // @name cams
// @namespace http://tampermonkey.net/ // @namespace http://tampermonkey.net/
// @version 1.2.1 // @version 1.2.2
// @description Set maxDockedCamsForUser, keep-alive, and multi-poke // @description Set maxDockedCamsForUser, keep-alive, and multi-poke
// @author You // @author You
// @match https://chat.fabswingers.com/* // @match https://chat.fabswingers.com/*
@@ -188,7 +188,7 @@
// Find a public room that the user has joined // Find a public room that the user has joined
function findPublicRoom() { function findPublicRoom() {
// Try multiple selectors for chat windows // Try multiple selectors for chat windows
const chatWindows = document.querySelectorAll('[id^="ChatWindow_"], [id^="chatwindow_"], .x-window'); const chatWindows = document.querySelectorAll('[id^="CHATWINDOW"], [id^="ChatWindow"], [id^="chatwindow"], .x-window');
for (const win of chatWindows) { for (const win of chatWindows) {
// Try multiple selectors for the title // Try multiple selectors for the title
@@ -200,12 +200,11 @@
for (const publicRoom of PUBLIC_ROOMS) { for (const publicRoom of PUBLIC_ROOMS) {
// Use startsWith to match "General Chat" in "General Chat (45)" // Use startsWith to match "General Chat" in "General Chat (45)"
if (title.startsWith(publicRoom)) { if (title.startsWith(publicRoom)) {
// Extract room ID from window ID // Extract room ID from window ID (format: CHATWINDOW08967111-b7ae-496c-...)
const idMatch = win.id.match(/(\d+)/); const roomId = win.id.replace(/^CHATWINDOW/i, '').replace(/^ChatWindow_?/i, '');
const roomId = idMatch ? idMatch[1] : win.id.replace(/[^\d]/g, '');
if (roomId) { if (roomId) {
console.log(`KeepAlive: Found public room "${title}" with ID ${roomId}`); console.log(`KeepAlive: Found public room "${title}" with ID ${roomId}`);
return { roomId, title }; return { roomId, title, windowId: win.id };
} }
} }
} }
@@ -261,7 +260,9 @@
// Find the chat input field for this room // Find the chat input field for this room
// Look for input field within the chat window // Look for input field within the chat window
const chatWindow = document.getElementById('ChatWindow_' + room.roomId) || const chatWindow = room.windowId ? document.getElementById(room.windowId) :
document.getElementById('CHATWINDOW' + room.roomId) ||
document.getElementById('ChatWindow_' + room.roomId) ||
document.querySelector(`[id*="${room.roomId}"].x-window`); document.querySelector(`[id*="${room.roomId}"].x-window`);
if (!chatWindow) { if (!chatWindow) {

View File

@@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name cams // @name cams
// @namespace http://tampermonkey.net/ // @namespace http://tampermonkey.net/
// @version 1.2.1 // @version 1.2.2
// @description Set maxDockedCamsForUser, keep-alive, and multi-poke // @description Set maxDockedCamsForUser, keep-alive, and multi-poke
// @author You // @author You
// @match https://chat.fabswingers.com/* // @match https://chat.fabswingers.com/*