Immodem

try to take over the world!

当前为 2018-09-28 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Immodem
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       coz3n
// @match        https://immodem.poste-immo.intra.laposte.fr/
// @grant        none
// ==/UserScript==
window.onload = function() {
    setTimeout(function init() {
        var style = document.createElement('style'),
            css = document.createTextNode("html{box-sizing:border-box}body{background:linear-gradient(to bottom,#fff 0,#ddd 100%)!important}div vertilize-container{justify-content:space-between}.cards{padding:24px 8px 8px;margin:0 10px}.cards>div{width:100%!important}.taskCard{border-radius:2px!important;border:none;box-shadow:0 1px 2px 0 rgba(0,0,0,.5);transition:box-shadow .25s linear}.taskCard:hover{box-shadow:0 2px 4px 1px rgba(0,0,0,.5)}p{margin-bottom:6px}@font-face{font-family:Roboto;font-style:normal;font-weight:400;src:local('Roboto Regular'),local('Roboto-Regular'),url(https://themes.googleusercontent.com/static/fonts/roboto/v11/2UX7WLTfW3W8TclTUvlFyQ.woff) format('woff')}*{font-family:roboto}"),
            it = 0,
            wrap = document.getElementsByTagName('div'),
            real = {},
            realCount = 0,
            VT = {},
            VTCount = 0,
            VCP = {},
            VCPCount = 0,
            RD = {},
            RDCount = 0,
            realDiv = document.createElement('div'),
            VCPDiv = document.createElement('div'),
            VTDiv = document.createElement('div'),
            RDDiv = document.createElement('div');

        style.type = 'text/css';

        realDiv.id = "realisation";
        realDiv.classList.add("cards");
        realDiv.style.display = "flex";
        realDiv.style.flexFlow = "column nowrap";
        realDiv.style.flex = "1 100%";
        VCPDiv.id = "VCP";
        VCPDiv.classList.add("cards");
        VCPDiv.style.display = "flex";
        VCPDiv.style.flexFlow = "column nowrap";
        VCPDiv.style.flex = "1 100%";
        VTDiv.id = "VT";
        VTDiv.classList.add("cards");
        VTDiv.style.display = "flex";
        VTDiv.style.flexFlow = "column nowrap";
        VTDiv.style.flex = "1 100%";
        RDDiv.id = "RD";
        RDDiv.classList.add("cards");
        RDDiv.style.display = "flex";
        RDDiv.style.flexFlow = "column nowrap";
        RDDiv.style.flex = "1 100%";

        for (var g = 0; g < wrap.length; g++) {
            if (wrap[g].hasAttribute("vertilize-container")) {
                wrap = wrap[g];
            }
        }

        wrap.insertBefore(realDiv, wrap.firstElementChild);
        wrap.insertBefore(VCPDiv, wrap.firstElementChild);
        wrap.insertBefore(VTDiv, wrap.firstElementChild);
        wrap.insertBefore(RDDiv, wrap.firstElementChild);

        wrap.style.display = "flex";
        wrap.style.flexFlow = "row nowrap";

        var step = wrap.getElementsByClassName('itemStep');

        for (var i = 0; i < step.length; i++) {
            switch (step[i].firstElementChild.innerHTML) {
                case "Réalisation":
                    real[realCount] = getCard(step[i]);
                    realDiv.appendChild(real[realCount]);
                    console.log(real[realCount]);
                    realCount++;
                    break;
                case "Validation technique":
                    VT[VTCount] = getCard(step[i]);
                    VTDiv.appendChild(VT[VTCount]);
                    VTCount++;
                    break;
                case "Validation CP":
                case "Validation CdP":
                    VCP[VCPCount] = getCard(step[i]);
                    VCPDiv.appendChild(VCP[VCPCount]);
                    VCPCount++;
                    break;
                case "Réception de la demande":
                    RD[RDCount] = getCard(step[i]);
                    RDDiv.appendChild(RD[RDCount]);
                    RDCount++;
                    break;
            }
        }

        realCount = 0;

        style.appendChild(css);
        document.head.appendChild(style);

        function getCard(item) {
            while (it < 4) {
                item = item.parentElement;
                it++;
            }
            it = 0;
            return item;
        }

    }, 5000);
}