mirror of
https://github.com/Investigamer/cardconjurer.git
synced 2025-07-27 05:14:53 -05:00
24 lines
656 B
JavaScript
24 lines
656 B
JavaScript
function includeHTML() {
|
|
var elementList = document.getElementsByTagName('*');
|
|
for (var i = 0; i < elementList.length; i ++) {
|
|
element = elementList[i];
|
|
var file = element.getAttribute('html-include');
|
|
if (file) {
|
|
var xhttp = new XMLHttpRequest();
|
|
xhttp.onreadystatechange = function() {
|
|
if (this.readyState == 4) {
|
|
if (this.status == 200) {
|
|
element.innerHTML = this.responseText;
|
|
} else if (this.status == 404) {
|
|
element.innerHTML = 'HTML inclusion not found';
|
|
}
|
|
element.removeAttribute('html-include');
|
|
includeHTML();
|
|
}
|
|
}
|
|
xhttp.open('GET', file, true);
|
|
xhttp.send();
|
|
return;
|
|
}
|
|
}
|
|
} |