2021-04-12 18:29:11 +02:00
|
|
|
class svgLoad extends HTMLElement {
|
|
|
|
constructor(){
|
|
|
|
super();
|
|
|
|
let svgName = this.getAttribute("data-name");
|
|
|
|
let xhr = new XMLHttpRequest();
|
|
|
|
xhr.onreadystatechange = () => {
|
|
|
|
if(xhr.readyState === 4 && xhr.status === 200){
|
|
|
|
this.innerHTML = xhr.responseText;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-04 08:24:38 +01:00
|
|
|
xhr.open("GET", "/svg/" + svgName + ".svg");
|
2021-04-12 18:29:11 +02:00
|
|
|
xhr.send();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
customElements.define("jl-svg", svgLoad);
|