immodem.JS

agencement des cartes pour immodem en fonction de l'étape.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         immodem.JS
// @namespace    http://tampermonkey.net/
// @version      0.10
// @description  agencement des cartes pour immodem en fonction de l'étape.
// @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 = [],
    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 = "<span class=\"infoLabel\">" + infoSplit[0] + "</span><span class=\"infoValue\">" + 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);
            }
        }
    })
}