sync working code, and import type-doc
This commit is contained in:
38
main.js
38
main.js
@@ -1,6 +1,7 @@
|
||||
import './style.scss'
|
||||
// import javascriptLogo from './javascript.svg'
|
||||
import { get } from './lib/utility'
|
||||
import { createPicture, createAudio, createVideo, createPdf } from './lib/ui/media'
|
||||
|
||||
// document.querySelector('#js-logo').src = javascriptLogo
|
||||
|
||||
@@ -9,34 +10,13 @@ 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);
|
||||
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);
|
||||
}
|
||||
document.querySelector('#container').replaceChildren(
|
||||
// createPicture('https://fleet.foresightintelligence.com/doc/mmspart/1740581frZuuFhz5WWCysxs9oGB.jpg'),
|
||||
createAudio('audio/amr', 'http://vite.tsanie.org/1055003tb0DisaMu1615PeSXKG.amr'),
|
||||
createPdf('AG-PRO COMPANIES', 'https://fleet.foresightintelligence.com/doc/mmspart/1333321JLrYhkGYqsw6QSVMx3d.pdf'),
|
||||
// createPicture('https://fleet.foresightintelligence.com/doc/mmspart/138390UGZUMWRmqBsEgPnWuW16.gif'),
|
||||
// createVideo('https://fleet.foresightintelligence.com/doc/mmspart/17359338sR5qsG7TvS7eaUdP9PL.mp4'),
|
||||
);
|
||||
|
||||
/*
|
||||
init(null, {
|
||||
@@ -56,7 +36,7 @@ init(null, {
|
||||
document.querySelector('#button-fetch').addEventListener('click', () => {
|
||||
get('javascript.svg', {
|
||||
// contentType: '',
|
||||
customerHeaders: {
|
||||
customHeaders: {
|
||||
'X-Auth': 'test/authentication'
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user