add document, fix tooltip position issue
This commit is contained in:
33
main.js
33
main.js
@ -1,8 +1,7 @@
|
||||
import './css/ui.min.css'
|
||||
import './style.css'
|
||||
// import javascriptLogo from './javascript.svg'
|
||||
import { resolveCheckbox, resolveIcon, resolveTooltip } from './lib/ui'
|
||||
import { init, r, lang, get, post, upload } from './lib/utility'
|
||||
import { get } from './lib/utility'
|
||||
|
||||
// document.querySelector('#js-logo').src = javascriptLogo
|
||||
|
||||
@ -11,7 +10,36 @@ window.consts = {
|
||||
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);
|
||||
document.querySelector('#container').replaceChildren(doc);
|
||||
});
|
||||
}
|
||||
|
||||
document.querySelector('#directory').addEventListener('click', (ev) => {
|
||||
const page = ev.target.getAttribute('data-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'))
|
||||
@ -35,3 +63,4 @@ init(null, {
|
||||
.then(blob => document.querySelector('#js-logo').src = URL.createObjectURL(blob));
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
Reference in New Issue
Block a user