shigeshimao.static_title

固定名字,随机价格

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.greasyfork.org/scripts/440568/1021985/shigeshimaostatic_title.js

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

let title = 'long sleeve cotton dress solid dress dress long sleeve long sleeve solid cotton  '
let count = 9;
let min_price = 51;
let max_price = 99;


$(document).ready(function () {
    function set_price_list() {
        let gradient = (max_price - min_price) / 49;

        function toDecimal(x) {
            var f = parseFloat(x);
            if (isNaN(f)) {
                return;
            }
            f = Math.round(x * 100) / 100;
            return f;
        }

        let my_prices = []
        let my_price_list = localStorage.getItem("my_price_list");
        for (let i = 0; i < 50; i++) {
            my_prices[i] = toDecimal(min_price + i * gradient)
        }
        let my_value_str = JSON.stringify(my_prices);
        localStorage.setItem("my_price_list", my_value_str);
        return my_prices
    }

    function get_flag() {
        let storage_name = "my_price_flag_list"
        let my_flag_list = localStorage.getItem(storage_name);
        if (my_flag_list === null) {
            let my_value_str = JSON.stringify([]);
            localStorage.setItem(storage_name, my_value_str);
            return 0;
        } else {
            //游标最大值为长度减一
            let local_value = JSON.parse(my_flag_list);
            let flag = local_value.length
            local_value[flag] = flag
            let my_value_str = JSON.stringify(local_value);
            localStorage.setItem(storage_name, my_value_str);
            return flag
        }
    }

    let my_prices = set_price_list();

    let urls = location.href


    if (urls.search('products/') > -1) {
        function faBuShangPin() {
            $(".btn-responsive")[0].click()
        }

        faBuShangPin()
    } else if (urls.search('addproduct/') > -1) {

        function add_goods() {
            $('tbody tr')[0].click()
        }

        setTimeout(function () {
            add_goods()
            console.log("添加商品")
        }, 1000)

        setTimeout(function () {
            $("#Name").val(title)
            $("#Name").trigger("change");
            $("#Price").val(my_prices[get_flag()])
            $("#Price").trigger("change");
            //价格
        }, 1500)

        setTimeout(function () {
            $("input[type='checkbox'][id='SourceWarehouse_0']")[0].click()
            //选定国内仓
        }, 2000)

        setTimeout(function () {
            let couy = $("input[name='WarehouseQuantity_0']")[0];
            $(couy).val(count)
            $(couy).trigger("change");
            //商品数量
        }, 2500)

        setTimeout(function () {
            $($("button[id='SubmitProduct']")[0]).click()
        }, 3000)

    }

})
;