stop misoperation

when u using prd env,it can stop misoperation!!

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         stop misoperation
// @namespace    http://tampermonkey.net/
// @version      0.1.1
// @description  when u using prd env,it can stop misoperation!!
// @author       double jy
// @match        https://www.baidu.com
// @grant        none
// ==/UserScript==
function ajaxSend(objectOfXMLHttpRequest, callback) {
    if(!callback){
        return;
    }

    var s_ajaxListener = new Object();
    s_ajaxListener.tempOpen = objectOfXMLHttpRequest.prototype.open;
    s_ajaxListener.tempSend = objectOfXMLHttpRequest.prototype.send;
    s_ajaxListener.callback = function () {
        // this.method :the ajax method used
        // this.url :the url of the requested script (including query string, if any) (urlencoded)
        // this.data :the data sent, if any ex: foo=bar&a=b (urlencoded)
        callback(this.method, this.url, this.data);
    }

    objectOfXMLHttpRequest.prototype.open = function(a,b) {
        if (!a) a='';
        if (!b) b='';
        s_ajaxListener.tempOpen.apply(this, arguments);
        s_ajaxListener.method = a;
        s_ajaxListener.url = b;
        if (a.toLowerCase() == 'get') {
            s_ajaxListener.data = b.split('?');
            s_ajaxListener.data = s_ajaxListener.data[1];
        }
    }

    objectOfXMLHttpRequest.prototype.send = function(a,b) {
        if(s_ajaxListener.method.toLowerCase() == 'post' && s_ajaxListener.url.indexOf('https://www.baidu.com') >= 0){
            if(!confirm("你确定要操作线上环境??????????"))return;
        }
        if (!a) a='';
        if (!b) b='';
        s_ajaxListener.tempSend.apply(this, arguments);
        if(s_ajaxListener.method.toLowerCase() == 'post') {
            s_ajaxListener.data = a;
        }
        s_ajaxListener.callback();
    }
};

function onAjaxSend(method, url, data) {
    if(method=='POST'){
    }
};

(function() {
    'use strict';


    // Your code here...
    ajaxSend(globalThis.XMLHttpRequest, onAjaxSend);
})();