Greasy Fork

Greasy Fork is available in English.

Remove Char Limit for Bing Chat AI

This Tampermonkey script enhances your search experience on Bing Chat by removing the character limit from the search input. Enjoy unrestricted search queries and explore endless possibilities with ease, as the script displays an infinity symbol (∞) in place of the character counter.

< 脚本Remove Char Limit for Bing Chat AI的反馈

评价:一般 - 脚本能用,但还有一些问题

§
发表于:2023-06-19
编辑于:2023-06-19

The Bing Chat website has recently made an update that caused a minor issue with the script. To resolve it, you can make a simple adjustment to the removeCharLimit() function as follows:

const removeCharLimit = async () => {
    const serp = await waitForElement(
        document,
        "cib-serp[serp-slot='none']"
    );
    const serpShadowRoot = serp.shadowRoot;

    const actionBar = await waitForElement(
        serpShadowRoot,
        "cib-action-bar"
    );
    const actionBarShadowRoot = actionBar.shadowRoot;

    const cibTextInput = await waitForElement(
        actionBarShadowRoot,
        "cib-text-input"
    );
    const cibTextInputShadowRoot = cibTextInput.shadowRoot;

    const textarea = await waitForElement(
        cibTextInputShadowRoot,
        "textarea[maxlength]"
    );
    textarea.removeAttribute("maxlength");

    const letterCounter = await waitForElement(
        actionBarShadowRoot,
        ".letter-counter"
    );

    letterCounter.childNodes[letterCounter.childNodes.length - 1].textContent = "∞";
};
§
发表于:2023-06-21

Thanks. That works for me. Below is the whole code that you can just copy and replace, in case someone is still confused which part they should replace.

// ==UserScript==
// @name         Remove Char Limit for Bing Chat AI
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  This Tampermonkey script enhances your search experience on Bing Chat by removing the character limit from the search input. Enjoy unrestricted search queries and explore endless possibilities with ease, as the script displays an infinity symbol (∞) in place of the character counter.
// @author       RomainC-lab
// @match        *://www.bing.com/*
// @grant        none
// @icon         https://raw.githubusercontent.com/RomainC-lab/Tampermonkey-Scripts-Collection/master/remove-char-limit-bing-chat.user.png
// @run-at       document-end
// ==/UserScript==

(function () {
    "use strict";

    async function waitForElement(root, selector) {
        return new Promise((resolve, reject) => {
            if (root.querySelector(selector)) {
                resolve(root.querySelector(selector));
            } else {
                const observer = new MutationObserver((mutations) => {
                    mutations.forEach((mutation) => {
                        if (mutation.type === "childList") {
                            if (root.querySelector(selector)) {
                                resolve(root.querySelector(selector));
                                observer.disconnect();
                                clearTimeout(timeout);
                            }
                        }
                    });
                });
                observer.observe(root, { childList: true, subtree: true });
                const timeout = setTimeout(() => {
                    observer.disconnect();
                    reject(new Error("Timeout"));
                }, 10000);
            }
        });
    }

    const removeCharLimit = async () => {
        const serp = await waitForElement(
            document,
            "cib-serp[serp-slot='none']"
        );
        const serpShadowRoot = serp.shadowRoot;

        const actionBar = await waitForElement(
            serpShadowRoot,
            "cib-action-bar"
        );
        const actionBarShadowRoot = actionBar.shadowRoot;

        const cibTextInput = await waitForElement(
            actionBarShadowRoot,
            "cib-text-input"
        );
        const cibTextInputShadowRoot = cibTextInput.shadowRoot;

        const textarea = await waitForElement(
            cibTextInputShadowRoot,
            "textarea[maxlength]"
        );
        textarea.removeAttribute("maxlength");

        const letterCounter = await waitForElement(
            actionBarShadowRoot,
            ".letter-counter"
        );

        letterCounter.childNodes[letterCounter.childNodes.length - 1].textContent = "∞";
    };

    window.addEventListener("load", removeCharLimit);
    window.addEventListener("popstate", removeCharLimit);
})();

发表回复

登录以发表回复。