Enhanced Bing ChatAI

Improves Bing ChatAI user experience by preventing accidental scrolling and increasing input character limit

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

  1. // ==UserScript==
  2. // @name Enhanced Bing ChatAI
  3. // @namespace EnhancedBingChatAI
  4. // @description Improves Bing ChatAI user experience by preventing accidental scrolling and increasing input character limit
  5. // @version 1.0.0
  6. // @author CriDos
  7. // @match https://www.bing.com/*
  8. // @license MIT
  9. // ==/UserScript==
  10.  
  11. // Prevent scrolling when hovering over cib-serp-main element
  12. window.addEventListener('wheel', (event) => {
  13. if (event.target.className.includes('cib-serp-main')) {
  14. event.stopPropagation();
  15. }
  16. });
  17.  
  18. // Increase input character limit to 100,000
  19. (function () {
  20. 'use strict';
  21.  
  22. const increaseCharacterLimit = () => {
  23. const textareaElement = document.querySelector('#b_sydConvCont > cib-serp').shadowRoot.querySelector('#cib-action-bar-main').shadowRoot.querySelector('#searchboxform > label').querySelector('textarea');
  24. if (textareaElement) textareaElement.setAttribute('maxlength', '100000');
  25. };
  26.  
  27. const waitForElement = (selector, callback) => {
  28. const element = document.querySelector(selector);
  29.  
  30. if (element) {
  31. callback();
  32. } else {
  33. setTimeout(() => {
  34. waitForElement(selector, callback);
  35. }, 2000);
  36. }
  37. };
  38.  
  39. waitForElement('#b_sydConvCont > cib-serp', increaseCharacterLimit);
  40.  
  41. })();