CB ModUI Tweaks

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

Advertisement:

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

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();