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