openAI已就绪,请输入你的问题
// ==UserScript== // @name chatGPT tools Plus(修改版) // @namespace http://tampermonkey.net/ // @version 1.2.7 // @description Google、必应、百度、Yandex、360搜索、谷歌镜像、Fsou侧边栏Chat搜索,即刻体验AI,无需翻墙,无需注册,无需等待! // @author 夜雨 // @match https://cn.bing.com/* // @match https://www.bing.com/* // @match https://chat.openai.com/chat // @match https://www.google.com/* // @match https://www.so.com/s* // @match http*://www.baidu.com/s* // @match https://www.baidu.com* // @match https://m.baidu.com/* // @match http*://yandex.ru/search* // @match http*://yandex.com/search* // @match https://search.ecnu.cf/search* // @match https://search.aust.cf/search* // @match https://search.*.cf/search* // @match https://fsoufsou.com/search* // @match https://www.google.com.hk/* // @include /^https:\/\/www\.baidu\.com\/s\?wd.*$/ // @icon https://www.google.com/s2/favicons?sz=64&domain=openai.com // @grant GM_xmlhttpRequest // @grant GM_addStyle // @grant GM_openInTab // @grant GM_registerMenuCommand // @grant GM_setValue // @grant GM_getValue // @run-at document-end // @require https://cdn.staticfile.org/jquery/3.4.0/jquery.min.js // @require https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js // @require https://cdn.jsdelivr.net/npm/marked@4.2.3/marked.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/markdown-it/13.0.1/markdown-it.min.js // @require https://unpkg.com/axios/dist/axios.min.js // @connect api.forchange.cn // @connect wenxin110.top // @connect chatforai.net // @connect chatforai.cc // @connect api.aigcfun.com // @license MIT // @require https://cdn.jsdelivr.net/npm/showdown@2.1.0/dist/showdown.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js // @downloadURL none // ==/UserScript== (function() { 'use strict'; // grant GM_getResourceText // resource markdownCss https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.1.0/github-markdown.css // resource highlightCss https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/default.min.css // GM_addStyle(GM_getResourceText("markdownCss")); // GM_addStyle(GM_getResourceText("highlightCss")); //(prefers-color-scheme: light) $("head").append($( '' )); $("head").append($( '' )); const menu_updateChat_id = GM_registerMenuCommand("更新Chat", function(event) { GM_openInTab("https://greasyfork.org/zh-CN/scripts/459997") }, "updateChat"); const menu_groupNum_id = GM_registerMenuCommand("交流群", function(event) { alert("交流群:710808464") }, "groupNum"); const menu_pubkey_id = GM_registerMenuCommand("更新公钥", function(event) { alert("正在更新...") setPubkey(); }, "PUBKEY"); //动态pubkey function setPubkey() { GM_xmlhttpRequest({ method: "GET", url: "https://api.aigcfun.com/fc/key", headers: { "Content-Type": "application/json", "Referer": `https://aigcfun.com/` }, onload: function(response) { let resp = response.responseText; let pubkey = JSON.parse(resp).data; if (!pubkey) { document.getElementById("gptAnswer").innerText = "pubkey失败" return } console.log("pubkey:" + pubkey); //GM_setValue("pubkey", pubkey) localStorage.setItem("pubkey",pubkey) document.getElementById("gptAnswer").innerText = "pubkey更新成功:"+pubkey } }); } function getPubkey() { //return GM_getValue("pubkey"); return localStorage.getItem("pubkey"); } //setPubkey() //console.log("GET KEY:" + getPubkey()) //enc-start async function digestMessage(r) { const hash = CryptoJS.SHA256(r); return hash.toString(CryptoJS.enc.Hex); } const generateSignature = async r => { const { t: e, m: t } = r; //const n = {}.PUBLIC_SECRET_KEY; let n = getPubkey(); if (!n) { console.log("pubkey不存在,使用默认") n = "k6zeE77ge7XF" } console.log("CURRENT KEY:" + n) const a = `${e}:${t}:${n}`; return await digestMessage(a); }; //enc-end //start function addChatBtn() { let mybtn = ``; $(".bg.s_btn_wr").after(mybtn) document.getElementById("mybtn").addEventListener("click", function() { console.log("reloadPage") if (window.location.href.indexOf("https:\/\/www.baidu.com\/s") > -1) { GM_add_box_style(2) addBothStyle() keyEvent() appendBox(2).then((res) => { pivElemAddEventAndValue(2) }) } }) } function isMobile() { var userAgentInfo = navigator.userAgent.toLowerCase(); var mobileAgents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; var mobile_flag = false; //根据userAgent判断是否是手机 for (let v = 0; v < mobileAgents.length; v++) { if (userAgentInfo.indexOf(mobileAgents[v].toLowerCase()) > -1) { mobile_flag = true; break; } } return mobile_flag; } //end //顶级配置 var your_qus var abortXml let regx = /search.*?\.cf/g; if (window.location.href.indexOf("bing.com") > -1) { GM_add_box_style(0) addBothStyle() keyEvent() appendBox(0).then((res) => { pivElemAddEventAndValue(0) }) //linkToBing_beautification_script() } if (window.location.href.indexOf("www.google.com") > -1 || window.location.href.match(regx)) { GM_add_box_style(1) addBothStyle() keyEvent() appendBox(1).then((res) => { pivElemAddEventAndValue(1) }) } if (window.location.href.indexOf("https:\/\/www.baidu.com\/s") > -1 && !isMobile()) { GM_add_box_style(2) addBothStyle() keyEvent() appendBox(2).then((res) => { pivElemAddEventAndValue(2) }) } else if (window.location.href.indexOf("https:\/\/m.baidu.com") > -1 || (window.location.href.indexOf( "baidu.com") > -1 && isMobile())) { //手机百度 GM_add_box_style(2) addBothStyle() keyEvent() appendBox(6).then((res) => { pivElemAddEventAndValue(2) }) } //俄罗斯yandex if (window.location.href.indexOf("yandex.ru\/search") > -1 || window.location.href.indexOf( "yandex.com\/search") > -1) { GM_add_box_style(1) addBothStyle() keyEvent() appendBox(3).then((res) => { pivElemAddEventAndValue(3) }) } //360so if (window.location.href.indexOf("so.com\/s") > -1) { GM_add_box_style(1) addBothStyle() keyEvent() appendBox(4).then((res) => { pivElemAddEventAndValue(4) }) } //fsoufsou if (window.location.href.indexOf("fsoufsou.com\/search") > -1) { setTimeout(() => { GM_add_box_style(1) addBothStyle() keyEvent() appendBox(5).then((res) => { pivElemAddEventAndValue(5) }) }, 3000) } //顶级函数 function uuid() { //uuid 产生 var s = []; var hexDigits = "0123456789abcdef"; for (var i = 0; i < 36; i++) { s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); } s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010 s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01 s[8] = s[13] = s[18] = s[23] = "-"; var uuid = s.join(""); return uuid; } function GM_add_box_style(case_web) { switch (case_web) { case 0: //bing GM_addStyle(` #gptAnswer{ margin: 15px; border-top: solid; border-bottom: solid; } #gptInput{ width:74%; border-radius: 4px; } #gptInputBox{ display: flex; justify-content: space-around; } #button_GPT:hover{ background:#ffffffcc; } #gptDiv{ border-radius: 8px; padding: 10px; margin-bottom: 9px; width:452px; translate:-20px; background:#ffffffcc; backdrop-filter: blur(5px); display: flex; flex-direction: column; } #button_GPT{ } #button_GPT{ background: transparent; border-radius: 4px; } #gptCueBox{ translate: 3px; } p{white-space: pre-line} `) break; case 1: //google GM_addStyle(` #gptAnswer{ margin: 15px; border-top: solid; border-bottom: solid; } #gptInput{ border-radius: 4px; width: 68%; } #button_GPT:hover{ background:#dcdcdccc; } #gptDiv{ width:452px; flex: 1; display: flex; flex-direction: column; height: fit-content; } #gptInputBox{ display:flex; justify-content: space-around; } #button_GPT{ background: transparent; border-radius: 3px; font-size: 14px; } #gptStatus{ margin-left: 7px; } p{white-space: pre-line} `) break; //baidu case 2: GM_addStyle(` #gptAnswer{ margin: 15px; border-top: solid; border-bottom: solid; } #gptInput{ border-radius: 4px; width: 68%; } #button_GPT:hover{ background:#4e6ef2; } #gptDiv{ width:452px; flex: 1; display: flex; flex-direction: column; height: fit-content; } #gptInputBox{ display:flex; justify-content: space-around; } #button_GPT{ background: #4460d4; border-radius: 3px; font-size: 14px; } #gptStatus{ margin-left: 7px; } p{white-space: pre-line} `) break; default: alert("参数没设定") } } function do_it() { let finalResult let normalArray let nowResult document.getElementById('gptAnswer').innerHTML = `
  本插件完全免费,请勿点击链接购买,后果自负。
    提示上限、错误等,请点击这里手动更新。更新秘钥
  openAI已就绪,请输入你的问题