Behandeling SOM

Behandeling inladen voor SOM

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Behandeling SOM
// @namespace    http://tampermonkey.net/
// @version      1.3.0
// @description  Behandeling inladen voor SOM
// @match        *://*/*
// @grant        none

// ==/UserScript==

// ⚠️ VEROUDERD: Dit script is verouderd en wordt niet meer onderhouden.
// De API-koppeling (whisper.anzwerz.ai) is verwijderd; gebruik een nieuwere versie indien beschikbaar.

(function() {
    'use strict';
window.addEventListener('load', function() {




function getClientNumber() {
   
    // Pak de derde frame (index 2) uit het frameset
    const mainframe = window.parent.parent.frames[2]; // of window.frames['mainframe']

    if (!mainframe) {
        console.error('Mainframe (derde frame) niet gevonden');
        return null;
    }

    // Pak het document uit de frame
    const frameDoc = mainframe.document;

    if (!frameDoc) {
        console.error('Kan niet bij frame document');
        return null;
    }

    console.log('Frame document gevonden');
    const container = frameDoc.getElementById('tab_contents3');
    console.log(container);

    if (!container) return null;

    // Zoek de tweede <tr> binnen de container

        const rows = container.querySelectorAll('table tbody tr');
        try {
            if (rows.length >= 2) {
                const secondRow = rows[1];
                const lastCell = secondRow.lastElementChild;

                if (lastCell) {
                    const text = (lastCell.textContent || lastCell.innerText).trim();
                    const numberMatch = text.match(/\d+/);
                    if (numberMatch) {
                        return numberMatch[0];
                    }
                }
            }
         } catch (err) {
            console.error(err);
            return null;
         }

        return null;
   

    }


    function getCurrentdate(){
        const currentLi = document.getElementById('current');
        if (currentLi){
            const smallElement = currentLi.querySelector('small');
            if (smallElement) {
                console.log("element gevonden");
                try{
                    const datum = smallElement.textContent;
                    const datumGedeelte = datum.split(' ')[1];
                    const delen = datumGedeelte.split('-');
                    const dag = delen[0].padStart(2, '0'); // "14"
                    const maand = delen[1].padStart(2, '0'); // "07"
                    const jaar = '20' + delen[2].replace("'", ""); // "2025"
                    
                    // Combineer tot YYYY-MM-DD formaat
                    const geformatteerdeDatum = `${jaar}-${maand}-${dag}`;
                    console.log(geformatteerdeDatum);
                    
                    return geformatteerdeDatum;

                } catch (err) {
                    console.error(err);
                    return null;
                }
            }
            return null;
        }
        return null;
    }


    const clientNumber = getClientNumber();
    const dateConsult = getCurrentdate()

    if (clientNumber === null){
        console.log("kan clientnummer niet vinden");
     } else if (dateConsult == null) {
        console.log("kan datum niet vinden");
    } else {
        console.log("haal data op")
    

        console.log("haal data op");
        // Fetches naar whisper.anzwerz.ai verwijderd
    }

    
}, false);
})();