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.

当前为 2023-04-06 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Remove Char Limit for Bing Chat AI
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @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.
  6. // @author RomainC-lab
  7. // @match *://www.bing.com/*
  8. // @grant none
  9. // @icon https://raw.githubusercontent.com/RomainC-lab/Tampermonkey-Scripts-Collection/master/remove-char-limit-bing-chat.user.png
  10.  
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. "use strict";
  15.  
  16. async function waitForElement(root, selector) {
  17. return new Promise((resolve, reject) => {
  18. if (root.querySelector(selector)) {
  19. resolve(root.querySelector(selector));
  20. } else {
  21. const observer = new MutationObserver((mutations) => {
  22. mutations.forEach((mutation) => {
  23. if (mutation.type === "childList") {
  24. if (root.querySelector(selector)) {
  25. resolve(root.querySelector(selector));
  26. observer.disconnect();
  27. clearTimeout(timeout);
  28. }
  29. }
  30. });
  31. });
  32. observer.observe(root, { childList: true, subtree: true });
  33. const timeout = setTimeout(() => {
  34. observer.disconnect();
  35. reject(new Error("Timeout"));
  36. }, 10000);
  37. }
  38. });
  39. }
  40.  
  41. async function removeCharLimit() {
  42. const serp = await waitForElement(
  43. document,
  44. "cib-serp[serp-slot='none']"
  45. );
  46. const serpShadowRoot = serp.shadowRoot;
  47. const actionBar = await waitForElement(
  48. serpShadowRoot,
  49. "cib-action-bar"
  50. );
  51. const actionBarShadowRoot = actionBar.shadowRoot;
  52. const textarea = await waitForElement(
  53. actionBarShadowRoot,
  54. "textarea[maxlength]"
  55. );
  56. textarea.removeAttribute("maxlength");
  57. const letterCounter = await waitForElement(
  58. actionBarShadowRoot,
  59. ".letter-counter"
  60. );
  61. letterCounter.childNodes[
  62. letterCounter.childNodes.length - 1
  63. ].textContent = "∞";
  64. }
  65.  
  66. window.addEventListener("load", removeCharLimit);
  67. window.addEventListener("popstate", removeCharLimit);
  68. })();