(async function() {
const response = await fetch("https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml");
const text = await response.text();
const parse = (new window.DOMParser()).parseFromString(text, "text/xml");
console.log(parse);
})();
fetch("https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml", {
method: "GET",
headers: {
'Content-Type': 'text/xml; charset=utf-8'
}
})
.then((response) => {
return response.text()
})
.then((str) => {
return(new window.DOMParser()).parseFromString(str, "text/xml")
})
.then((data) => {
console.log(data)
})
class FigureFilter {
size = null;
color = null;
shape = null;
constructor(selector) {
this.allFiguresNode = document.querySelectorAll(selector);
}
/**
* Эти свойства юзать при нажатии на кнопки
*/
changeSize(size) {
this.size = size;
this.#render();
}
changeColor(color) {
this.color = color;
this.#render();
}
changeShape(shape) {
this.shape = shape;
this.#render();
}
/**
* Эти не трогать
*/
#render() {
[...this.allFiguresNode].forEach(figure => {
this.#checkFigure(figure, 'size');
this.#checkFigure(figure, 'color');
this.#checkFigure(figure, 'shape');
})
}
#checkFigure(figure, area) {
figure.dataset[area] === this[area]
? this.#showFigure(figure)
: this.#hideFigure(figure);
}
#showFigure(el) {
el.setAttribute('hidden', true);
}
#hideFigure(el) {
el.removeAttribute('hidden');
}
}
let func=()=> {
button.remove();
let button_ok=window.document.createElement('button');
window.document.createElement('button');
button_ok.className='ok';
}