Hide c.ai

Hide censorship warning, ads, call button from c.ai

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Hide c.ai
// @version      1.7.1
// @match        *://character.ai/*
// @grant        none
// @license WTFPL
// @description Hide censorship warning, ads, call button from c.ai
// @namespace hidecai
// ==/UserScript==

(function() {
  'use strict';

  const MULTI_SELECTORS = [
    // censorship warning
    '.border-error',
    // ads title
    '.mx-4.mb-1.justify-between.flex',
    // ads body
    '.text-\\[\\#F3F3F3\\].w-full.justify-center.flex',
  ];

  const SINGLE_SELECTORS = [
    // call
    '.bg-background.rounded-md.inline-flex:not(.ml-2)',
    // sidebar
    '.no-underline.tap-highlight-transparent:nth-of-type(2)',
    '.no-underline.tap-highlight-transparent:nth-of-type(3)',
    '.no-underline.tap-highlight-transparent:nth-of-type(4)',
    // bottom warning
    '.-mt-2.justify-center.items-center.flex.relative',
    // background warning
    '.bg-warning\\/20.max-w-\\[340px\\].flex',
    // ads banner
    '.bg-\\[var\\(--G50\\)\\].items-center.justify-center.flex.w-full',
  ];

  function hideElements() {
    MULTI_SELECTORS.forEach(sel =>
      document.querySelectorAll(sel).forEach(el => el.style.display = 'none')
    );
    SINGLE_SELECTORS.forEach(sel => {
      const el = document.querySelector(sel);
      if (el) el.style.display = 'none';
    });
  }

  window.addEventListener('load', hideElements);
  new MutationObserver(mutations => {
    if (mutations.some(m => m.type === 'childList')) hideElements();
  }).observe(document.body, { childList: true, subtree: true });
})();