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==
// @name cams
// @namespace http://tampermonkey.net/
// @version 1.2.1
// @version 1.2.2
// @description Set maxDockedCamsForUser, keep-alive, and multi-poke
// @author You
// @match https://chat.fabswingers.com/*
@@ -188,7 +188,7 @@
// Find a public room that the user has joined
function findPublicRoom() {
// 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) {
// Try multiple selectors for the title
@@ -200,12 +200,11 @@
for (const publicRoom of PUBLIC_ROOMS) {
// Use startsWith to match "General Chat" in "General Chat (45)"
if (title.startsWith(publicRoom)) {
// Extract room ID from window ID
const idMatch = win.id.match(/(\d+)/);
const roomId = idMatch ? idMatch[1] : win.id.replace(/[^\d]/g, '');
// Extract room ID from window ID (format: CHATWINDOW08967111-b7ae-496c-...)
const roomId = win.id.replace(/^CHATWINDOW/i, '').replace(/^ChatWindow_?/i, '');
if (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
// 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`);
if (!chatWindow) {

View File

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