All Downloads are FREE. Search and download functionalities are using the official Maven repository.

application.appConfig.js Maven / Gradle / Ivy

There is a newer version: 1.2.21
Show newest version
export let singleInput = false;
export let stickyInput = false;
export let loadImages = "true";
export let showMenubar = true;

export function fetchAppConfig(sessionId) {
    return fetch('appInfo?session=' + sessionId)
        .then(response => {
            console.log('AppInfo fetch response:', response);
            if (!response.ok) {
                throw new Error('Network response was not ok');
            }
            return response.json();
        })
        .then(data => {
            console.log('AppInfo data:', data);
            if (data) {
                if (data.applicationName) {
                    document.title = data.applicationName;
                }
                if (data.singleInput) {
                    singleInput = data.singleInput;
                }
                if (data.stickyInput) {
                    stickyInput = data.stickyInput;
                }
                if (data.loadImages) {
                    loadImages = data.loadImages;
                }
                if (data.showMenubar != null) {
                    showMenubar = data.showMenubar;
                    applyMenubarConfig(showMenubar);
                }
            }
            return {singleInput, stickyInput, loadImages, showMenubar};
        });
}

function applyMenubarConfig(showMenubar) {
    if (showMenubar === false) {
        const menubar = document.getElementById('toolbar');
        if (menubar) menubar.style.display = 'none';
        const namebar = document.getElementById('namebar');
        if (namebar) namebar.style.display = 'none';
        const mainInput = document.getElementById('main-input');
        if (mainInput) {
            mainInput.style.top = '0px';
        }
        const session = document.getElementById('session');
        if (session) {
            session.style.top = '0px';
            session.style.width = '100%';
            session.style.position = 'absolute';
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy