Add directing room join buttons (v1.3.0)

Add 6 draggable purple buttons for quickly joining Directing Rooms 1-6,
stacked vertically to the right of the MaxDockedCams button.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Chatter
2026-03-10 14:50:24 -04:00
parent b26d0aecee
commit f64823fb74
2 changed files with 56 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
// ==UserScript==
// @name cams
// @namespace http://tampermonkey.net/
// @version 1.2.7
// @version 1.3.0
// @description Set maxDockedCamsForUser, keep-alive, and multi-poke
// @author You
// @match https://chat.fabswingers.com/*
@@ -18,6 +18,16 @@
const KEEPALIVE_BUTTON_ID = 'keepAliveButton_SINGLETON';
const MULTIPOKE_BUTTON_ID = 'multiPokeButton_SINGLETON';
const RESET_BUTTON_ID = 'resetPositionsButton_SINGLETON';
const ROOM_BUTTON_PREFIX = 'roomJoinButton_';
const CHAT_ROOMS = [
{ id: 'c4c53fde-7697-490b-9217-4522012d96ed', name: 'Directing Room' },
{ id: '68fbfee8-9f16-4add-b5ff-1937444b444d', name: 'Directing Room #2' },
{ id: '5ec55d32-d09b-4636-b624-4c2256710137', name: 'Directing Room #3' },
{ id: 'a57172a0-551c-4dc4-a392-f3393a1f0830', name: 'Directing Room #4' },
{ id: '8cb23926-283d-417d-8a6d-fa6221d0ca89', name: 'Directing Room #5' },
{ id: '33f1c6b5-7d04-40a4-89ae-7a8e4f06e3f4', name: 'Directing Room #6' }
];
const LOCK_KEY = 'maxDockedCams_scriptLock';
const KEEPALIVE_SETTINGS_KEY = 'keepAlive_settings';
const MULTIPOKE_SETTINGS_KEY = 'multiPoke_settings';
@@ -73,6 +83,15 @@
multiPokeBtn.style.top = DEFAULT_POSITIONS[MULTIPOKE_BUTTON_ID].top;
}
CHAT_ROOMS.forEach((room, index) => {
const roomBtn = document.getElementById(ROOM_BUTTON_PREFIX + index);
if (roomBtn) {
roomBtn.style.right = 'auto';
roomBtn.style.left = 'calc(50% + 230px)';
roomBtn.style.top = (10 + index * 36) + 'px';
}
});
console.log('Button positions reset to defaults');
}
@@ -879,6 +898,32 @@
document.body.appendChild(resetButton);
console.log('Reset button created');
// Room join buttons (stacked vertically to the right of MaxDockedCams)
document.querySelectorAll(`[id^="${ROOM_BUTTON_PREFIX}"]`).forEach(btn => btn.remove());
CHAT_ROOMS.forEach((room, index) => {
const roomBtnId = ROOM_BUTTON_PREFIX + index;
const roomButton = document.createElement('button');
roomButton.id = roomBtnId;
roomButton.textContent = room.name;
roomButton.type = 'button';
roomButton.title = `Join ${room.name}`;
roomButton.style.cssText = `position: fixed; top: ${10 + index * 36}px; left: calc(50% + 230px); z-index: 999999; padding: 6px 10px; background-color: #9C27B0; color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; font-size: 12px; box-shadow: 0 2px 5px rgba(0,0,0,0.3); white-space: nowrap;`;
roomButton.addEventListener('click', function(e) {
e.preventDefault();
e.stopPropagation();
if (typeof createRoomJoinWindow === 'function') {
createRoomJoinWindow(room.id, room.name);
} else {
console.log(`Room join: createRoomJoinWindow not available`);
}
});
document.body.appendChild(roomButton);
makeDraggable(roomButton);
console.log(`Room button created: ${room.name}`);
});
// Initialize multi-poke if enabled
setTimeout(function() {
if (multiPokeEnabled) {
@@ -916,6 +961,15 @@
multiPokeButtons[i].remove();
}
}
CHAT_ROOMS.forEach((room, index) => {
const roomBtns = document.querySelectorAll(`#${ROOM_BUTTON_PREFIX}${index}`);
if (roomBtns.length > 1) {
for (let i = 1; i < roomBtns.length; i++) {
roomBtns[i].remove();
}
}
});
}, 500);
}, 100);

View File

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