Zeiterfassungscript

"TMA Script"

2018-08-14 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name     Zeiterfassungscript
// @version  2
// @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;
    window.setInterval(() => {
if (title.search('Startseite') > -1) {



        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"
            }
        });
    
    window.setTimeout(() => {
document.querySelector('#nANABWES').click(');
        //window.location.reload();
    }, 10000);
} else if (title.search('Abwesenheit') > -1 ) {
   

        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"
            }
        });

    window.setTimeout(() => {
document.querySelector('#nSTART').click(');
        //window.location.reload();
    }, 10000);
}
},  20000);