Behandeling SOM

Behandeling inladen voor SOM

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل 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);
})();