KeepBingChat

实现火狐浏览器访问New Bing的ChatGPT(谷歌浏览器对user script不友好,所以暂时只支持火狐浏览器)

  1. // ==UserScript==
  2. // @name KeepBingChat
  3. // @description 实现火狐浏览器访问New Bing的ChatGPT(谷歌浏览器对user script不友好,所以暂时只支持火狐浏览器)
  4. // @version 1.4
  5. // @author xcanwin
  6. // @namespace https://github.com/xcanwin/KeepBingChat/
  7. // @supportURL https://github.com/xcanwin/KeepBingChat/
  8. // @icon data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" stroke-width="2" fill="none" stroke="currentColor"><path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path></svg>
  9. // @license GPL-2.0-only
  10. // @match https://www.bing.com/*
  11. // @match https://www.bing.com/chat
  12. // @match https://*.bing.com/search?*q=Bing+AI*
  13. // @run-at document-start
  14. // @noframes
  15. // ==/UserScript==
  16.  
  17. (function() {
  18. 'use strict';
  19.  
  20. if (!location.href.match(/.*q=(bingchat|Bing\+AI).*/)) {
  21. return;
  22. }
  23.  
  24. const setIfr = function(u = "") {
  25. const kbc = document.createElement('iframe');
  26. kbc.id = 'xcanwin';
  27. kbc.style = `position: fixed; top: 0; left: 0; width: 100%;height: 100%; border: none;`;
  28. document.documentElement.appendChild(kbc);
  29. const headers = {
  30. "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1788.0"
  31. };
  32. fetch(u, {headers: headers}).then((response) => {
  33. response.text().then((data) => {
  34. try {
  35. kbc.srcdoc = data;
  36. } catch (e) {
  37. console.log(e);
  38. }
  39. })
  40. });
  41. };
  42.  
  43. const clearWin = function() {
  44. window.stop();
  45. if (document.head) document.documentElement.removeChild(document.head);
  46. if (document.body) document.documentElement.removeChild(document.body);
  47. };
  48.  
  49. const initWin = function() {
  50. const nHead = document.createElement('head');
  51. nHead.innerHTML = `<title>Bing Chat</title>`;
  52. document.documentElement.appendChild(nHead)
  53. const nBody = document.createElement('body');
  54. nBody.innerHTML = `<div>正在加载中.....<br>若长时间无反应, 说明当前网络缺乏魔法.</div>`;
  55. document.documentElement.appendChild(nBody)
  56. };
  57.  
  58. const u = `https://www.bing.com/se${GM_info.script.namespace.slice(37, 38)}rch?q=Bing+AI&sh${GM_info.script.namespace.slice(16, 17)}wconv=1&cc=us&s${GM_info.script.namespace.slice(28, 29)}tlang=zh-Hans`;
  59. clearWin();
  60. initWin();
  61. setIfr(u);
  62.  
  63. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址