Add dotjs and dotcss
This commit is contained in:
parent
dad0b115d6
commit
27a1d00d42
14 changed files with 4282 additions and 0 deletions
27
chromeExtentions/dotcss/dotcss.js
Normal file
27
chromeExtentions/dotcss/dotcss.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
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();
|
Loading…
Add table
Add a link
Reference in a new issue