CB ModUI Tweaks

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

Advertisement:

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

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