WALL-E

审批不烦人,自己就搞定,脏活儿交给walle

2023/07/24のページです。最新版はこちら

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         WALL-E
// @namespace    https://cloud.xuepeiyou.com/
// @version      0.2
// @description  审批不烦人,自己就搞定,脏活儿交给walle
// @author       choukin
// @match        https://cloud.xuepeiyou.com/*
// @run-at       document-start
// @grant        unsafeWindow
// @license MIT
// ==/UserScript==

(function () {
    //console.log(window.unsafeWindow)
    const originSend = XMLHttpRequest.prototype.send

    XMLHttpRequest.prototype.send = function (body){
          console.log(this.responseURL,'this-responseURL')
        if(body){
            try{
             const bodyObj = JSON.parse(body)
                if(bodyObj.env && bodyObj.env[0]){
                 localStorage.setItem('xuepeiyouenv',bodyObj.env[0])
                }
            }catch(e){
            }
        }
        originSend.apply(this, arguments);
    }
    const originOpen = XMLHttpRequest.prototype.open;
    XMLHttpRequest.prototype.open = function (_, url) {
     try{
//       console.log(url,'url')
         const envstr = localStorage.getItem('xuepeiyouenv')
//         console.log(localStorage.getItem('xuepeiyouenv'))
        if (envstr === 'test' &&url && url.indexOf('k8s/apiv3/plat/team/auditors/get') > -1 && url.indexOf('role_id=1')>-1) {
            this.addEventListener("readystatechange", function () {
                if (this.readyState === 4) {
                   const res = JSON.parse(this.responseText);
                    const userInfo = JSON.parse(localStorage.getItem('userInfo'));
                    const tempUser = JSON.parse(JSON.stringify(res.data.list[0]))
                    tempUser.Email=userInfo.email
                    tempUser.Name=userInfo.realname
                    res.data.list.unshift(tempUser)
                    // 当前 xhr 对象上定义 responseText
                    Object.defineProperty(this, "responseText", {
                        writable: true,
                    });

                    this.responseText = JSON.stringify(res);
                }
            });
            }
        }catch(e){
            console.error(e)
        }

  originOpen.apply(this, arguments);
};


})();