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.
30 lines
906 B
30 lines
906 B
6 years ago
|
if(window.location.host.indexOf(".local.jh") == -1){
|
||
7 years ago
|
var xhr = new XMLHttpRequest();
|
||
6 years ago
|
xhr.open('GET', 'https://dotjs.local.jh/' + window.location.host.replace(/^www\./, '') + '.js');
|
||
7 years ago
|
|
||
7 years ago
|
xhr.onreadystatechange = function() {
|
||
|
if(xhr.readyState == 4) {
|
||
|
if(xhr.status == 200) {
|
||
|
var script = document.createElement('script');
|
||
|
script.textContent = xhr.responseText;
|
||
|
document.head.appendChild(script);
|
||
|
return;
|
||
|
} else if(xhr.status == 404) {
|
||
|
var defaultXHR = new XMLHttpRequest();
|
||
6 years ago
|
defaultXHR.open('GET', 'https://dotjs.local.jh/default.js');
|
||
7 years ago
|
defaultXHR.onreadystatechange = function() {
|
||
|
if (defaultXHR.readyState == 4 && defaultXHR.status == 200){
|
||
|
var script = document.createElement('script');
|
||
|
script.textContent = defaultXHR.responseText;
|
||
|
document.head.appendChild(script);
|
||
|
return;
|
||
|
}
|
||
7 years ago
|
}
|
||
7 years ago
|
defaultXHR.send();
|
||
7 years ago
|
}
|
||
|
}
|
||
7 years ago
|
};
|
||
7 years ago
|
|
||
7 years ago
|
xhr.send();
|
||
|
}
|