import './css/ui.scss' import './style.css' // import javascriptLogo from './javascript.svg' import { get } from './lib/utility' // document.querySelector('#js-logo').src = javascriptLogo window.consts = { path: '/', resver: 20230329 } function navigate(page) { get(page, { accept: 'text/html' }) .then(r => r.text()) .then(html => { const range = document.createRange(); range.selectNode(document.body); const doc = range.createContextualFragment(html); const container = document.querySelector('#container'); container.replaceChildren(doc); container.scrollTop = 0; }); } document.querySelector('#directory').addEventListener('click', ev => { const page = ev.target.dataset.page; if (typeof page === 'string') { location.hash = page; navigate(page); } }); let page = location.hash; if (page.length > 1) { page = page.substring(1); navigate(page); } /* init(null, { template: '/res.json', callback: result => console.log(result) }).then(() => { // document.querySelector('#create-icon').appendChild(createIcon('fa-solid', 'user-edit')) resolveIcon(document.querySelector('#create-icon')) // document.querySelector('#create-checkbox').appendChild(createCheckbox({ // label: 'Switch 1' // })) resolveCheckbox(document.querySelector('#create-checkbox')) resolveTooltip(document.querySelector('#buttons')) document.querySelector('#button-fetch').addEventListener('click', () => { get('javascript.svg', { // contentType: '', customerHeaders: { 'X-Auth': 'test/authentication' } }) .then(r => r.blob()) .then(blob => document.querySelector('#js-logo').src = URL.createObjectURL(blob)); }); }); */