// ==UserScript== // @name KeepBingChat // @description 实现火狐浏览器访问New Bing的ChatGPT(谷歌浏览器对user script不友好,所以暂时只支持火狐浏览器) // @version 1.4 // @author xcanwin // @namespace https://github.com/xcanwin/KeepBingChat/ // @supportURL https://github.com/xcanwin/KeepBingChat/ // @updateURL https://raw.githubusercontent.com/xcanwin/KeepBingChat/main/KeepBingChat.user.js // @downloadURL https://raw.githubusercontent.com/xcanwin/KeepBingChat/main/KeepBingChat.user.js // @icon data:image/svg+xml;utf8, // @license GPL-2.0-only // @match https://www.bing.com/* // @match https://www.bing.com/chat // @match https://*.bing.com/search?*q=Bing+AI* // @run-at document-start // @noframes // ==/UserScript== (function() { 'use strict'; if (!location.href.match(/.*q=(bingchat|Bing\+AI).*/)) { return; } const setIfr = function(u = "") { const kbc = document.createElement('iframe'); kbc.id = 'xcanwin'; kbc.style = `position: fixed; top: 0; left: 0; width: 100%;height: 100%; border: none;`; document.documentElement.appendChild(kbc); const headers = { "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" }; fetch(u, {headers: headers}).then((response) => { response.text().then((data) => { try { kbc.srcdoc = data; } catch (e) { console.log(e); } }) }); }; const clearWin = function() { window.stop(); if (document.head) document.documentElement.removeChild(document.head); if (document.body) document.documentElement.removeChild(document.body); }; const initWin = function() { const nHead = document.createElement('head'); nHead.innerHTML = `