HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //home/panomity.de/vr.panomity.com/plugins/splat3d/dollhouse.js
/**
 * Dollhouse-Ansicht für CMS4VR.
 *
 * 3D-Puppenhaus aus dem Grundriss + Szenen-Positionen: Räume schweben als
 * anklickbare Vorschau-Karten über dem Grundriss, Orbit-Kamera. Klick auf
 * einen Raum fliegt in die entsprechende Szene.
 */

const dollhouse = {
    open: false,
    available: null,
};

function dollhouseKrpano() {
    return (typeof krpano !== 'undefined') ? krpano : document.getElementById('krpanoSWFObject');
}
function dollhouseLang() {
    return (typeof ollamaChatConfig !== 'undefined' && ollamaChatConfig.language) || 'en';
}
function dollhouseText(de, en) {
    return dollhouseLang() === 'de' ? de : en;
}

async function dollhouseCheck() {
    if (dollhouse.available !== null) return dollhouse.available;
    try {
        const d = await fetch('/api/dollhouse.php?language=' + encodeURIComponent(dollhouseLang())).then(r => r.json());
        dollhouse.available = !!(d && d.ok && d.rooms && d.rooms.length > 0);
    } catch (e) {
        dollhouse.available = false;
    }
    return dollhouse.available;
}

function dollhouseGoto(panoId) {
    const k = dollhouseKrpano();
    dollhouseClose();
    if (k && k.call) {
        try {
            k.call('loadscene(scene_p' + panoId + ', null, MERGE, BLEND(1.0, easeInOutSine));');
            if (typeof updateCurrentPanoIdFromKrpano === 'function') setTimeout(updateCurrentPanoIdFromKrpano, 1200);
            if (typeof loadContextAndStarters === 'function') setTimeout(loadContextAndStarters, 1300);
        } catch (e) { console.warn('Dollhouse: goto failed', e); }
    }
}

function dollhouseMessageHandler(ev) {
    if (ev.data && ev.data.type === 'dollhouse-goto' && ev.data.panoId != null) {
        dollhouseGoto(parseInt(ev.data.panoId, 10));
    }
}

function dollhouseOpen() {
    if (dollhouse.open) return;
    dollhouse.open = true;
    window.addEventListener('message', dollhouseMessageHandler);

    const wrap = document.createElement('div');
    wrap.id = 'dollhouse-overlay';
    wrap.innerHTML =
        '<iframe id="dollhouse-frame" src="plugins/splat3d/dollhouse.html?lang=' + encodeURIComponent(dollhouseLang()) + '"></iframe>' +
        '<button id="dollhouse-close" title="' + dollhouseText('Schließen', 'Close') + '"><i class="mdi mdi-close"></i></button>';
    document.body.appendChild(wrap);
    document.getElementById('dollhouse-close').addEventListener('click', dollhouseClose);
}

function dollhouseClose() {
    window.removeEventListener('message', dollhouseMessageHandler);
    const w = document.getElementById('dollhouse-overlay');
    if (w) w.remove();
    dollhouse.open = false;
}
window.dollhouseOpen = dollhouseOpen;
window.dollhouseClose = dollhouseClose;

async function dollhouseInit() {
    const ok = await dollhouseCheck();
    if (!ok || document.getElementById('dollhouse-button')) return;
    const btn = document.createElement('div');
    btn.id = 'dollhouse-button';
    btn.title = dollhouseText('Puppenhaus-Ansicht', 'Dollhouse view');
    btn.innerHTML = '<i class="mdi mdi-home-city"></i><span>' + dollhouseText('Puppenhaus', 'Dollhouse') + '</span>';
    btn.addEventListener('click', dollhouseOpen);
    document.body.appendChild(btn);
    console.log('Dollhouse: ready');
}
window.dollhouseInit = dollhouseInit;
setTimeout(dollhouseInit, 3200);