阿里百宝箱P4P布局优化-朱玄奘

优化调整阿里国际站P4P界面,布局更紧凑,目前只是最简单的版本,有问题及时反馈:有更多的需求及时留言微信号:zrl0495

Ce script ne doit pas être installé directement. C'est une librairie destinée à être incluse dans d'autres scripts avec la méta-directive // @require https://update.greasyfork.org/scripts/454741/1162095/%E9%98%BF%E9%87%8C%E7%99%BE%E5%AE%9D%E7%AE%B1P4P%E5%B8%83%E5%B1%80%E4%BC%98%E5%8C%96-%E6%9C%B1%E7%8E%84%E5%A5%98.js

// @license Apache
(function () {
    'use strict';
    var urlp;
    urlp = window.location.href;

    setInterval(function () {
        if (urlp.slice(25, 38) ==="campaign_list"){
        let btn = document.createElement("button");
        btn.innerText = "调整";
        btn.setAttribute("class", "next-btn next-medium next-btn-normal ml10");
        let change = document.querySelector(".next-btn.next-medium.next-btn-normal.ml10");
        let changeall = document.querySelectorAll(".next-btn.next-medium.next-btn-normal.ml10");
        if (change.innerText === "查询") {
            change.parentElement.insertBefore(btn, change);
        } else if (changeall[2].innerText === "查询") {
            changeall[2].parentElement.insertBefore(btn, changeall[2]);
        }

        let once = function (fn) {
            let caller = true;
            return function () {
                if (caller) {
                    caller = false
                    fn.apply(this, arguments)
                }
            }

        }

        btn.onclick = function () {
            setInterval(function () {
                isFixed();
            }, 100);

            function isFixed() {
                var gd = document.getElementsByClassName("next-table-lock-left")[0];

                if (gd) {
                    gd.setAttribute('style', 'display:none !important')
                }
                var gd1 = document.getElementsByClassName("next-table-lock-left")[1];

                if (gd1) {
                    gd1.setAttribute('style', 'display:none !important')
                }
            }


            setInterval(function () {
                delOnOff();
            }, 100);

            function delOnOff() {
                var textstaus = document.getElementsByClassName("status-text");
                for (let i = 0; i < textstaus.length; i++) {
                    textstaus[i].setAttribute('style', 'display:none !important');
                }
            }

            setInterval(once(function () {
                tabpad();
            }), 100);
            function tabpad() {
                var tablepad = document.getElementsByClassName("next-table-cell-wrapper");
                for (let t = 0; t < tablepad.length; t++) {
                    if (tablepad) {
                        tablepad[t].style.padding = "12px 6px";
                    }
                }
            }

            setInterval(once(function () {
                adjustWidth();
            }), 100);

            function adjustWidth() {
                var colgArr = document.querySelectorAll("table > colgroup");
                var w = [
                    "width: 20px;",
                    "width: 50px;",
                    "width: 80px;",
                    "width: 100px;",
                    "width: 80px;",
                    "width: 80px;",
                    "width: 80px;",
                    "width: 80px;",
                    "width: 80px;",
                    "width: 80px;",
                    "width: 80px;",
                    "width: 80px;",
                    "width: 80px;",
                    "width: 80px;",
                    "width: 80px;",
                ];
                if (colgArr) {
                    for (let c = 0; c < colgArr.length; c++) {
                        for (let l = 0; l < colgArr[c].childElementCount; l++) {

                            colgArr[c].children[l].setAttribute("style", w[l]);

                        }
                    }
                }
            }
            setInterval(once(function () {
                delAsk();
            }), 100);
            function delAsk() {

                for (let i = 1; i < 15; i++) {
                    let gg = document.getElementsByClassName("next-icon next-icon-icon_question_fill next-small")[i];
                    gg.setAttribute('style', 'display:none !important');
                }
            }
            };
        }
    }, 5000)
})();