masaila / XCADEY - Replacement 自动获取信息

// ==UserScript==
// @name         XCADEY - Replacement 自动获取信息
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  try to take over the world!
// @author       You
// @include      https://xcadey.com/wp-admin/admin.php?page=wpforms-entries&view=edit&entry_id=*
// @icon         https://www.google.com/s2/favicons?domain=xcadey.com
// @grant        GM_setClipboard
// @license      MIT

// ==/UserScript==
(function() {
    'use strict';
var modelTable = {};
//modelTable["SRAM 3-Bolt 104BCD"] = "SRAM-3-104";
//modelTable["SRAM 3-Bolt 110BCD"] = "SRAM-3-110";
//modelTable["SRAM 3-Bolt 110BCD 4S"] = "SRAM-3-110-4S";
//modelTable["SRAM 8-Bolt 110BCD"] = "SRAM-8-110";
//modelTable["SRAM 8-Bolt 110BCD 4S"] = "SRAM-8-110-4S";
//modelTable["SRAM 8-Bolt 107BCD"] = "SRAM-8-107";
//modelTable["ROTOR REX 104BCD"] = "ROTOR-REX-104";
//modelTable["ROTOR 3D 110BCD"] = "ROTOR-3D-110";
//modelTable["ROTOR 3D 110BCD 4S"] = "ROTOR-3D-110-4S";
//modelTable["ROTOR ALDHU 110BCD"] = "ROTOR-ALDHU-110";
//modelTable["ROTOR ALDHU 110BCD 4S"] = "ROTOR-ALDHU-110-4S";
//modelTable["SPECIALIZED 110BCD"] = "SPECIALIZED-110";
//modelTable["CANNONDALE 104BCD"] = "CANNONDALE-104";
//modelTable["CANNONDALE 110BCD"] = "CANNONDALE-110";
//modelTable["RACEFACE 104BCD"] = "RACEFACE-104";
//modelTable["EASTON 110BCD"] = "EASTON-110";
//modelTable["SHIMANO MTB 100BCD"] = "SHIMANO-MTB-100";
//modelTable["SHIMANO MTB 104BCD"] = "SHIMANO-MTB-104";

modelTable["SRAM 3-Bolt 104BCD"] = "07f5dbc2-00e6-41db-b06b-d706a828237f";
modelTable["SRAM 3-Bolt 110BCD"] = "7ce833c5-c430-4056-847a-7f020a7b3f01";
modelTable["SRAM 3-Bolt 110BCD 4S"] = "5cf0d46c-15a6-4d0d-af4c-aa092b038f43";
modelTable["SRAM 8-Bolt 110BCD"] = "b9178278-ea9f-4e25-ba1f-8a6e6a556bcc";
modelTable["SRAM 8-Bolt 110BCD 4S"] = "99f8cea7-2a1e-4622-a6ee-1fee37095945";
modelTable["SRAM 8-Bolt 107BCD"] = "03ff0bb4-980e-4f22-9a5d-3cff81fb84b1";
modelTable["ROTOR REX 104BCD"] = "32e8b160-a801-441d-894d-42adf8068a68";
modelTable["ROTOR 3D 110BCD"] = "8f4a4de0-57e7-47d8-91f5-f756228cd3e5";
modelTable["ROTOR 3D 110BCD 4S"] = "dc8bf201-7af3-4f2e-8485-bd0ac57b6d20";
modelTable["ROTOR 3D 130BCD"] = "03a33b23-530a-4471-93a6-ef4f66ef8ea7";
modelTable["ROTOR ALDHU 110BCD"] = "99d52bbb-0da0-4242-8466-fea1fc3c1ada";
modelTable["ROTOR ALDHU 110BCD 4S"] = "e53e2b49-36e8-455f-a38a-5fba1cab9125";
modelTable["SPECIALIZED 110BCD"] = "7681deec-8de9-466b-9730-0c591a5285ef";
modelTable["CANNONDALE 104BCD"] = "52c3ff5c-6459-448d-8be1-4abf2c7aafb2";
modelTable["CANNONDALE 110BCD"] = "6117968f-b7a4-4ed6-91bd-c168639e177a";
modelTable["RACEFACE 104BCD"] = "9058099f-5bb1-4d96-b85b-571f8914a4b9";
modelTable["EASTON 110BCD"] = "4d7414e0-13af-4620-87a7-8442d53e80a7";
modelTable["SHIMANO MTB 100BCD"] = "bebc44ac-4358-44c0-bebd-81ae1c3c8969";
modelTable["SHIMANO MTB 104BCD"] = "3e8e28e4-5799-4bd2-bced-31a51cca75d2";
modelTable["XCADEY 104BCD"] = "135ca99d-9795-4665-a7f7-dbc02d66b7af";
modelTable["XCADEY 110BCD"] = "e635ae5e-5b14-4114-8633-09397cb1df90";
modelTable["XCADEY 110BCD 4S"] = "741ce119-3467-49c9-9926-5b7f6233e184";
modelTable["XCADEY 144BCD"] = "ac515fd3-e603-4f5f-9e8f-1708f0ed6135";

    // Your code here...
    let button1 = document.createElement('button');
    button1.innerText = '复制内容(Replacement)';
    document.getElementsByClassName('page-title')[0].append(button1);

    button1.onclick = function() {
        let jsonObject = {
            "model": modelTable[document.getElementById("wpforms-58505-field_7").value],
            "amount": 1,
            "orderType": "售后",
            "customOrderId": document.getElementById("wpforms-58505-field_27").value,
            "address_line1": document.getElementById("wpforms-58505-field_26").value,
            "address_line2": document.getElementById("wpforms-58505-field_26-address2").value,
            "city": document.getElementById("wpforms-58505-field_26-city").value,
            "province": document.getElementById("wpforms-58505-field_26-state").value,
            "post": document.getElementById("wpforms-58505-field_26-postal").value,
            "country": document.getElementById("wpforms-58505-field_26-country").value,
            "name": document.getElementById("wpforms-58505-field_28").value,
            "phone": document.getElementById("wpforms-58505-field_27").value,
            "email": document.getElementById("wpforms-58505-field_31").value,
            "cpfOrId": document.getElementById("wpforms-58505-field_29").value,
            "currency": "人民币",
            "url": window.location.href,
            "customer": "79431f80-b232-4517-b1b6-dc43c8a3de85"
        };
        GM_setClipboard(JSON.stringify(jsonObject));
    };

    let button2 = document.createElement('button');
    button2.innerText = '设置已处理(Replacement)';
    document.getElementsByClassName('page-title')[0].append(button2);
    button2.onclick = function() {
        document.getElementById('wpforms-58505-field_32_5').click();
        document.getElementById('wpforms-edit-entry-update').click()
    };

    let button3 = document.createElement('button');
    button3.innerText = '复制内容(Repair)';
    document.getElementsByClassName('page-title')[0].append(button3);
    button3.onclick = function() {
        let jsonObject = {
            "address_line1": document.getElementById("wpforms-58542-field_26").value,
            "address_line2": document.getElementById("wpforms-58542-field_26-address2").value,
            "city": document.getElementById("wpforms-58542-field_26-city").value,
            "province": document.getElementById("wpforms-58542-field_26-state").value,
            "post": document.getElementById("wpforms-58542-field_26-postal").value,
            "country": document.getElementById("wpforms-58542-field_26-country").value,
            "name": document.getElementById("wpforms-58542-field_28").value,
            "phone": document.getElementById("wpforms-58542-field_27").value,
            "email": document.getElementById("wpforms-58542-field_31").value,
            "url": window.location.href,
            "cpfOrId": document.getElementById("wpforms-58542-field_29").value
        };
        GM_setClipboard(JSON.stringify(jsonObject));
    };
    let button4 = document.createElement('button');
    button4.innerText = '设置已处理(Repair)';
    document.getElementsByClassName('page-title')[0].append(button4);
    button4.onclick = function() {
        document.getElementById('wpforms-58542-field_32_3').click();
        document.getElementById('wpforms-edit-entry-update').click()
    };


// Your code here...
    let button5 = document.createElement('button');
    button5.innerText = '复制内容(Replacement-EU)';
    document.getElementsByClassName('page-title')[0].append(button5);

    button5.onclick = function() {
        let jsonObject = {
            "model": modelTable[document.getElementById("wpforms-59093-field_7").value],
            "amount": 1,
            "orderType": "售后",
            "customOrderId": document.getElementById("wpforms-59093-field_27").value,
            "address_line1": document.getElementById("wpforms-59093-field_26").value,
            "address_line2": document.getElementById("wpforms-59093-field_26-address2").value,
            "city": document.getElementById("wpforms-59093-field_26-city").value,
            "province": document.getElementById("wpforms-59093-field_26-state").value,
            "post": document.getElementById("wpforms-59093-field_26-postal").value,
            "country": document.getElementById("wpforms-59093-field_26-country").value,
            "name": document.getElementById("wpforms-59093-field_28").value,
            "phone": document.getElementById("wpforms-59093-field_27").value,
            "email": document.getElementById("wpforms-59093-field_31").value,
            "url": window.location.href,
            "cpfOrId": document.getElementById("wpforms-59093-field_29").value,
            "currency": "人民币",
            "customer": "79431f80-b232-4517-b1b6-dc43c8a3de85"
        };
        GM_setClipboard(JSON.stringify(jsonObject));
    };

    let button6 = document.createElement('button');
    button6.innerText = '设置已处理(Replacement-EU)';
    document.getElementsByClassName('page-title')[0].append(button6);
    button6.onclick = function() {
        document.getElementById('wpforms-59093-field_32_5').click();
        document.getElementById('wpforms-edit-entry-update').click()
    };


})();