Fk chai limits

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greatest.deepsurf.us/scripts/571951/1787236/Fk%20chai%20limits.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Fk chai limits
// @namespace   Violentmonkey Scripts
// @match       *://*.chai-research.com/chat/*
// @icon        https://web.chai-research.com/favicon.ico
// @grant       none
// @version     1.2
// @author      SkipUsernameRE
// ==/UserScript==

(function() {
  'use strict';

  setInterval(() => {
    localStorage.setItem("conversation_turns", "0");
  }, 1000);

  const observer = new MutationObserver(() => {
    const divs = document.querySelectorAll(
      'div.self-start.mr-10.flex.flex-row.gap-4.my-2.sm\\:my-4.items-start.relative'
    );

    divs.forEach(div => {
      Array.from(div.querySelectorAll('button'))
        .filter(btn => btn.textContent.trim() === "Click to see the message...")
        .forEach(btn => btn.remove()); // <--- removes the "Click to see the message..." button/text from the message container

      div.querySelectorAll('div.blur-sm')
        .forEach(childDiv => childDiv.classList.remove('blur-sm')); // <--- removes the blur from the messsage container
    });

    const shareButton = document.querySelector('button[aria-label="CHAI WEB | Share Button"]'); // <--- removes share button (some find it distracting, remove the line below to disable)
    if (shareButton) shareButton.remove();

    const flexContainers = document.querySelectorAll('div.flex.flex-col.h-\\[90svh\\].lg\\:h-\\[100vh\\]');
    flexContainers.forEach(container => {
      const targetChild = container.querySelector('div.relative.px-4.md\\:py-2');
      if (targetChild) targetChild.remove();
    });

    const elems = document.querySelectorAll('[class*="bg-black/50"]');
    elems.forEach(el => el.remove()); // <--- removes the annoying "Chat with {x} on CHAI App" popup
  });

  observer.observe(document.body, { childList: true, subtree: true }); // <--- observes the DOM for added or removed elements
})();