/*  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Script: dashboard.js        | Ver:5.0.0
    Auhor:  DNC Thomas          | Feb 2026
    Last edit:  2026-02-05 08:53:45
    Role:   Page specific scripts
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
$().ready( function() {
    $('#infoText').load( "dashboard-info.html", function( response, status, xhr) {
        if( status =='error') {
            console.log('No user text available.');
            $('#infoTextPanel').addClass('w3-hide');
        }
    } )

    //  Load the Moon
    if( cmxConfig.DataPath == '') {
        imgPath = cmxConfig.DataPath;
    } else {
        dataPath = cmxConfig.DataPath
        dataPath += (dataPath.at(-1) == '/' ? '' : '/');
        if( dataPath.at(0) == '/') {
            // Its root
            imgPath = dataPath;
        } else {
            imgPath = location.pathname.split('/');
            imgPath.pop();
            imgPath = imgPath.join('/') + '/' + dataPath;
        }
    }
    console.log('Moon path: ' + imgPath);
    $('#moonImg').attr('src', imgPath + 'images/moon.png');
});
