Ajout d'une page a propos
This commit is contained in:
parent
7e654b4640
commit
cb10cc189c
6 changed files with 156 additions and 2 deletions
25
js/components/html.js
Normal file
25
js/components/html.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
class HTMLImportElement extends HTMLTemplateElement {
|
||||
|
||||
get src(){
|
||||
return new URL(this.getAttribute("src"), this.baseURI).toString();
|
||||
}
|
||||
|
||||
connectedCallback(){
|
||||
this.load()
|
||||
}
|
||||
|
||||
async load(){
|
||||
let res = await fetch(this.src);
|
||||
if(!res.ok){
|
||||
console.error(`Server responded with code ${res.status} ${res.statusText}`)
|
||||
return
|
||||
}
|
||||
|
||||
let htmlStr = await res.text()
|
||||
let html = new DOMParser().parseFromString(htmlStr, "text/html");
|
||||
|
||||
this.content.replaceChildren(...Array.from(html.querySelector("body").childNodes))
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("camp-html", HTMLImportElement, {extends: "template"})
|
||||
|
|
@ -223,6 +223,15 @@ bindButtonToCategory(document.getElementById("explore-on-schedule"), "on-schedul
|
|||
bindButtonToCategory(document.getElementById("explore-dodo"), "dodo")
|
||||
bindButtonToCategory(document.getElementById("explore-bin"), "bin")
|
||||
|
||||
document.getElementById("logo").addEventListener("click", e => {
|
||||
openFeature()
|
||||
let panel = document.getElementById("result-panel")
|
||||
panel.replaceChildren(document.getElementById("about-template").content.cloneNode(true));
|
||||
requestAnimationFrame(() => {
|
||||
panel.setActiveChildrenIndex(0, {behavior: "instant"})
|
||||
})
|
||||
})
|
||||
|
||||
{
|
||||
const RESULT_PANEL = document.getElementById("result-panel")
|
||||
/** @type {HTMLDialogElement} */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue