Learn AI

对learn AI进行了加强,我真的想玩AI!

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Learn AI
// @namespace    https://chat.cutterman.cn/
// @version      0.2
// @description  对learn AI进行了加强,我真的想玩AI!
// @author       You
// @match        https://chat.cutterman.cn/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=https://chat.cutterman.cn/
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    const jquery= document.createElement('script');
    jquery.src = 'https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.min.js';
    const head = document.getElementsByTagName('head')[0];
    head.appendChild(jquery);
    function refresh(){
        let token = "";
        $.ajax({
            type : "POST",
            url: "https://www.cutterman.cn/chat/user-info",
            data: "",
            success: function(res) {
                //localStorage.setItem("access_token",res.access_token);
                token = res.access_token
            },
        });
        const { fetch: originalFetch } = window;
        window.fetch = async (...args) => {
            let [resource, config] = args;
            config.headers['Authorization'] = token
            const response = await originalFetch(resource, config);

            // response interceptor

            return response;
        };
    }

    let count = 0;
    window.onkeydown = function(e){
        if(e.keyCode === 13) {
            count +=1;
            if (count >= 2){
                //setTimeout(refresh(),100);
                refresh()
                count = 0;
            }
        }
    }

    window.onclick = function (e){
        let sendButton = e.view.document.getElementsByClassName("text-5 mx-3").item(0);
        sendButton.addEventListener("click", ()=>{
            count +=1;
            if (count >= 2){
                //setTimeout(refresh(),100);
                refresh()
                count = 0;
            }
        })
    }



})();