Добавлена возможность загружать пользовательские обои, пока без синхронизации

This commit is contained in:
Book Pauk
2021-02-10 02:55:47 +07:00
parent 87a068899a
commit ed901fc181
16 changed files with 204 additions and 7 deletions

View File

@@ -0,0 +1,22 @@
class DynamicCss {
constructor() {
this.cssNodes = {};
}
replace(name, cssText) {
const style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = cssText;
const parent = document.getElementsByTagName('head')[0];
if (this.cssNodes[name]) {
parent.removeChild(this.cssNodes[name]);
delete this.cssNodes[name];
}
this.cssNodes[name] = parent.appendChild(style);
}
}
export default new DynamicCss();