You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
815 B
28 lines
815 B
7 years ago
|
var xhr = new XMLHttpRequest();
|
||
|
xhr.open('GET', 'https://dotcss.local/' + window.location.host.replace(/^www\./, '') + '.css');
|
||
|
|
||
|
xhr.onreadystatechange = function() {
|
||
|
if(xhr.readyState == 4) {
|
||
|
if(xhr.status == 200) {
|
||
|
var style = document.createElement('style');
|
||
|
style.textContent = xhr.responseText;
|
||
|
document.head.appendChild(style);
|
||
|
return
|
||
|
} else if(xhr.status == 404) {
|
||
|
var defaultXHR = new XMLHttpRequest();
|
||
|
defaultXHR.open('GET', 'https://dotcss.local/default.css');
|
||
|
defaultXHR.onreadystatechange = function() {
|
||
|
if (defaultXHR.readyState == 4 && defaultXHR.status == 200){
|
||
|
var style = document.createElement('style');
|
||
|
style.textContent = defaultXHR.responseText;
|
||
|
document.head.appendChild(style);
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
defaultXHR.send();
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
xhr.send();
|