"use strict"; import protectedSessionHolder from '../services/protected_session_holder.js'; import server from '../services/server.js'; import infoService from "../services/info.js"; import zoomService from "../services/zoom.js"; import utils from "../services/utils.js"; import cssLoader from "../services/css_loader.js"; const $dialog = $("#options-dialog"); const tabHandlers = []; function addTabHandler(handler) { tabHandlers.push(handler); } async function showDialog() { glob.activeDialog = $dialog; const options = await server.get('options'); $dialog.modal(); for (const handler of tabHandlers) { if (handler.optionsLoaded) { handler.optionsLoaded(options); } } } async function saveOptions(options) { await server.put('options', options); infoService.showMessage("Options change have been saved."); } export default { showDialog, saveOptions }; addTabHandler((function() { const $themeSelect = $("#theme-select"); const $zoomFactorSelect = $("#zoom-factor-select"); const $leftPaneMinWidth = $("#left-pane-min-width"); const $leftPaneWidthPercent = $("#left-pane-width-percent"); const $mainFontSize = $("#main-font-size"); const $treeFontSize = $("#tree-font-size"); const $detailFontSize = $("#detail-font-size"); const $body = $("body"); const $container = $("#container"); async function optionsLoaded(options) { const themes = [ { val: 'white', title: 'White' }, { val: 'dark', title: 'Dark' }, { val: 'black', title: 'Black' } ].concat(await server.get('options/user-themes')); $themeSelect.empty(); for (const theme of themes) { $themeSelect.append($("