room fix
This commit is contained in:
15
cams.user.js
15
cams.user.js
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user