CB ModUI Tweaks

Try to take over the world (w/o Pinky)!

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Advertisement:

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

Advertisement:

// ==UserScript==
// @name         CB ModUI Tweaks
// @namespace    http://tampermonkey.net/
// @version      2026-07-07
// @description  Try to take over the world (w/o Pinky)!
// @author       [email protected] (Joe Johnson)
// @match        *://*.chaturbate.com/*
// @match        *://chaturbate.com/*
// @icon         http://chaturbate.com/favicon.ico
// @grant        none
// ==/UserScript==

/* Instruction:
* You should only need to edit cb.env or cb.selectors (when the HTML changes).
* This script removes nav genders other than that specified in cb.env.GENDERS.
* Pressing the middle mouse button takes you to the top of the page.
* A button is added after 'filters' to select a random room.
*/

window.CB = (function(win, undefined) {
  'use strict';

  const cb = window.CB ?? {};

  cb.env = {
    ROOM_BORDER_STYLE: '1px dashed orange',
    RANDOM_BUTTON: 'Random Room!',
    GENDERS: ['Women']
  };

  cb.selectors = {
    base: {
      HeaderNav: 'nav.HeaderNavBar[aria-hidden="false"]',
      UserMenu: '.HeaderUserMenu'
    },
    main: {
      Filter: '.advanced-search-button-container',
      GenderNav: '.GenderNav > div',
      RoomList: '#roomlist_root ul',
    }
  };

  cb.removeGenders = (visibleGenders) => {
    let tabcount = 0;
    cb.genders.querySelectorAll('button').forEach(el => {
      const visible = cb.env.GENDERS.includes(el.innerText);
      el.style.display = visible ? 'inline-block' : 'none';
      if (visible) tabcount++;
    });
    if (tabcount < 2) {
      cb.filter.style.top = '-42px';
      cb.genders.style.display = 'none';
      cb.filter.parentNode.style.height = 0;
      cb.filter.parentNode.style.minHeight = 0;
    }
  };

  cb.selectRandomRoom = () => {
    const rooms = cb.roomlist.childNodes;
    const rn = Math.floor(Math.random() * rooms.length);
    rooms[rn].scrollIntoView();
    rooms.forEach((room, i) => {
      room.style.border = (rn === i) ? cb.env.ROOM_BORDER_STYLE : 'none';
    });
  };

  cb.setupRandomRoomUI = () => {
    const button = document.createElement('button');
    const li = document.createElement('li');
    button.innerText = cb.env.RANDOM_BUTTON;
    button.onclick = cb.selectRandomRoom;
    cb.filter.append(li.appendChild(button));
  };

  cb.setupGoToTop = () => {
    document.addEventListener('mouseup', (event) => {
      if (event.button === 1) {
        window.scrollTo(0,0);
      }
    });
  };

  cb.setup = () => {
    cb.nav = document.querySelector(cb.selectors.base.HeaderNav);
    cb.usermenu = document.querySelector(cb.selectors.base.UserMenu);
    cb.genders = document.querySelector(cb.selectors.main.GenderNav);
    cb.roomlist = document.querySelector(cb.selectors.main.RoomList);
    cb.filter = document.querySelector(cb.selectors.main.Filter);
    cb.setupRandomRoomUI();
    cb.removeGenders();
    cb.setupGoToTop();
  };

  return cb;

})(window);

window.CB.setup();