Zeiterfassungscript

"TMA Script"

2018-08-14 기준 버전입니다. 최신 버전을 확인하세요.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name     Zeiterfassungscript
// @version  1
// @grant    GM.xmlHttpRequest
// @include https://mytma.fe.hhi.de/*
// @description "TMA Script"

// @namespace https://greasyfork.org/users/149650
// ==/UserScript==
        let title = document.querySelector('#formularNameDiv').innerText;
console.log(title, 'title');
if (title.search('Startseite') > -1) {

    window.setInterval(() => {

        let netto;
        let total;
        let next = false;
        document.querySelectorAll('#ajaxZeitstatusDiv td').forEach((td, index, all) => {
            let match = td.innerHTML.match(/(\d+:\d+) Std\. \(Nettozeit ohne Pausen\)/i);
            if (match !== null) {
                netto = match[1];
            }

            match = td.innerHTML.match(/heute/i);
            if (match !== null) {
                total = all[index + 1].innerHTML.match(/(\d+:\d+)/)[1];
                console.log(td.innerHTML, all[index + 1].innerHTML);

            }


        });
        GM.xmlHttpRequest({
            method: "POST",
            url: "http://localhost:1234/post.php",
            data: JSON.stringify({netto, total}),
            headers: {
                "Content-Type": "application/x-www-form-urlencoded"
            }
        });
    },  2000);
    window.setTimeout(() => {
        window.location.reload();
    }, 10000);
} else if (title.search('Abwesenheit') > -1 ) {
    window.setInterval(() => {

        let colleagues = [];
        let next = false;
        document.querySelectorAll('.rundrumZelleMA').forEach((td, index, all) => {
            console.log(td);
            let match = td.innerHTML.match(/[a-z ]+, [a-z ]+/i);
            if (match !== null) {
                colleagues.push({
                    name: match[0].trim(),
                    present: td.title.search('gekommen') > -1
                });
            }


        });
                        console.log(colleagues);

        GM.xmlHttpRequest({
            method: "POST",
            url: "http://localhost:1234/post.php",
            data: JSON.stringify({colleagues}),
            headers: {
                "Content-Type": "application/x-www-form-urlencoded"
            }
        });
    },  2000);
    window.setTimeout(() => {
        window.location.reload();
    }, 10000);
}