Immodem

try to take over the world!

目前为 2020-01-06 提交的版本。查看 最新版本

// ==UserScript==
// @name         Immodem
// @namespace    http://tampermonkey.net/
// @version      0.8
// @description  try to take over the world!
// @author       coz3n
// @match        https://immodem.poste-immo.intra.laposte.fr/*
// @require https://greasyfork.org/scripts/394721-w84kel/code/w84Kel.js?version=763614
// @grant        none
// ==/UserScript==

let obsconf = {childList: true},
    url = [],
    css = document.createTextNode("@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')}html{box-sizing:border-box;overflow:hidden}*{font-family:roboto}*,:after,:before{box-sizing:inherit}body{padding:0;height:100vh}h4{font-size:16px}#page-content-wrapper,#wrapper,body{height:100vh}#wrapper{overflow-y:auto;overflow-x:hidden}#sidebar-wrapper{overflow:hidden}.container-fluid{height:100%}div vertilize-container{justify-content:space-between}#wrap{display:-webkit-flex;display:-moz-flex;display:-ms-flex;display:-o-flex;display:flex;flex-flow:row nowrap;justify-content:space-around}.entete{width:100%;height:48px;text-align:center;font-size:1.5em;color:#fff;text-shadow:0 1px 0 #aaa;margin:0;padding:0}.bucket{padding:24px 8px 8px;margin:0 10px;display:flex;background:#ddd;height:80vh;overflow-y:scroll;flex-flow:row wrap;flex:1 1 100%;justify-content:space-between;align-items:flex-start;align-content:flex-start;max-width:20vw}.bucket>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;height:auto!important}.taskCard:hover{box-shadow:0 2px 4px 1px rgba(0,0,0,.5)}.taskInfos{font-size:12px}p{margin-bottom:6px}[id=\"Validation CP\"]{order:0}#Réalisation{order:1}[id=\"Validation technique\"]{order:2}[id=\"Réception de la demande\"]{order:3}::-webkit-scrollbar{width:8px}::-webkit-scrollbar-thumb{background:#666;border-radius:16px}::-webkit-scrollbar-track{background:#ddd;width:12px}"),
    initLaunch,
    buckets = ["Validation CP","Réalisation","Validation technique","Réception de la demande"],
    sessionVal = localStorage.getItem("user_session");

console.log(JSON.parse(sessionVal));

waitForKeyElements(".taskCard", card => ux(card));

function formatInfos(infos) {
    infos.forEach(info => {
        let infoSplit = info.innerHTML.split(" : ")
        info.innerHTML = "<b>" + infoSplit[0] + "</b> : " + infoSplit[1];
    });
}

function ux() {
    let container = document.querySelector('[vertilize-container]'),
        card = arguments[0].parentElement,
        taskInfos = arguments[0].querySelectorAll('.taskInfos'),
        step = card.querySelector(".itemStep").innerText;

    let infosFormated = formatInfos(taskInfos);
    card.classList.add("card");
    step = step.replace(/\n|\r|(\n\r)|\s/g,'');

    buckets.forEach(bucketId => {
        let newBucketId = bucketId.replace(/\n|\r|(\n\r)|\s/g,'');
        let bucket = document.getElementById(newBucketId);
        if (!bucket) {
            let divBucket = document.createElement('div'),
                headBucket = document.createElement('h4'),
                tasksContainer = document.createElement('div');
            headBucket.innerText = bucketId;
            tasksContainer.classList.add("tasksContainer");
            divBucket.id = newBucketId;
            divBucket.dataset.step = newBucketId;
            divBucket.classList.add("stepBucket");
            divBucket.appendChild(headBucket);
            divBucket.appendChild(tasksContainer);
            container.appendChild(divBucket);
            if (step === newBucketId) {
                tasksContainer.appendChild(card);
            }
        } else {
            if (bucket.id === step) {
                let tasksContainer = bucket.querySelector(".tasksContainer");
                tasksContainer.appendChild(card);
            }
        }
    })
}